From 6b5a73ffa909822eb6994e98fdc12178881a38c3 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Tue, 17 Sep 2019 18:21:49 +0300 Subject: [PATCH] Enable resolve in dispatch thread check for copy-paste tests --- ...bstractLiteralTextToKotlinCopyPasteTest.kt | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/idea/tests/org/jetbrains/kotlin/idea/editor/AbstractLiteralTextToKotlinCopyPasteTest.kt b/idea/tests/org/jetbrains/kotlin/idea/editor/AbstractLiteralTextToKotlinCopyPasteTest.kt index 4ac45a1744e..e25b8b7d9be 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/editor/AbstractLiteralTextToKotlinCopyPasteTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/editor/AbstractLiteralTextToKotlinCopyPasteTest.kt @@ -7,33 +7,38 @@ package org.jetbrains.kotlin.idea.conversion.copy import com.intellij.openapi.actionSystem.IdeActions import org.jetbrains.kotlin.idea.AbstractCopyPasteTest +import org.jetbrains.kotlin.idea.caches.resolve.forceResolveInWriteActionCheckInTests import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor import org.jetbrains.kotlin.idea.test.PluginTestCaseBase import org.jetbrains.kotlin.test.KotlinTestUtils import java.io.File abstract class AbstractLiteralTextToKotlinCopyPasteTest : AbstractCopyPasteTest() { - private val BASE_PATH = PluginTestCaseBase.getTestDataPathBase() + "/copyPaste/plainTextLiteral" + private val _basePath = PluginTestCaseBase.getTestDataPathBase() + "/copyPaste/plainTextLiteral" - - override fun getTestDataPath() = BASE_PATH + override fun getTestDataPath() = _basePath override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE - fun doTest(path: String) { - myFixture.testDataPath = BASE_PATH + myFixture.testDataPath = _basePath val testName = getTestName(false) - myFixture.configureByFiles(testName + ".txt") + myFixture.configureByFiles("$testName.txt") val fileText = myFixture.editor.document.text if (!myFixture.editor.selectionModel.hasSelection()) myFixture.editor.selectionModel.setSelection(0, fileText.length) - myFixture.performEditorAction(IdeActions.ACTION_COPY) - configureTargetFile(testName + ".kt") + forceResolveInWriteActionCheckInTests { + myFixture.performEditorAction(IdeActions.ACTION_COPY) + } + + configureTargetFile("$testName.kt") + + forceResolveInWriteActionCheckInTests { + myFixture.performEditorAction(IdeActions.ACTION_PASTE) + } - myFixture.performEditorAction(IdeActions.ACTION_PASTE) KotlinTestUtils.assertEqualsToFile(File(path.replace(".txt", ".expected.kt")), myFixture.file.text) } }