diff --git a/core/tests/swfs/avm2/simplebutton_childevents/DownButtonShape.as b/core/tests/swfs/avm2/simplebutton_childevents/DownButtonShape.as new file mode 100644 index 000000000..2e6badf59 --- /dev/null +++ b/core/tests/swfs/avm2/simplebutton_childevents/DownButtonShape.as @@ -0,0 +1,10 @@ +package { + import flash.display.MovieClip + + public class DownButtonShape extends EventWatcher { + public function DownButtonShape() { + trace("//Constructed DownButtonShape (", this.name, ")!"); + } + } + +} diff --git a/core/tests/swfs/avm2/simplebutton_childevents/EventWatcher.as b/core/tests/swfs/avm2/simplebutton_childevents/EventWatcher.as new file mode 100644 index 000000000..41a7ad872 --- /dev/null +++ b/core/tests/swfs/avm2/simplebutton_childevents/EventWatcher.as @@ -0,0 +1,37 @@ +package { + import flash.display.MovieClip; + import flash.events.Event; + + public class EventWatcher extends MovieClip { + public function EventWatcher() { + super(); + this.setup(); + } + + function trace_event(event: Event) { + trace(this.name + ":" + event); + } + + public function setup() { + this.addEventListener(Event.ENTER_FRAME, this.trace_event); + this.addEventListener(Event.EXIT_FRAME, this.trace_event); + this.addEventListener(Event.ADDED, this.trace_event); + this.addEventListener(Event.ADDED_TO_STAGE, this.trace_event); + this.addEventListener(Event.FRAME_CONSTRUCTED, this.trace_event); + this.addEventListener(Event.REMOVED, this.trace_event); + this.addEventListener(Event.REMOVED_FROM_STAGE, this.trace_event); + this.addEventListener(Event.RENDER, this.trace_event); + } + + public function destroy() { + this.removeEventListener(Event.ENTER_FRAME, this.trace_event); + this.removeEventListener(Event.EXIT_FRAME, this.trace_event); + this.removeEventListener(Event.ADDED, this.trace_event); + this.removeEventListener(Event.ADDED_TO_STAGE, this.trace_event); + this.removeEventListener(Event.FRAME_CONSTRUCTED, this.trace_event); + this.removeEventListener(Event.REMOVED, this.trace_event); + this.removeEventListener(Event.REMOVED_FROM_STAGE, this.trace_event); + this.removeEventListener(Event.RENDER, this.trace_event); + } + } +} \ No newline at end of file diff --git a/core/tests/swfs/avm2/simplebutton_childevents/HitButtonShape.as b/core/tests/swfs/avm2/simplebutton_childevents/HitButtonShape.as new file mode 100644 index 000000000..23e69c8c6 --- /dev/null +++ b/core/tests/swfs/avm2/simplebutton_childevents/HitButtonShape.as @@ -0,0 +1,10 @@ +package { + import flash.display.MovieClip + + public class HitButtonShape extends EventWatcher { + public function HitButtonShape() { + trace("//Constructed HitButtonShape (", this.name, ")!"); + } + } + +} diff --git a/core/tests/swfs/avm2/simplebutton_childevents/OverButtonShape.as b/core/tests/swfs/avm2/simplebutton_childevents/OverButtonShape.as new file mode 100644 index 000000000..965575ad0 --- /dev/null +++ b/core/tests/swfs/avm2/simplebutton_childevents/OverButtonShape.as @@ -0,0 +1,10 @@ +package { + import flash.display.MovieClip + + public class OverButtonShape extends EventWatcher { + public function OverButtonShape() { + trace("//Constructed OverButtonShape (", this.name, ")!"); + } + } + +} diff --git a/core/tests/swfs/avm2/simplebutton_childevents/UpButtonShape.as b/core/tests/swfs/avm2/simplebutton_childevents/UpButtonShape.as new file mode 100644 index 000000000..66cf84e1d --- /dev/null +++ b/core/tests/swfs/avm2/simplebutton_childevents/UpButtonShape.as @@ -0,0 +1,10 @@ +package { + import flash.display.MovieClip + + public class UpButtonShape extends EventWatcher { + public function UpButtonShape() { + trace("//Constructed UpButtonShape (", this.name, ")!"); + } + } + +} diff --git a/core/tests/swfs/avm2/simplebutton_childevents/output.txt b/core/tests/swfs/avm2/simplebutton_childevents/output.txt new file mode 100644 index 000000000..be309c27a --- /dev/null +++ b/core/tests/swfs/avm2/simplebutton_childevents/output.txt @@ -0,0 +1,31 @@ +//Constructed UpButtonShape ( instance2 )! +//Constructed OverButtonShape ( instance4 )! +//Constructed DownButtonShape ( instance6 )! +instance2:[Event type="added" bubbles=true cancelable=false eventPhase=2] +instance2:[Event type="addedToStage" bubbles=false cancelable=false eventPhase=2] +instance2:[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2] +instance4:[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2] +instance6:[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2] +//Up Button Shape frame 1 +//Over Button Shape frame 1 +//Down Button Shape frame 1 +instance2:[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2] +instance4:[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2] +instance6:[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2] +instance2:[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2] +instance4:[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2] +instance6:[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2] +//MainTimeline frame 1 +instance2:[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2] +instance4:[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2] +instance6:[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2] +instance2:[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2] +instance4:[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2] +instance6:[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2] +instance2:[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2] +instance4:[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2] +instance6:[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2] +//MainTimeline frame 2 +//Up Button Shape Frame 2 +//Down Button Shape Frame 2 +//Over Button Shape Frame 2 diff --git a/core/tests/swfs/avm2/simplebutton_childevents/test.fla b/core/tests/swfs/avm2/simplebutton_childevents/test.fla new file mode 100644 index 000000000..2a3b8d21b Binary files /dev/null and b/core/tests/swfs/avm2/simplebutton_childevents/test.fla differ diff --git a/core/tests/swfs/avm2/simplebutton_childevents/test.swf b/core/tests/swfs/avm2/simplebutton_childevents/test.swf new file mode 100644 index 000000000..c1db96875 Binary files /dev/null and b/core/tests/swfs/avm2/simplebutton_childevents/test.swf differ diff --git a/tests/tests/regression_tests.rs b/tests/tests/regression_tests.rs index 5ff82420c..1cc971b1f 100644 --- a/tests/tests/regression_tests.rs +++ b/tests/tests/regression_tests.rs @@ -573,6 +573,7 @@ swf_tests! { (as3_stage_properties, "avm2/stage_properties", 1), (as3_closures, "avm2/closures", 1), (as3_simplebutton_structure, "avm2/simplebutton_structure", 2), + (as3_simplebutton_childevents, "avm2/simplebutton_childevents", 2), } // TODO: These tests have some inaccuracies currently, so we use approx_eq to test that numeric values are close enough.