Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2016-10-13 04:54:39 -0400
committerMickael Istria2016-10-13 05:09:28 -0400
commit1a9d72873c8c8c2b74bc39442a3a66dc786a9cf2 (patch)
treece0a499280a98fb181da4e9f074092b6fc76a506 /org.eclipse.ui.genericeditor.tests
parent8cbe29285e04f0b0e23b0346e953a62f0a8ccd75 (diff)
downloadeclipse.platform.text-1a9d72873c8c8c2b74bc39442a3a66dc786a9cf2.tar.gz
eclipse.platform.text-1a9d72873c8c8c2b74bc39442a3a66dc786a9cf2.tar.xz
eclipse.platform.text-1a9d72873c8c8c2b74bc39442a3a66dc786a9cf2.zip
Bug 505842 - [generic editor] Test failure in HoverTest.testHoverY20161013-1000
Add more pauses to let event process Change-Id: I5005c4c8879cf07d2cad0ce11aa5057849ced55e Signed-off-by: Mickael Istria <mistria@redhat.com>
Diffstat (limited to 'org.eclipse.ui.genericeditor.tests')
-rw-r--r--org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/HoverTest.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/HoverTest.java b/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/HoverTest.java
index 86f5bae8e..6d29a391f 100644
--- a/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/HoverTest.java
+++ b/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/HoverTest.java
@@ -96,6 +96,7 @@ public class HoverTest {
private Object getHoverData() throws Exception {
this.editor.selectAndReveal(2, 0);
+ waitAndDispatch();
// sending event to trigger hover computation
StyledText editorTextWidget = (StyledText) this.editor.getAdapter(Control.class);
editorTextWidget.getShell().forceActive();
@@ -111,11 +112,7 @@ public class HoverTest {
hoverEvent.doit = true;
editorTextWidget.notifyListeners(SWT.MouseHover, hoverEvent);
// Events need to be processed for hover listener to work correctly
- long timeout = 1000; //ms
- long start = System.currentTimeMillis();
- while (start + timeout > System.currentTimeMillis()) {
- Display.getDefault().readAndDispatch();
- }
+ waitAndDispatch();
// retrieving hover content
Method getSourceViewerMethod= AbstractTextEditor.class.getDeclaredMethod("getSourceViewer");
getSourceViewerMethod.setAccessible(true);
@@ -126,8 +123,16 @@ public class HoverTest {
Field informationField = AbstractInformationControlManager.class.getDeclaredField("fInformation");
informationField.setAccessible(true);
Object hoverData = informationField.get(hover);
- Thread.sleep(500); // hoverData populated asynchronously
+ waitAndDispatch();
return hoverData;
}
+ private void waitAndDispatch() {
+ long timeout = 1000; //ms
+ long start = System.currentTimeMillis();
+ while (start + timeout > System.currentTimeMillis()) {
+ Display.getDefault().readAndDispatch();
+ }
+ }
+
}

Back to the top