mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-06-01 19:34:05 +02:00
Fix threading in IncrementDecrementCheck.kt property test
This commit is contained in:
parent
cf49c0b76f
commit
2c7b966ec2
@ -9,6 +9,7 @@
|
|||||||
package org.jetbrains.plugins.ideavim.propertybased
|
package org.jetbrains.plugins.ideavim.propertybased
|
||||||
|
|
||||||
import com.intellij.ide.IdeEventQueue
|
import com.intellij.ide.IdeEventQueue
|
||||||
|
import com.intellij.openapi.application.ApplicationManager
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.testFramework.PlatformTestUtil
|
import com.intellij.testFramework.PlatformTestUtil
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
@ -34,11 +35,13 @@ class IncrementDecrementTest : VimPropertyTestBase() {
|
|||||||
moveCaretToRandomPlace(env, editor)
|
moveCaretToRandomPlace(env, editor)
|
||||||
env.executeCommands(Generator.sampledFrom(IncrementDecrementActions(editor, this)))
|
env.executeCommands(Generator.sampledFrom(IncrementDecrementActions(editor, this)))
|
||||||
} finally {
|
} finally {
|
||||||
|
ApplicationManager.getApplication().invokeAndWait {
|
||||||
reset(editor)
|
reset(editor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testPlayingWithNumbersGenerateNumber() {
|
fun testPlayingWithNumbersGenerateNumber() {
|
||||||
@ -62,12 +65,14 @@ class IncrementDecrementTest : VimPropertyTestBase() {
|
|||||||
|
|
||||||
NeovimTesting.assertState(editor, this.testInfo)
|
NeovimTesting.assertState(editor, this.testInfo)
|
||||||
} finally {
|
} finally {
|
||||||
|
ApplicationManager.getApplication().invokeAndWait {
|
||||||
reset(editor)
|
reset(editor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class IncrementDecrementActions(private val editor: Editor, val test: VimTestCase) : ImperativeCommand {
|
private class IncrementDecrementActions(private val editor: Editor, val test: VimTestCase) : ImperativeCommand {
|
||||||
override fun performCommand(env: ImperativeCommand.Environment) {
|
override fun performCommand(env: ImperativeCommand.Environment) {
|
||||||
@ -78,10 +83,12 @@ private class IncrementDecrementActions(private val editor: Editor, val test: Vi
|
|||||||
VimTestCase.typeText(listOf(action), editor, editor.project)
|
VimTestCase.typeText(listOf(action), editor, editor.project)
|
||||||
NeovimTesting.typeCommand(key, test.testInfo, editor)
|
NeovimTesting.typeCommand(key, test.testInfo, editor)
|
||||||
|
|
||||||
|
ApplicationManager.getApplication().invokeAndWait {
|
||||||
IdeEventQueue.getInstance().flushQueue()
|
IdeEventQueue.getInstance().flushQueue()
|
||||||
PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue()
|
PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val differentFormNumberGenerator = Generator.from { env ->
|
val differentFormNumberGenerator = Generator.from { env ->
|
||||||
val form = env.generate(Generator.sampledFrom(/*2,*/ 8, 10, 16))
|
val form = env.generate(Generator.sampledFrom(/*2,*/ 8, 10, 16))
|
||||||
|
Loading…
Reference in New Issue
Block a user