diff --git a/tests/tests/swfs/avm1/focus_visibility_change/output.txt b/tests/tests/swfs/avm1/focus_visibility_change/output.txt new file mode 100644 index 0000000000000..c4f9f3a9a307f --- /dev/null +++ b/tests/tests/swfs/avm1/focus_visibility_change/output.txt @@ -0,0 +1,45 @@ +===== clip +Object: _level0.clip +Made visible +Focus changed + old: null + new: _level0.clip +Focus: _level0.clip +Focus changed + old: _level0.clip + new: null +Made invisible +Focus: null +Made visible +Focus: null +Made invisible +===== text +Object: _level0.text +Made visible +Focus changed + old: null + new: _level0.text +Focus: _level0.text +Focus changed + old: _level0.text + new: null +Made invisible +Focus: null +Made visible +Focus: null +Made invisible +===== button +Object: _level0.button +Made visible +Focus changed + old: null + new: _level0.button +Focus: _level0.button +Focus changed + old: _level0.button + new: null +Made invisible +Focus: null +Made visible +Focus: null +Made invisible diff --git a/tests/tests/swfs/avm1/focus_visibility_change/test.as b/tests/tests/swfs/avm1/focus_visibility_change/test.as new file mode 100644 index 0000000000000..ddb37079532ca --- /dev/null +++ b/tests/tests/swfs/avm1/focus_visibility_change/test.as @@ -0,0 +1,39 @@ +var listener = new Object(); +listener.onSetFocus = function(oldFocus, newFocus) { + trace("Focus changed"); + trace(" old: " + oldFocus); + trace(" new: " + newFocus); +}; +Selection.addListener(listener); + +function testObject(obj) { + trace("Object: " + obj); + obj._visible = true; + trace("Made visible"); + obj.focusEnabled = true; + Selection.setFocus(obj); + trace("Focus: " + Selection.getFocus()); + obj._visible = false; + trace("Made invisible"); + trace("Focus: " + Selection.getFocus()); + + obj._visible = true; + trace("Made visible"); + trace("Focus: " + Selection.getFocus()); + obj._visible = false; + trace("Made invisible"); +} + +var clip = _root.createEmptyMovieClip("clip", 10); +var text = _root.createTextField("text", 11, 0, 0, 150, 20); +text.type = "input"; +var button = _root.attachMovie("CustomButton", "button", 12); + +trace("===== clip"); +testObject(clip); + +trace("===== text"); +testObject(text); + +trace("===== button"); +testObject(button); diff --git a/tests/tests/swfs/avm1/focus_visibility_change/test.swf b/tests/tests/swfs/avm1/focus_visibility_change/test.swf new file mode 100644 index 0000000000000..5bbcdf0bbdd5e Binary files /dev/null and b/tests/tests/swfs/avm1/focus_visibility_change/test.swf differ diff --git a/tests/tests/swfs/avm1/focus_visibility_change/test.toml b/tests/tests/swfs/avm1/focus_visibility_change/test.toml new file mode 100644 index 0000000000000..cf6123969a1d6 --- /dev/null +++ b/tests/tests/swfs/avm1/focus_visibility_change/test.toml @@ -0,0 +1 @@ +num_ticks = 1