diff options
author | Lakshmi Shanmugam | 2018-07-02 10:16:53 +0000 |
---|---|---|
committer | Lakshmi Shanmugam | 2018-07-02 17:11:53 +0000 |
commit | e3d85de8d7b6cdbe683cdf4224e66299de6c3be0 (patch) | |
tree | 6c3a246a7b9906dd93548f895be1020e3a3012cc | |
parent | 057518a230cdef1a418482a1ab68b2ed4fdd8af8 (diff) | |
download | eclipse.platform.swt-e3d85de8d7b6cdbe683cdf4224e66299de6c3be0.tar.gz eclipse.platform.swt-e3d85de8d7b6cdbe683cdf4224e66299de6c3be0.tar.xz eclipse.platform.swt-e3d85de8d7b6cdbe683cdf4224e66299de6c3be0.zip |
[Bug 536564] Test failures on Mac OS X 10.13 from I20180628-0230
Adding/Increasing the timeout to fix the test failure on Mac 10.13.
Todo: Need to verify if fix in test_setActive(), fixes test failure on
GTK
Change-Id: I8d6ac45fd3a5f55e16ecad549f864e9ba66e2a9b
2 files changed, 22 insertions, 1 deletions
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java index de4638e1a7..42e1084354 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java @@ -219,7 +219,7 @@ public void test_getActiveShell() { Shell shell = new Shell(display); shell.setText("test_getActiveShell"); shell.open(); - drainEventQueue(display, 150); // workaround for https://bugs.eclipse.org/506680 + drainEventQueue(display, 200); // workaround for https://bugs.eclipse.org/506680 assertSame(shell, display.getActiveShell()); shell.dispose(); } finally { diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Shell.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Shell.java index 1d1cd096dc..289ae96c48 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Shell.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Shell.java @@ -507,6 +507,9 @@ public void test_setActive() { /* Create shell2 and make it active. */ Shell shell2 = new Shell(); shell2.open(); + if (SwtTestUtil.isCocoa) { + drainEventQueue(shell.getDisplay(), 1500); //workaround for Bug 536564 + } /* Test setActive for visible shell. */ shell.setVisible(true); @@ -534,6 +537,24 @@ public void test_setActive() { shell2.dispose(); } +private static void drainEventQueue(Display display, int millis) { + if (millis == 0) { + while (!display.isDisposed() && display.readAndDispatch()) { + } + return; + } + long end = System.currentTimeMillis() + millis; + while (!display.isDisposed() && System.currentTimeMillis() < end) { + if (!display.readAndDispatch ()) { + try { + Thread.sleep(10); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } +} + @Override @Test public void test_setEnabledZ() { |