mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-23 17:40:54 +00:00
add another test, situation may need improvement
This commit is contained in:
parent
3447212447
commit
22a5c6dbe0
1 changed files with 16 additions and 0 deletions
|
@ -315,6 +315,7 @@ class InputLogicTest {
|
||||||
@Test fun urlProperlySelected() {
|
@Test fun urlProperlySelected() {
|
||||||
reset()
|
reset()
|
||||||
DeviceProtectedUtils.getSharedPreferences(latinIME).edit { putBoolean(Settings.PREF_URL_DETECTION, true) }
|
DeviceProtectedUtils.getSharedPreferences(latinIME).edit { putBoolean(Settings.PREF_URL_DETECTION, true) }
|
||||||
|
setInputType(InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_URI)
|
||||||
setText("http://example.com/here")
|
setText("http://example.com/here")
|
||||||
setCursorPosition(18) // after .com
|
setCursorPosition(18) // after .com
|
||||||
functionalKeyPress(Constants.CODE_DELETE)
|
functionalKeyPress(Constants.CODE_DELETE)
|
||||||
|
@ -327,6 +328,21 @@ class InputLogicTest {
|
||||||
assertEquals("example.net", composingText)
|
assertEquals("example.net", composingText)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test fun urlProperlySelectedWhenNotDeletingFullTld() {
|
||||||
|
reset()
|
||||||
|
DeviceProtectedUtils.getSharedPreferences(latinIME).edit { putBoolean(Settings.PREF_URL_DETECTION, true) }
|
||||||
|
setText("http://example.com/here")
|
||||||
|
setCursorPosition(18) // after .com
|
||||||
|
functionalKeyPress(Constants.CODE_DELETE)
|
||||||
|
functionalKeyPress(Constants.CODE_DELETE) // delete om
|
||||||
|
// todo: this is a weird difference to deleting the full TLD (see urlProperlySelected)
|
||||||
|
// what do we want here? (probably consistency)
|
||||||
|
assertEquals("example.c/here", composingText)
|
||||||
|
chainInput("z")
|
||||||
|
assertEquals("", composingText) // todo: this is a weird difference to deleting the full TLD
|
||||||
|
// assertEquals("example.cz", composingText) // fails, but probably would be better than above
|
||||||
|
}
|
||||||
|
|
||||||
@Test fun dontCommitPartialUrlBeforeFirstPeriod() {
|
@Test fun dontCommitPartialUrlBeforeFirstPeriod() {
|
||||||
reset()
|
reset()
|
||||||
DeviceProtectedUtils.getSharedPreferences(latinIME).edit { putBoolean(Settings.PREF_URL_DETECTION, true) }
|
DeviceProtectedUtils.getSharedPreferences(latinIME).edit { putBoolean(Settings.PREF_URL_DETECTION, true) }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue