diff options
author | Andrey Loskutov | 2019-10-09 09:41:44 +0000 |
---|---|---|
committer | Andrey Loskutov | 2019-10-09 09:41:44 +0000 |
commit | 6ec0726da1db60d5829eaddb7365bcd195650f5b (patch) | |
tree | cd2bc352adee432bab4843cff5d5586f86354edd | |
parent | f4e018022e54f4c75b5dd8c8614d2ab2a7c0f17e (diff) | |
download | eclipse.platform.text-6ec0726da1db60d5829eaddb7365bcd195650f5b.tar.gz eclipse.platform.text-6ec0726da1db60d5829eaddb7365bcd195650f5b.tar.xz eclipse.platform.text-6ec0726da1db60d5829eaddb7365bcd195650f5b.zip |
Bug 551570 - Two org.eclipse.ui.genericeditor.tests.ContextInfoTestS4_14_0_M1I20191009-1800I20191009-0600
fails on Linux since I20190926-0625, part 2
Relaxed time constraints in the ContextInfoTest
Change-Id: If7ad1876f3206eadd9298fa45ca42761282f83f5
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r-- | org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/ContextInfoTest.java | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/ContextInfoTest.java b/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/ContextInfoTest.java index cf9723449be..dd7ffbc1bba 100644 --- a/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/ContextInfoTest.java +++ b/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/ContextInfoTest.java @@ -34,6 +34,7 @@ import org.eclipse.jface.text.contentassist.ContentAssistant; import org.eclipse.jface.text.source.SourceViewer; import org.eclipse.ui.genericeditor.tests.contributions.BarContentAssistProcessor; +import org.eclipse.ui.tests.harness.util.UITestCase; import org.eclipse.ui.texteditor.ITextEditorActionConstants; import org.eclipse.ui.texteditor.TextOperationAction; @@ -54,16 +55,18 @@ public class ContextInfoTest extends AbstratGenericEditorTest { TextOperationAction action = (TextOperationAction) editor.getAction(ITextEditorActionConstants.CONTENT_ASSIST_CONTEXT_INFORMATION); editor.selectAndReveal(4, 0); + UITestCase.processEvents(); + action.update(); action.run(); - waitAndDispatch(100); this.completionShell= findNewShell(beforeShells); assertEquals("idx= 0", getInfoText(this.completionShell)); editor.selectAndReveal(8, 0); + UITestCase.processEvents(); + action.update(); action.run(); - waitAndDispatch(100); this.completionShell= findNewShell(beforeShells); assertEquals("idx= 1", getInfoText(this.completionShell)); } @@ -77,15 +80,17 @@ public class ContextInfoTest extends AbstratGenericEditorTest { TextOperationAction action = (TextOperationAction) editor.getAction(ITextEditorActionConstants.CONTENT_ASSIST_CONTEXT_INFORMATION); editor.selectAndReveal(4, 0); + UITestCase.processEvents(); + action.update(); action.run(); - waitAndDispatch(100); this.completionShell= findNewShell(beforeShells); editor.selectAndReveal(8, 0); + UITestCase.processEvents(); + action.update(); action.run(); - waitAndDispatch(100); this.completionShell= findNewShell(beforeShells); editor.getAction(ITextEditorActionConstants.DELETE_LINE).run(); @@ -97,12 +102,22 @@ public class ContextInfoTest extends AbstratGenericEditorTest { private Shell findNewShell(Set<Shell> beforeShells) { + waitAndDispatch(100); + Shell[] afterShells= findNewShells(beforeShells); + if(afterShells.length == 0) { + waitAndDispatch(1000); + } + afterShells= findNewShells(beforeShells); + assertEquals("No new shell found", 1, afterShells.length); + return afterShells[0]; + } + + private Shell[] findNewShells(Set<Shell> beforeShells) { Shell[] afterShells = Arrays.stream(editor.getSite().getShell().getDisplay().getShells()) .filter(Shell::isVisible) .filter(shell -> !beforeShells.contains(shell)) .toArray(Shell[]::new); - assertEquals("No new shell found", 1, afterShells.length); - return afterShells[0]; + return afterShells; } private String getInfoText(final Shell shell) { |