Skip to content

Commit ff6bf58

Browse files
arunjose696iloveeclipse
authored andcommitted
Adding readAndDispatch() in drawImage test to make the test not flaky
The reasoning to add readAndDispatch() is to consider the case when e.gc.drawImage()'s draw request to the OS, might not have completed by the time gcCopy.copyArea() was called. Using readAndDispatch() is to ensure all OS events are processed, so there’s no pending work left.
1 parent 60de8f9 commit ff6bf58

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ public boolean isAutoScalable() {
279279
});
280280

281281
shell.open();
282+
while (display.readAndDispatch()) {
283+
}
282284
Image target = new Image(display, canvasWidth, canvasHeight);
283285
GC gcCopy = new GC(canvas);
284286
gcCopy.copyArea(target, 0, 0);

0 commit comments

Comments
 (0)