1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-04-30 22:34:04 +02:00

Fix threading in IncrementDecrementCheck.kt property test

This commit is contained in:
Alex Plate 2025-03-04 18:16:41 +02:00
parent cf49c0b76f
commit 2c7b966ec2
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F

View File

@ -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,7 +35,9 @@ 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 {
reset(editor) ApplicationManager.getApplication().invokeAndWait {
reset(editor)
}
} }
} }
} }
@ -62,7 +65,9 @@ class IncrementDecrementTest : VimPropertyTestBase() {
NeovimTesting.assertState(editor, this.testInfo) NeovimTesting.assertState(editor, this.testInfo)
} finally { } finally {
reset(editor) ApplicationManager.getApplication().invokeAndWait {
reset(editor)
}
} }
} }
} }
@ -78,8 +83,10 @@ 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)
IdeEventQueue.getInstance().flushQueue() ApplicationManager.getApplication().invokeAndWait {
PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue() IdeEventQueue.getInstance().flushQueue()
PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue()
}
} }
} }