mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-20 14:19:08 +00:00
add input logic test for double space -> period (and deletion)
This commit is contained in:
parent
8f3e4fff8c
commit
b3aac1a05a
1 changed files with 13 additions and 1 deletions
|
@ -535,6 +535,16 @@ class InputLogicTest {
|
||||||
assertEquals("\"this i", text)
|
assertEquals("\"this i", text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test fun `double space results in period and space, and delete removes the period`() {
|
||||||
|
reset()
|
||||||
|
chainInput("hello")
|
||||||
|
input(' ')
|
||||||
|
input(' ')
|
||||||
|
assertEquals("hello. ", text)
|
||||||
|
functionalKeyPress(KeyCode.DELETE)
|
||||||
|
assertEquals("hello ", text)
|
||||||
|
}
|
||||||
|
|
||||||
// ------- helper functions ---------
|
// ------- helper functions ---------
|
||||||
|
|
||||||
// should be called before every test, so the same state is guaranteed
|
// should be called before every test, so the same state is guaranteed
|
||||||
|
@ -566,7 +576,9 @@ class InputLogicTest {
|
||||||
latinIME.onEvent(Event.createEventForCodePointFromUnknownSource(codePoint))
|
latinIME.onEvent(Event.createEventForCodePointFromUnknownSource(codePoint))
|
||||||
handleMessages()
|
handleMessages()
|
||||||
|
|
||||||
if (currentScript != ScriptUtils.SCRIPT_HANGUL) { // check fails if hangul combiner merges symbols
|
if (currentScript != ScriptUtils.SCRIPT_HANGUL // check fails if hangul combiner merges symbols
|
||||||
|
&& !(codePoint == Constants.CODE_SPACE && oldBefore.lastOrNull() == ' ') // check fails when 2 spaces are converted into a period
|
||||||
|
) {
|
||||||
if (phantomSpaceToInsert.isEmpty())
|
if (phantomSpaceToInsert.isEmpty())
|
||||||
assertEquals(oldBefore + insert, textBeforeCursor)
|
assertEquals(oldBefore + insert, textBeforeCursor)
|
||||||
else // in some cases autospace might be suppressed
|
else // in some cases autospace might be suppressed
|
||||||
|
|
Loading…
Add table
Reference in a new issue