try to fix BlackListMethodIntentionTest failures on build server

make the test more reliable - test only terminal state, after all
transient operations are complete
This commit is contained in:
Dmitry Batrak
2017-11-10 14:40:13 +03:00
parent 65043c57e0
commit 8e59d346b5
2 changed files with 8 additions and 23 deletions
@@ -14,6 +14,7 @@ import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupElementPresentation;
import com.intellij.ide.highlighter.JavaFileType;
import com.intellij.openapi.actionSystem.IdeActions;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ex.EditorSettingsExternalizable;
import com.intellij.psi.JavaCodeFragmentFactory;
import com.intellij.psi.PsiExpressionCodeFragment;
@@ -859,9 +860,9 @@ public class CompletionHintsTest extends LightFixtureCompletionTestCase {
selectItem(element);
}
private void waitTillAnimationCompletes() {
public static void waitTillAnimationCompletes(Editor editor) {
long deadline = System.currentTimeMillis() + 60_000;
while (ParameterHintsPresentationManager.getInstance().isAnimationInProgress(getEditor())) {
while (ParameterHintsPresentationManager.getInstance().isAnimationInProgress(editor)) {
if (System.currentTimeMillis() > deadline) fail("Too long waiting for animation to finish");
LockSupport.parkNanos(10_000_000);
UIUtil.dispatchAllInvocationEvents();
@@ -875,7 +876,7 @@ public class CompletionHintsTest extends LightFixtureCompletionTestCase {
private void waitForAllAsyncStuff() throws TimeoutException {
waitForParameterInfoUpdate();
myFixture.doHighlighting();
waitTillAnimationCompletes();
waitTillAnimationCompletes(getEditor());
waitForAutoPopup();
}
}
@@ -1,22 +1,8 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.java.codeInsight.daemon.inlays
import com.intellij.codeInsight.daemon.impl.ParameterHintsPresentationManager
import com.intellij.codeInsight.hints.settings.ParameterNameHintsSettings
import com.intellij.java.codeInsight.completion.CompletionHintsTest
import com.intellij.openapi.editor.ex.EditorSettingsExternalizable
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
import org.assertj.core.api.Assertions.assertThat
@@ -81,12 +67,10 @@ class ParamHintsTest {
val intention = myFixture.getAvailableIntention("Do not show hints for current method")
myFixture.launchAction(intention!!)
myFixture.doHighlighting()
CompletionHintsTest.waitTillAnimationCompletes(editor)
val after = editor.inlayModel.getInlineElementsInRange(caretOffset, caretOffset)
assertThat(after).hasSize(1)
val text = ParameterHintsPresentationManager.getInstance().getHintText(after[0])
assertThat(text).isNull()
assertThat(after).isEmpty()
}
}