Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,12 @@ Point computeNativeSize (long h, int wHint, int hHint, boolean changed) {
* <p>
* The current selection is copied to the clipboard.
* </p>
*
* <p>
* <strong>Note:</strong> Copy data to the Clipboard may be asynchronous. This
* means that the new clipboard content may not be immediately available right
* after calling this method. To ensure the update is visible, use
* {@link Display#asyncExec(Runnable)} before accessing the clipboard data.
* </p>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
Expand Down Expand Up @@ -1955,7 +1960,12 @@ long paintSurface () {
* The selected text is deleted from the widget
* and new text inserted from the clipboard.
* </p>
*
* <p>
* <strong>Note:</strong> Pasting data to controls may occurs asynchronously. The widget
* text may not reflect the updated value immediately after calling this method.
* The new text will appear once pending events are processed in the event loop.
* Use {@link Display#asyncExec(Runnable)} before accessing <code>getText()</code>.
* </p>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Display;
import org.junit.Before;
import org.junit.Test;

Expand Down Expand Up @@ -236,6 +237,11 @@ public void test_copy() {
combo.copy();
combo.setSelection(new Point(0,0));
combo.paste();
// Spin the event loop to let GTK process the clipboard + entry update
Display display = combo.getDisplay();
while (display.readAndDispatch()) {
// loop until no more events
}
assertEquals("23123456", combo.getText());
}

Expand Down Expand Up @@ -501,6 +507,11 @@ public void test_paste() {
combo.cut();
assertEquals("1456", combo.getText());
combo.paste();
// Spin the event loop to let GTK process the clipboard + entry update
Display display = combo.getDisplay();
while (display.readAndDispatch()) {
// loop until no more events
}
assertEquals("123456", combo.getText());
}

Expand Down
Loading