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

Add UI test for enter in insert and select modes

This commit is contained in:
Alex Plate 2024-01-05 18:31:02 +02:00
parent 4c0f17429b
commit f01cc4d0d0
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F

View File

@ -90,7 +90,9 @@ class UiTests {
testGutterClick(editor)
testAddNewLineInNormalMode(editor)
testMappingToCtrlOrAltEnter(editor)
`simple enter in insert mode`(editor)
testMilticaretEnter(editor)
`simple enter in select mode`(editor)
reenableIdeaVim(editor)
createFile("MyTest.java", this@uiTest)
@ -614,4 +616,82 @@ class UiTests {
editor.injectText(testTextForEditor)
vimExit()
}
private fun ContainerFixture.`simple enter in insert mode`(editor: Editor) {
println("Run test 'simple enter in insert mode'...")
// Start of file
keyboard {
enterText("i")
enter()
}
assertEquals(
"""
|
|One Two
|Three Four
|Five
""".trimMargin(),
editor.text
)
// Middle of file
findText("Four").click()
keyboard { enter() }
assertEquals(
"""
|
|One Two
|Three
|Four
|Five
""".trimMargin(),
editor.text
)
// End of file
val fivePoint = findText("Five").point
val endOfLine = Point(fivePoint.x + 50, fivePoint.y)
click(endOfLine)
keyboard { enter() }
assertEquals(
"""
|
|One Two
|Three
|Four
|Five
|
""".trimMargin(),
editor.text
)
editor.injectText(testTextForEditor)
vimExit()
}
private fun ContainerFixture.`simple enter in select mode`(editor: Editor) {
println("Run test 'simple enter in select mode'...")
findText("Four").doubleClick()
keyboard {
pressing(KeyEvent.VK_CONTROL) { enterText("g") }
enter()
}
assertEquals(
"""
|One Two
|Three
|
|Five
""".trimMargin(),
editor.text
)
editor.injectText(testTextForEditor)
vimExit()
}
}