aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Bullen2018-08-01 15:47:05 -0400
committerLucas Bullen2018-08-01 15:50:18 -0400
commitc4a95379dcef14524c9bc4cc6b1c8d1cc159e1c7 (patch)
tree9fcfdbbd36d0105fc2bb2c2a97d78effb5da4684
parent97ddfd50df364aeecf50475f6d45cb04c81ea46c (diff)
downloadeclipse.platform.text-c4a95379dcef14524c9bc4cc6b1c8d1cc159e1c7.tar.gz
eclipse.platform.text-c4a95379dcef14524c9bc4cc6b1c8d1cc159e1c7.tar.xz
eclipse.platform.text-c4a95379dcef14524c9bc4cc6b1c8d1cc159e1c7.zip
Bug 537195 - [Generic Editor] Failing hover test 3Y20180801-2200S4_9_0_M2I20180801-2000
- Wait for the hoverData to be populated before returning it Change-Id: Ie54021ff121fb371a8323fcb9c249111fdbda11c Signed-off-by: Lucas Bullen <lbullen@redhat.com>
-rw-r--r--org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/HoverTest.java21
1 files changed, 7 insertions, 14 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 a34c830c9..8f38ee3cf 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
@@ -29,7 +29,6 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
@@ -212,7 +211,7 @@ public class HoverTest extends AbstratGenericEditorTest {
return null;
}
- private Object getHoverData(AbstractInformationControlManager manager) throws Exception {
+ private Object getHoverData(AbstractInformationControlManager manager) {
Object hoverData = new Accessor(manager, AbstractInformationControlManager.class).get("fInformation");
return hoverData;
}
@@ -226,7 +225,7 @@ public class HoverTest extends AbstratGenericEditorTest {
protected boolean condition() {
return editorTextWidget.isFocusControl() && editorTextWidget.getSelection().x == caretLocation;
}
- }.waitForCondition(editorTextWidget.getDisplay(), 1000);
+ }.waitForCondition(editorTextWidget.getDisplay(), 3000);
// sending event to trigger hover computation
editorTextWidget.getShell().forceActive();
editorTextWidget.getShell().setActive();
@@ -241,21 +240,15 @@ public class HoverTest extends AbstratGenericEditorTest {
hoverEvent.doit = true;
editorTextWidget.getDisplay().setCursorLocation(editorTextWidget.toDisplay(hoverEvent.x, hoverEvent.y));
editorTextWidget.notifyListeners(SWT.MouseHover, hoverEvent);
- // Events need to be processed for hover listener to work correctly
- processViewEvents(editorTextWidget.getDisplay());
+ ITextViewer viewer= (ITextViewer) new Accessor(editor, AbstractTextEditor.class).invoke("getSourceViewer", new Object[0]);
+ AbstractInformationControlManager textHoverManager= (AbstractInformationControlManager) new Accessor(viewer, TextViewer.class).get("fTextHoverManager");
// retrieving hover content
- ITextViewer viewer = (ITextViewer)new Accessor(editor, AbstractTextEditor.class).invoke("getSourceViewer", new Object[0]);
- AbstractInformationControlManager textHoverManager = (AbstractInformationControlManager)new Accessor(viewer, TextViewer.class).get("fTextHoverManager");
- return textHoverManager;
- }
-
- private void processViewEvents(Display display) {
new DisplayHelper() {
@Override
protected boolean condition() {
- return !display.readAndDispatch();
+ return getHoverData(textHoverManager) != null;
}
- }.waitForCondition(display, 3000);
+ }.waitForCondition(hoverEvent.display, 6000);
+ return textHoverManager;
}
-
}