Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java2
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Shell.java21
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() {

Back to the top