From 9870922161cade78af44ed0a5dbaf772b552780a Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Mon, 10 Aug 2026 08:06:10 +0200 Subject: [PATCH] Wait for the deferred zoom font disposal in ConsoleTests ConsoleZoomHandler disposes the custom zoom fonts of a removed console one UI cycle later via timerExec, but the test asserted the disposal immediately after the console list had drained. On a fast machine the assertion could therefore run before the timer fired, which made testRemovingConsoleDisposesZoomFont fail sporadically on the macOS CI runners. Poll for both conditions with TestUtil.waitWhile instead. --- .../eclipse/debug/tests/console/ConsoleTests.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java b/debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java index cda9854c14e..566ed8911c4 100644 --- a/debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java +++ b/debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java @@ -469,13 +469,12 @@ public void testRemovingConsoleDisposesZoomFont(TestInfo testInfo) throws Except assertFalse(zoomFont.isDisposed(), "the zoom font must not be disposed while its console is still open"); removeConsoles(console); - TestUtil.processUIEvents(200); - long startTime = System.currentTimeMillis(); - while (getConsoleManager().getConsoles().length > 0 && System.currentTimeMillis() - startTime < 60_000) { - TestUtil.processUIEvents(200); - } - assertEquals(0, getConsoleManager().getConsoles().length, "Should have no consoles after removal, but some are still present: " + Arrays.toString(getConsoleManager().getConsoles())); - assertTrue(zoomFont.isDisposed(), "the zoom font must be disposed once its console is removed"); + TestUtil.waitWhile(() -> getConsoleManager().getConsoles().length > 0, 60_000, + () -> "Should have no consoles after removal, but some are still present: " + + Arrays.toString(getConsoleManager().getConsoles())); + // the zoom fonts are disposed a UI cycle later, see ConsoleZoomHandler + TestUtil.waitWhile(() -> !zoomFont.isDisposed(), 10_000, + () -> "the zoom font must be disposed once its console is removed"); } finally { removeConsoles(console); hideConsoleView(consoleView);