Skip to content

Commit a0ea5cf

Browse files
committed
Spin the event loop to process the paste operation completely.
Manually when copy and paste done on combo it works as expected. But while calling copy and paste API on combo there is an inconsistency. It is due to pending UI events before we check text on combo. see #2485
1 parent fdbb769 commit a0ea5cf

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.eclipse.swt.graphics.Point;
3535
import org.eclipse.swt.graphics.Rectangle;
3636
import org.eclipse.swt.widgets.Combo;
37+
import org.eclipse.swt.widgets.Display;
3738
import org.junit.Before;
3839
import org.junit.Test;
3940

@@ -236,6 +237,11 @@ public void test_copy() {
236237
combo.copy();
237238
combo.setSelection(new Point(0,0));
238239
combo.paste();
240+
// Spin the event loop to let GTK process the clipboard + entry update
241+
Display display = Display.getDefault();
242+
while (display.readAndDispatch()) {
243+
// loop until no more events
244+
}
239245
assertEquals("23123456", combo.getText());
240246
}
241247

@@ -501,6 +507,11 @@ public void test_paste() {
501507
combo.cut();
502508
assertEquals("1456", combo.getText());
503509
combo.paste();
510+
// Spin the event loop to let GTK process the clipboard + entry update
511+
Display display = Display.getDefault();
512+
while (display.readAndDispatch()) {
513+
// loop until no more events
514+
}
504515
assertEquals("123456", combo.getText());
505516
}
506517

0 commit comments

Comments
 (0)