Skip to content

Commit 72b4a45

Browse files
committed
Fix flaky ensureCleanUpAddonCleansUp test
Add spinEventLoop() between the two hidePart() calls to drain pending events before the second hide. This ensures a clean event queue when CleanupAddon's asyncExec is queued for visCount==0, replacing the 30-second DisplayHelper.waitForCondition polling with a deterministic event drain. Fixes #3581
1 parent 4f7b636 commit 72b4a45

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/PartRenderingEngineTests.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
import org.eclipse.swt.widgets.Shell;
6565
import org.eclipse.swt.widgets.ToolBar;
6666
import org.eclipse.swt.widgets.Widget;
67-
import org.eclipse.ui.tests.harness.util.DisplayHelper;
6867
import org.junit.jupiter.api.AfterEach;
6968
import org.junit.jupiter.api.BeforeEach;
7069
import org.junit.jupiter.api.Disabled;
@@ -2446,13 +2445,13 @@ public void ensureCleanUpAddonCleansUp() {
24462445

24472446
assertTrue(partStackForPartBPartC.isToBeRendered(), " PartStack with children should be rendered");
24482447
partService.hidePart(partB);
2448+
// Drain pending events between hides so that the event queue is clean
2449+
// when the second hidePart queues CleanupAddon's asyncExec for visCount==0
2450+
contextRule.spinEventLoop();
24492451
partService.hidePart(partC);
2450-
// DisplayHelper.waitForCondition() handles event processing via Display.sleep()
2451-
// and retries. Calling spinEventLoop() here creates a race condition where
2452-
// events may be processed before CleanupAddon's asyncExec() is queued (line 352).
2453-
assertTrue(
2454-
DisplayHelper.waitForCondition(Display.getDefault(), 30_000,
2455-
() -> !partStackForPartBPartC.isToBeRendered()), "CleanupAddon should ensure that partStack is not rendered anymore, as all childs have been removed");
2452+
contextRule.spinEventLoop();
2453+
assertFalse(partStackForPartBPartC.isToBeRendered(),
2454+
"CleanupAddon should ensure that partStack is not rendered anymore, as all childs have been removed");
24562455
// PartStack with IPresentationEngine.NO_AUTO_COLLAPSE should not be removed
24572456
// even if children are removed
24582457
partService.hidePart(editor, true);

0 commit comments

Comments
 (0)