From 99561d98c5064be69f29b95cd47ec92d5a5de757 Mon Sep 17 00:00:00 2001 From: Kamil Jarosz Date: Sat, 19 Oct 2024 10:10:11 +0200 Subject: [PATCH] tests: Add avm1/edittext_place_caret test This test verifies how the text field and its selection behave when placing a caret with the mouse. --- .../swfs/avm1/edittext_place_caret/input.json | 11 +++++++++++ .../swfs/avm1/edittext_place_caret/output.txt | 2 ++ .../tests/swfs/avm1/edittext_place_caret/test.as | 7 +++++++ .../tests/swfs/avm1/edittext_place_caret/test.swf | Bin 0 -> 199 bytes .../swfs/avm1/edittext_place_caret/test.toml | 1 + 5 files changed, 21 insertions(+) create mode 100644 tests/tests/swfs/avm1/edittext_place_caret/input.json create mode 100644 tests/tests/swfs/avm1/edittext_place_caret/output.txt create mode 100644 tests/tests/swfs/avm1/edittext_place_caret/test.as create mode 100644 tests/tests/swfs/avm1/edittext_place_caret/test.swf create mode 100644 tests/tests/swfs/avm1/edittext_place_caret/test.toml diff --git a/tests/tests/swfs/avm1/edittext_place_caret/input.json b/tests/tests/swfs/avm1/edittext_place_caret/input.json new file mode 100644 index 000000000000..c4340a28ab37 --- /dev/null +++ b/tests/tests/swfs/avm1/edittext_place_caret/input.json @@ -0,0 +1,11 @@ +[ + { "type": "KeyDown", "key_code": 27 }, + { "type": "MouseMove", "pos": [400, 10] }, + { "type": "MouseDown", "pos": [400, 10], "btn": "Left" }, + { "type": "MouseUp", "pos": [400, 10], "btn": "Left" }, + { "type": "TextInput", "codepoint": "a" }, + { "type": "TextInput", "codepoint": "s" }, + { "type": "TextInput", "codepoint": "d" }, + { "type": "TextInput", "codepoint": "f" }, + { "type": "KeyDown", "key_code": 27 } +] diff --git a/tests/tests/swfs/avm1/edittext_place_caret/output.txt b/tests/tests/swfs/avm1/edittext_place_caret/output.txt new file mode 100644 index 000000000000..d9223e029589 --- /dev/null +++ b/tests/tests/swfs/avm1/edittext_place_caret/output.txt @@ -0,0 +1,2 @@ +Text: test +Text: testasdf diff --git a/tests/tests/swfs/avm1/edittext_place_caret/test.as b/tests/tests/swfs/avm1/edittext_place_caret/test.as new file mode 100644 index 000000000000..47cff71454ca --- /dev/null +++ b/tests/tests/swfs/avm1/edittext_place_caret/test.as @@ -0,0 +1,7 @@ +var listener = new Object(); +listener.onKeyDown = function() { + if (Key.getCode() == 27) { + trace("Text: " + text.text); + } +}; +Key.addListener(listener); diff --git a/tests/tests/swfs/avm1/edittext_place_caret/test.swf b/tests/tests/swfs/avm1/edittext_place_caret/test.swf new file mode 100644 index 0000000000000000000000000000000000000000..3fc42d47e30325f8a9133d0f093788a0e981995e GIT binary patch literal 199 zcmV;&0670cS5pTJ0RRAaoU349dBniLeu05Of|0>RkO2ssng0L(AI{0hPyv=>e!v81nPHQ!8Ea z%kvn3G(&o7iF1BRDnkfRmz4rUb7D%04@}cECZG}1SQ*$s)_^#S4mMyh84$@dn-wH( zhN6NQEX5K85|ajsc?!*CVh{#Pv4RLTusoZeyP7}LB%ne@6wT~G;tUQz5ddznGtZoZ BQ566H literal 0 HcmV?d00001 diff --git a/tests/tests/swfs/avm1/edittext_place_caret/test.toml b/tests/tests/swfs/avm1/edittext_place_caret/test.toml new file mode 100644 index 000000000000..cf6123969a1d --- /dev/null +++ b/tests/tests/swfs/avm1/edittext_place_caret/test.toml @@ -0,0 +1 @@ +num_ticks = 1