mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-08 15:47:43 +00:00
fix phantom space after double quotes (#842)
and add a bunch of related tests --------- Co-authored-by: Helium314 <helium314@mailbox.org>
This commit is contained in:
parent
4a9dc6bff6
commit
fc0d27459f
2 changed files with 50 additions and 8 deletions
|
@ -545,8 +545,50 @@ class InputLogicTest {
|
|||
assertEquals("hello ", text)
|
||||
}
|
||||
|
||||
@Test fun `no weird space inside multi-"`() {
|
||||
reset()
|
||||
chainInput("\"\"\"")
|
||||
assertEquals("\"\"\"", text)
|
||||
|
||||
reset()
|
||||
DeviceProtectedUtils.getSharedPreferences(latinIME).edit { putBoolean(Settings.PREF_AUTOSPACE_AFTER_PUNCTUATION, true) }
|
||||
chainInput("\"\"\"")
|
||||
assertEquals("\"\"\"", text)
|
||||
}
|
||||
|
||||
@Test fun `autospace still happens after "`() {
|
||||
reset()
|
||||
DeviceProtectedUtils.getSharedPreferences(latinIME).edit { putBoolean(Settings.PREF_AUTOSPACE_AFTER_PUNCTUATION, true) }
|
||||
chainInput("\"hello\"you")
|
||||
assertEquals("\"hello\" you", text)
|
||||
}
|
||||
|
||||
@Test fun `autospace still happens after " if next word is in quotes`() {
|
||||
reset()
|
||||
DeviceProtectedUtils.getSharedPreferences(latinIME).edit { putBoolean(Settings.PREF_AUTOSPACE_AFTER_PUNCTUATION, true) }
|
||||
chainInput("\"hello\"\"you\"")
|
||||
assertEquals("\"hello\" \"you\"", text)
|
||||
}
|
||||
|
||||
@Test fun `autospace propagates over "`() {
|
||||
reset()
|
||||
input('"')
|
||||
pickSuggestion("hello")
|
||||
assertEquals(spaceState, SpaceState.PHANTOM) // picking a suggestion sets phantom space state
|
||||
chainInput("\"you")
|
||||
assertEquals("\"hello\" you", text)
|
||||
}
|
||||
|
||||
@Test fun `autospace still happens after " if nex word is in " and after comma`() {
|
||||
reset()
|
||||
DeviceProtectedUtils.getSharedPreferences(latinIME).edit { putBoolean(Settings.PREF_AUTOSPACE_AFTER_PUNCTUATION, true) }
|
||||
chainInput("\"hello\",\"you\"")
|
||||
assertEquals("\"hello\", \"you\"", text)
|
||||
}
|
||||
|
||||
@Test fun `autospace in json editor`() {
|
||||
reset()
|
||||
DeviceProtectedUtils.getSharedPreferences(latinIME).edit { putBoolean(Settings.PREF_AUTOSPACE_AFTER_PUNCTUATION, true) }
|
||||
chainInput("{\"label\":\"")
|
||||
assertEquals("{\"label\": \"", text)
|
||||
input('c')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue