From 22a5c6dbe0c1e221fc98971c08535dfb1eeda422 Mon Sep 17 00:00:00 2001 From: Helium314 Date: Tue, 26 Sep 2023 07:40:46 +0200 Subject: [PATCH] add another test, situation may need improvement --- .../inputmethod/latin/InputLogicTest.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/src/test/java/org/dslul/openboard/inputmethod/latin/InputLogicTest.kt b/app/src/test/java/org/dslul/openboard/inputmethod/latin/InputLogicTest.kt index df7175dc1..d35ae123c 100644 --- a/app/src/test/java/org/dslul/openboard/inputmethod/latin/InputLogicTest.kt +++ b/app/src/test/java/org/dslul/openboard/inputmethod/latin/InputLogicTest.kt @@ -315,6 +315,7 @@ class InputLogicTest { @Test fun urlProperlySelected() { reset() 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") setCursorPosition(18) // after .com functionalKeyPress(Constants.CODE_DELETE) @@ -327,6 +328,21 @@ class InputLogicTest { 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() { reset() DeviceProtectedUtils.getSharedPreferences(latinIME).edit { putBoolean(Settings.PREF_URL_DETECTION, true) }