Skip to content

Commit 8c17953

Browse files
committed
Try to make the console name test more stable
Fixes #2544
1 parent d420ea8 commit 8c17953

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ProcessConsoleTests.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
import static org.assertj.core.api.Assertions.assertThat;
1818
import static org.eclipse.debug.tests.TestUtil.waitWhile;
1919
import static org.junit.jupiter.api.Assertions.assertEquals;
20+
import static org.junit.jupiter.api.Assertions.assertFalse;
2021
import static org.junit.jupiter.api.Assertions.assertNotEquals;
22+
import static org.junit.jupiter.api.Assertions.assertNull;
2123
import static org.junit.jupiter.api.Assertions.assertTrue;
2224

2325
import java.io.ByteArrayInputStream;
@@ -66,6 +68,7 @@
6668
import org.eclipse.jface.text.IRegion;
6769
import org.eclipse.jface.util.PropertyChangeEvent;
6870
import org.eclipse.ui.IPerspectiveDescriptor;
71+
import org.eclipse.ui.IViewReference;
6972
import org.eclipse.ui.IWorkbenchPage;
7073
import org.eclipse.ui.PlatformUI;
7174
import org.eclipse.ui.console.ConsolePlugin;
@@ -691,15 +694,21 @@ public void testConsoleNameUpdateForVisibleAndHiddenConsoles() throws Exception
691694
assertNotEquals(console1NameAfterReshow, console1.getName(), "Visible console should resume name updates after view is shown again");
692695
assertEquals(console2NameAfterReshow, console2.getName(), "Hidden console name should not update after view is restored");
693696

697+
activePage.hideView(consoleView);
698+
TestUtil.processUIEvents(1000);
699+
694700
console1NameAfterReshow = console1.getName();
695701
console2NameAfterReshow = console2.getName();
696702

697-
activePage.hideView(consoleView);
698-
699703
// Wait >1 second for update
700704
TestUtil.processUIEvents(2000);
701-
assertEquals(console1NameAfterReshow, console1.getName(), "Console name should not update when console view is minimized");
702-
assertEquals(console2NameAfterReshow, console2.getName(), "Console name should not update when console view is minimized");
705+
706+
IViewReference ref = activePage.findViewReference(IConsoleConstants.ID_CONSOLE_VIEW);
707+
assertNull(ref, "Console view reference should be null after hiding the view");
708+
assertFalse(activePage.isPartVisible(consoleView), "Console view should be hidden");
709+
710+
assertEquals(console1NameAfterReshow, console1.getName(), "Console name should not update when console view is hidden");
711+
assertEquals(console2NameAfterReshow, console2.getName(), "Console name should not update when console view is hidden");
703712

704713
mockProcess1.destroy();
705714
mockProcess2.destroy();

0 commit comments

Comments
 (0)