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:
Nikolay Krasko
2016-07-01 16:17:39 +03:00
parent a471d8907a
commit 3d0d82b862
15 changed files with 25 additions and 43 deletions
@@ -1,9 +1,9 @@
// MOVE: down
class A {
<caret>init {
// First
}
init {
// Second
}
}
@@ -1,9 +1,9 @@
// MOVE: down
class A {
init {
// Second
}
<caret>init {
// First
}
}
@@ -1,9 +1,9 @@
// MOVE: up
class A {
init {
// First
}
<caret>init {
// Second
}
}
@@ -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,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,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,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,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,
@@ -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)