Fix tests for move: check applicability from changed text
Presentation status has stopped working after https://github.com/JetBrains/intellij-community/commit/18ce2c6070667608d9bf5a18926778187564fd19
This commit is contained in:
+2
-2
@@ -1,9 +1,9 @@
|
||||
// MOVE: down
|
||||
class A {
|
||||
<caret>init {
|
||||
|
||||
// First
|
||||
}
|
||||
init {
|
||||
|
||||
// Second
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
// MOVE: down
|
||||
class A {
|
||||
init {
|
||||
|
||||
// Second
|
||||
}
|
||||
<caret>init {
|
||||
|
||||
// First
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
// MOVE: up
|
||||
class A {
|
||||
init {
|
||||
|
||||
// First
|
||||
}
|
||||
<caret>init {
|
||||
|
||||
// Second
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
// MOVE: up
|
||||
class A {
|
||||
<caret>init {
|
||||
|
||||
// Second
|
||||
}
|
||||
init {
|
||||
|
||||
// First
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
// MOVE: down
|
||||
class A {
|
||||
fun foo<T,
|
||||
U,
|
||||
W>(
|
||||
fun <T, U, W> foo(
|
||||
b:<caret> Int,
|
||||
a: Int,
|
||||
c: Int
|
||||
|
||||
+1
-3
@@ -1,8 +1,6 @@
|
||||
// MOVE: down
|
||||
class A {
|
||||
fun foo<T,
|
||||
U,
|
||||
W>(
|
||||
fun <T, U, W> foo(
|
||||
a: Int,
|
||||
b:<caret> Int,
|
||||
c: Int
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// MOVE: down
|
||||
class A {
|
||||
fun foo<T,
|
||||
U,
|
||||
W>(
|
||||
fun <T, U, W> foo(
|
||||
b: Int,
|
||||
<caret>a: Int,
|
||||
c: Int
|
||||
|
||||
+1
-3
@@ -1,8 +1,6 @@
|
||||
// MOVE: down
|
||||
class A {
|
||||
fun foo<T,
|
||||
U,
|
||||
W>(
|
||||
fun <T, U, W> foo(
|
||||
b: Int,
|
||||
c: Int,
|
||||
<caret>a: Int
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// MOVE: up
|
||||
class A {
|
||||
fun foo<T,
|
||||
U,
|
||||
W>(
|
||||
fun <T, U, W> foo(
|
||||
a: Int,
|
||||
b:<caret> Int,
|
||||
c: Int
|
||||
|
||||
+1
-3
@@ -1,8 +1,6 @@
|
||||
// MOVE: up
|
||||
class A {
|
||||
fun foo<T,
|
||||
U,
|
||||
W>(
|
||||
fun <T, U, W> foo(
|
||||
b:<caret> Int,
|
||||
a: Int,
|
||||
c: Int
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// MOVE: up
|
||||
class A {
|
||||
fun foo<T,
|
||||
U,
|
||||
W>(
|
||||
fun <T, U, W> foo(
|
||||
b: Int,
|
||||
c: Int
|
||||
<caret>a: Int,
|
||||
|
||||
+1
-3
@@ -1,8 +1,6 @@
|
||||
// MOVE: up
|
||||
class A {
|
||||
fun foo<T,
|
||||
U,
|
||||
W>(
|
||||
fun <T, U, W> foo(
|
||||
b: Int,
|
||||
<caret>a: Int,
|
||||
c: Int
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
// MOVE: down
|
||||
// IS_APPLICABLE: false
|
||||
class A {
|
||||
fun foo<T,
|
||||
U,
|
||||
W>(
|
||||
fun <T, U, W> foo(
|
||||
b: Int,
|
||||
c: Int
|
||||
<caret>a: Int,
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
// MOVE: up
|
||||
// IS_APPLICABLE: false
|
||||
class A {
|
||||
fun foo<T,
|
||||
U,
|
||||
W>(
|
||||
fun <T, U, W> foo(
|
||||
b: Int<caret>,
|
||||
c: Int
|
||||
a: Int,
|
||||
|
||||
+7
-5
@@ -99,13 +99,15 @@ abstract class AbstractCodeMoverTest : LightCodeInsightTestCase() {
|
||||
val editor = LightPlatformCodeInsightTestCase.getEditor()
|
||||
val dataContext = LightPlatformCodeInsightTestCase.getCurrentEditorDataContext()
|
||||
|
||||
val presentation = Presentation()
|
||||
action.update(editor, presentation, dataContext)
|
||||
TestCase.assertEquals(isApplicableExpected, presentation.isEnabled)
|
||||
val before = editor.document.text
|
||||
runWriteAction { action.actionPerformed(editor, dataContext) }
|
||||
|
||||
val after = editor.document.text
|
||||
val actionDoesNothing = after == before
|
||||
|
||||
TestCase.assertEquals(isApplicableExpected, !actionDoesNothing)
|
||||
|
||||
if (isApplicableExpected) {
|
||||
runWriteAction { action.actionPerformed(editor, dataContext) }
|
||||
|
||||
val afterFilePath = path + ".after"
|
||||
try {
|
||||
checkResultByFile(afterFilePath)
|
||||
|
||||
Reference in New Issue
Block a user