Skip to content

Commit 678c661

Browse files
committed
Spin event loop to process pending UI updates before checking the pasted
content on the Text. As content copy/paste works well manually junit fails because junit checks the text content well before it is updated by GTK. So it is a timing delay. Processing all the pending events make sure text is updated(Either by introducing some delay in junit or really processing any pending UI updates). see #2491
1 parent c6a29a9 commit 678c661

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,11 @@ public void test_copy() {
288288

289289
text.setText("");
290290
text.paste();
291+
// Spin the event loop to let GTK process the clipboard + entry update
292+
Display display = text.getDisplay();
293+
while (display.readAndDispatch()) {
294+
// loop until no more events
295+
}
291296
assertEquals("00000", text.getText());
292297

293298
// tests a SINGLE line text editor
@@ -307,6 +312,9 @@ public void test_copy() {
307312

308313
text.setText("");
309314
text.paste();
315+
while (display.readAndDispatch()) {
316+
// loop until no more events
317+
}
310318
assertEquals("00000", text.getText());
311319
}
312320

0 commit comments

Comments
 (0)