Fix compilation AbstractTypingIndentationTestBase for 191

This commit is contained in:
Vladimir Dolzhenko
2020-04-17 21:36:36 +02:00
parent 4d7d407e87
commit 5531ec3d28
3 changed files with 29 additions and 5 deletions
@@ -5,6 +5,12 @@
package org.jetbrains.kotlin.idea.test
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import com.intellij.testFramework.LightPlatformCodeInsightTestCase
abstract class KotlinLightPlatformCodeInsightTestCase : LightPlatformCodeInsightTestCase()
// BUNCH: 191
abstract class KotlinLightPlatformCodeInsightTestCase : LightPlatformCodeInsightTestCase() {
protected inline val project_: Project get() = project
protected inline val editor_: Editor get() = editor
}
@@ -0,0 +1,18 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.test
import com.intellij.openapi.project.Project
import com.intellij.testFramework.LightPlatformCodeInsightTestCase
import com.intellij.testFramework.LightPlatformTestCase
import sun.jvm.hotspot.ui.Editor
// BUNCH: 191
abstract class KotlinLightPlatformCodeInsightTestCase : LightPlatformCodeInsightTestCase() {
protected inline val project_: Project get() = LightPlatformTestCase.getProject()
protected inline val editor_: Editor get() = LightPlatformCodeInsightTestCase.getEditor()
}
@@ -23,7 +23,7 @@ abstract class AbstractTypingIndentationTestBase : KotlinLightPlatformCodeInsigh
val originFilePath = testFileName + testFileExtension
val originalFileText = FileUtil.loadFile(File(originFilePath), true)
try {
val configurator = FormatSettingsUtil.createConfigurator(originalFileText, CodeStyle.getSettings(project))
val configurator = FormatSettingsUtil.createConfigurator(originalFileText, CodeStyle.getSettings(project_))
if (!inverted) {
configurator.configureSettings()
} else {
@@ -32,16 +32,16 @@ abstract class AbstractTypingIndentationTestBase : KotlinLightPlatformCodeInsigh
doNewlineTest(originFilePath, afterFilePath)
} finally {
CodeStyle.getSettings(project).clearCodeStyleSettings()
CodeStyle.getSettings(project_).clearCodeStyleSettings()
}
}
private fun doNewlineTest(beforeFilePath: String, afterFilePath: String) {
configureByFile(beforeFilePath)
type('\n')
val caretModel = editor.caretModel
val caretModel = editor_.caretModel
val offset = caretModel.offset
val actualTextWithCaret = StringBuilder(editor.document.text).insert(offset, EditorTestUtil.CARET_TAG).toString()
val actualTextWithCaret = StringBuilder(editor_.document.text).insert(offset, EditorTestUtil.CARET_TAG).toString()
KotlinTestUtils.assertEqualsToFile(File(afterFilePath), actualTextWithCaret)
}