Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Keller2016-11-02 14:51:01 +0000
committerMarkus Keller2016-11-02 14:51:01 +0000
commit4e6a9e3c38746189b66cccde316a7a801ba9c8bd (patch)
tree95b3753bbc629535cef8d17f9ad12dcc7335fbd6
parentc6e0262106b4580d881587022e89037955defb10 (diff)
downloadeclipse.platform.swt-4e6a9e3c38746189b66cccde316a7a801ba9c8bd.tar.gz
eclipse.platform.swt-4e6a9e3c38746189b66cccde316a7a801ba9c8bd.tar.xz
eclipse.platform.swt-4e6a9e3c38746189b66cccde316a7a801ba9c8bd.zip
Bug 492569: Display#getCursorLocation() sometimes fails after Display#setCursorLocation(..)Y20161103-1000
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java7
1 files changed, 7 insertions, 0 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 eee67f6075..9f973967ad 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
@@ -222,6 +222,11 @@ public void test_getActiveShell() {
}
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 ()) {
@@ -1174,6 +1179,7 @@ public void test_setCursorLocationII() {
try {
Point location = new Point(100, 100);
display.setCursorLocation(location.x, location.y); // don't put cursor into a corner, since that could trigger special platform events
+ drainEventQueue(display, 150); // workaround for https://bugs.eclipse.org/492569
Screenshots.takeScreenshot(getClass(), testName.getMethodName());
Point actual = display.getCursorLocation();
if (!BUG_492569) {
@@ -1198,6 +1204,7 @@ public void test_setCursorLocationLorg_eclipse_swt_graphics_Point() {
} catch (IllegalArgumentException e) {
assertSWTProblem("Incorrect exception thrown for setCursorLocation with null argument", SWT.ERROR_NULL_ARGUMENT, e);
}
+ drainEventQueue(display, 150); // workaround for https://bugs.eclipse.org/492569
Screenshots.takeScreenshot(getClass(), testName.getMethodName());
Point actual = display.getCursorLocation();
if (!BUG_492569) {

Back to the top