1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-02-26 14:46:00 +01:00

Add UI test for multicaret enter

For ticket VIM-3186
This commit is contained in:
Alex Plate 2024-01-05 18:01:23 +02:00
parent 4e43606932
commit a2681ce6cc
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F
2 changed files with 43 additions and 0 deletions
src/test/java/ui

View File

@ -90,6 +90,7 @@ class UiTests {
testGutterClick(editor)
testAddNewLineInNormalMode(editor)
testMappingToCtrlOrAltEnter(editor)
testMilticaretEnter(editor)
reenableIdeaVim(editor)
createFile("MyTest.java", this@uiTest)
@ -572,4 +573,43 @@ class UiTests {
vimExit()
}
// For VIM-3186
private fun ContainerFixture.testMilticaretEnter(editor: Editor) {
println("Run testMilticaretEnter...")
keyboard {
pressing(KeyEvent.VK_ALT) {
pressing(KeyEvent.VK_SHIFT) {
findText("One").click()
findText("Three").click()
findText("Five").click()
}
}
enterText("A")
enter()
}
assertEquals(3, editor.caretCount)
assertEquals("""
|One Two
|
|Three Four
|
|Five
|
""".trimMargin(), editor.text)
// Reset state
keyboard { escape() }
assertEquals(1, editor.caretCount)
resetPlainTest(editor)
vimExit()
}
private fun resetPlainTest(editor: Editor) {
editor.injectText(testTextForEditor)
}
}

View File

@ -44,6 +44,9 @@ class Editor(
val caretOffset: Int
get() = callJs("component.getEditor().getCaretModel().getOffset()", runInEdt = true)
val caretCount: Int
get() = callJs("component.getEditor().getCaretModel().getCaretCount()", runInEdt = true)
val isBlockCursor: Boolean
// get() = callJs("component.getEditor().getSettings().isBlockCursor()", true)
// Doesn't work at the moment because remote robot can't resolve classes from a plugin classloader