diff --git a/tests/tests/swfs/avm1/tab_ordering_custom_m1/input.json b/tests/tests/swfs/avm1/tab_ordering_custom_m1/input.json new file mode 100644 index 000000000000..363853866338 --- /dev/null +++ b/tests/tests/swfs/avm1/tab_ordering_custom_m1/input.json @@ -0,0 +1,10 @@ +[ + { "type": "KeyDown", "key_code": 9 }, + { "type": "KeyDown", "key_code": 9 }, + { "type": "KeyDown", "key_code": 9 }, + { "type": "KeyDown", "key_code": 9 }, + { "type": "KeyDown", "key_code": 9 }, + { "type": "KeyDown", "key_code": 9 }, + { "type": "KeyDown", "key_code": 9 }, + { "type": "KeyDown", "key_code": 9 } +] diff --git a/tests/tests/swfs/avm1/tab_ordering_custom_m1/output.txt b/tests/tests/swfs/avm1/tab_ordering_custom_m1/output.txt new file mode 100644 index 000000000000..df464021f353 --- /dev/null +++ b/tests/tests/swfs/avm1/tab_ordering_custom_m1/output.txt @@ -0,0 +1,29 @@ +Tab pressed +Focus changed + old: null + new: _level0.text6 +Tab pressed +Focus changed + old: _level0.text6 + new: _level0.text5 +Tab pressed +Focus changed + old: _level0.text5 + new: _level0.text2 +Tab pressed +Focus changed + old: _level0.text2 + new: _level0.text1 +Tab pressed +Focus changed + old: _level0.text1 + new: _level0.text4 +Tab pressed +Focus changed + old: _level0.text4 + new: _level0.text6 +Tab pressed +Focus changed + old: _level0.text6 + new: _level0.text5 +Tab pressed diff --git a/tests/tests/swfs/avm1/tab_ordering_custom_m1/test.as b/tests/tests/swfs/avm1/tab_ordering_custom_m1/test.as new file mode 100644 index 000000000000..7ecf9862c7d8 --- /dev/null +++ b/tests/tests/swfs/avm1/tab_ordering_custom_m1/test.as @@ -0,0 +1,32 @@ +var stopTrace = false; +var tracedCount = 0; + +var listener = new Object(); +listener.onSetFocus = function(oldFocus, newFocus) { + if (newFocus && !stopTrace) { + trace("Focus changed"); + trace(" old: " + oldFocus); + trace(" new: " + newFocus); + } +}; +Selection.addListener(listener); + +var listener = new Object(); +listener.onKeyDown = function() { + if (Key.getCode() == 9 && !stopTrace) { + ++tracedCount; + if (tracedCount == 9) { + stopTrace = true; + } else { + trace("Tab pressed"); + } + } +}; +Key.addListener(listener); + +text1.tabIndex = 1; +text2.tabIndex = 0; +text3.tabIndex = -1; +text4.tabIndex = 2; +text5.tabIndex = -2; +text6.tabIndex = -3; diff --git a/tests/tests/swfs/avm1/tab_ordering_custom_m1/test.swf b/tests/tests/swfs/avm1/tab_ordering_custom_m1/test.swf new file mode 100644 index 000000000000..40d4c785af72 Binary files /dev/null and b/tests/tests/swfs/avm1/tab_ordering_custom_m1/test.swf differ diff --git a/tests/tests/swfs/avm1/tab_ordering_custom_m1/test.toml b/tests/tests/swfs/avm1/tab_ordering_custom_m1/test.toml new file mode 100644 index 000000000000..cf6123969a1d --- /dev/null +++ b/tests/tests/swfs/avm1/tab_ordering_custom_m1/test.toml @@ -0,0 +1 @@ +num_ticks = 1