From 8ea693d92e1c2db0808fd4d8089b531da3b9326d Mon Sep 17 00:00:00 2001 From: Helium314 Date: Fri, 17 May 2024 19:30:52 +0200 Subject: [PATCH] add a failing test for stuff that should be fixed --- .../keyboard/latin/InputLogicTest.kt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/app/src/test/java/helium314/keyboard/latin/InputLogicTest.kt b/app/src/test/java/helium314/keyboard/latin/InputLogicTest.kt index b30d5a1ae..b7189946c 100644 --- a/app/src/test/java/helium314/keyboard/latin/InputLogicTest.kt +++ b/app/src/test/java/helium314/keyboard/latin/InputLogicTest.kt @@ -545,6 +545,26 @@ class InputLogicTest { assertEquals("hello ", text) } + @Test fun `autospace in json editor`() { + reset() + chainInput("{\"label\":\"") + assertEquals("{\"label\": \"", text) + input('c') + assertEquals("{\"label\": \"c", text) + } + + // todo: the test fails because assert wants it as it's in app + // but actually the "failing text" is the wanted behavior -> how to get it in app? + @Test fun `autospace in json editor 2`() { + reset() + setInputType(InputType.TYPE_CLASS_TEXT and InputType.TYPE_TEXT_FLAG_MULTI_LINE) + setText("[\n[\n{ \"label\": \"a\" },\n") + chainInput("{\"label\":\"") + assertEquals("[\n[\n{ \"label\": \"a\" },\n{\"label\":\"", text) + input('c') + assertEquals("[\n[\n{ \"label\": \"a\" },\n{\"label\":\" c", text) + } + // ------- helper functions --------- // should be called before every test, so the same state is guaranteed