diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/contentassist/AsyncContentAssistTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/contentassist/AsyncContentAssistTest.java index 751c1ffb9..83f9c28a5 100644 --- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/contentassist/AsyncContentAssistTest.java +++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/contentassist/AsyncContentAssistTest.java @@ -153,14 +153,19 @@ public void testCompleteActivationChar() { final Set beforeShells= Arrays.stream(display.getShells()).filter(Shell::isVisible).collect(Collectors.toSet()); Event keyEvent= new Event(); Control control= viewer.getTextWidget(); - display.timerExec(200, new Runnable() { + display.timerExec(0, new Runnable() { @Override public void run() { if (control.isDisposed()) { // https://github.com/eclipse-platform/eclipse.platform.text/issues/75#issuecomment-1263429480 return; // do not fail other unit tests } - control.forceFocus(); + control.getShell().forceActive(); + if (!control.forceFocus()) { + display.timerExec(200, this); + System.out.println("no focus"); + return; + } keyEvent.widget= control; keyEvent.type= SWT.KeyDown; keyEvent.character= 'b'; @@ -170,6 +175,7 @@ public void run() { control.getDisplay().post(keyEvent); DisplayHelper.driveEventQueue(control.getDisplay()); if (!document.get().startsWith("bb")) { + System.out.println("character b not added to control"); display.timerExec(200, this); } } @@ -185,7 +191,7 @@ protected boolean condition() { } return false; } - }.waitForCondition(display, 4000)); + }.waitForCondition(display, 40000)); } private static Table findCompletionSelectionControl(Widget control) {