Skip to content

Commit 7bff548

Browse files
committed
Process events until parent shell is activated
It may take some event cycles before the parent shell that is getting focus/activation back gets the notification. Therefore wait until the Activate listener is called
1 parent 85879e7 commit 7bff548

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Shell.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import org.eclipse.swt.widgets.Shell;
4444
import org.eclipse.swt.widgets.Text;
4545
import org.junit.jupiter.api.BeforeEach;
46+
import org.junit.jupiter.api.RepeatedTest;
4647
import org.junit.jupiter.api.Test;
4748

4849
/**
@@ -652,8 +653,8 @@ public void test_setBoundsLorg_eclipse_swt_graphics_Rectangle() {
652653
* Regression test for Bug 436841 - [GTK3] FocusOut/In and Activate/Deactivate
653654
* events when opening context menu. Only applicable on GTK x11.
654655
*/
655-
@Test
656-
public void test_activateEventSend() {
656+
@RepeatedTest(value = 1000)
657+
public void test_activateEventSend() throws InterruptedException {
657658
if (SwtTestUtil.isGTK && SwtTestUtil.isX11) {
658659
Shell testShell = new Shell(shell, SWT.SHELL_TRIM);
659660
testShell.addListener(SWT.Activate, e -> {
@@ -666,6 +667,7 @@ public void test_activateEventSend() {
666667
listenerCalled = false;
667668
childShell.open();
668669
childShell.dispose();
670+
SwtTestUtil.processEvents(1000, () -> listenerCalled);
669671
assertTrue(listenerCalled);
670672
}
671673
}

0 commit comments

Comments
 (0)