diff --git a/mk/tests-ui.mk b/mk/tests-ui.mk index 486fb3e1b..08d63bfb2 100644 --- a/mk/tests-ui.mk +++ b/mk/tests-ui.mk @@ -273,6 +273,10 @@ shared-progress-ui-test: $(TARGET) practice-images-ui-test: $(TARGET) @sh tests/practice_images_ui_test.sh $(abspath $(TARGET)) +.PHONY: apps-diary-editing-test +apps-diary-editing-test: $(TARGET) + sh tests/apps_diary_test.sh $(abspath $(TARGET)) --editing-only + .PHONY: apps-diary-test apps-diary-test: $(TARGET) sh tests/apps_diary_test.sh $(abspath $(TARGET)) diff --git a/tests/apps_diary_test.py b/tests/apps_diary_test.py index 4f6737de7..e2b36d40c 100644 --- a/tests/apps_diary_test.py +++ b/tests/apps_diary_test.py @@ -158,6 +158,30 @@ with tempfile.TemporaryDirectory(prefix="inbe-diary-ui-") as temporary: assert time.monotonic() < deadline, "Diary text was not saved" time.sleep(0.1) capture(window, "saved") + # Exercise real SDL backspace plus Kryon cursor/selection editing. + command("xdotool", "key", "--clearmodifiers", "BackSpace") + wait_for_text(entry, lambda text: text == "A saved Diary entr", "Backspace did not delete") + driver.type("y 水e\u0301😀") + driver.key("backspace") + wait_for_text(entry, lambda text: text == "A saved Diary entry 水e\u0301", "Emoji deletion split Unicode") + driver.key("backspace") + wait_for_text(entry, lambda text: text == "A saved Diary entry 水", "Combining character deletion split a grapheme") + driver.key("left", shift=True) + driver.key("delete") + wait_for_text(entry, lambda text: text == "A saved Diary entry ", "Selection deletion failed") + driver.key("backspace") + driver.key("home") + driver.key("right", shift=True) + driver.type("One") + wait_for_text(entry, lambda text: text == "One saved Diary entry", "Mid-text correction failed") + driver.key("a", control=True) + driver.key("backspace") + wait_for_text(entry, lambda text: text == "", "Deleting the complete selection failed") + driver.type("A saved Diary entry") + wait_for_text(entry, lambda text: text == "A saved Diary entry", "Typing after deletion failed") + if "--editing-only" in sys.argv: + print("Diary SDL backspace, selections, corrections and Unicode passed") + raise SystemExit(0) # Typing within a moment of another change joins its undo step. time.sleep(1.2) driver.wait_gone(contains="Achievement unlocked", timeout=20) diff --git a/tests/apps_diary_test.sh b/tests/apps_diary_test.sh index 53932ed61..a2afb5d57 100644 --- a/tests/apps_diary_test.sh +++ b/tests/apps_diary_test.sh @@ -5,4 +5,4 @@ binary=${1:-"$root/build/bin/linux/breeze-linux-x86_64"} exec env -u INBE_DIARY_IMPORT -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \ -u SESSION_MANAGER YUE_DESKTOP_RECOVERY=0 SDL_VIDEODRIVER=x11 LIBGL_ALWAYS_SOFTWARE=1 \ xvfb-run -a -n 400 -s '-noreset -screen 0 1280x900x24' \ - python3 "$root/tests/apps_diary_test.py" "$binary" + python3 "$root/tests/apps_diary_test.py" "$binary" "${2:-}"