Fix: Multi-window UI tests can produce inconsistent results

After creating a new scene in a separate window when performing UI
tests, the respective view layer for the window may not be updated
immediately in the event loop.

Previously, this was mitigated with a single `yield` statement that
would delay processing by a single tick. To fix this issue, this commit
adds the capability to yield for a specific `timedelta` and waits this
amount of time for the two affected tests.

Pull Request: https://projects.blender.org/blender/blender/pulls/136012
This commit is contained in:
Sean Kim
2025-04-02 21:38:05 +02:00
committed by Sean Kim
parent 5546fe9848
commit f1c87d1bd2
2 changed files with 12 additions and 2 deletions

View File

@@ -2,6 +2,7 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
import datetime
import string
import bpy
event_types = tuple(
@@ -341,6 +342,8 @@ def run(
if isinstance(val, EventGenerate) or val is None:
return 0.0
elif isinstance(val, datetime.timedelta):
return val.total_seconds()
elif val is Ellipsis:
if on_exit is not None:
on_exit()