Bug 492569: Display#getCursorLocation() sometimes fails after Display#setCursorLocation(..)
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 eee67f6..9f97396 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 @@
 }
 
 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 @@
 	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 @@
 		} 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) {