tests: Add a test for the order of events surrounding `gotoAndStop`

This commit is contained in:
David Wendt 2021-12-15 20:31:12 -05:00 committed by kmeisthax
parent d152cc3e64
commit 72f878bb9d
8 changed files with 176 additions and 0 deletions

View File

@ -376,6 +376,7 @@ swf_tests! {
(as3_movieclip_displayevents_dblhandler, "avm2/movieclip_displayevents_dblhandler", 4),
(as3_movieclip_displayevents_looping, "avm2/movieclip_displayevents_looping", 5),
(as3_movieclip_displayevents_timeline, "avm2/movieclip_displayevents_timeline", 5),
(as3_movieclip_displayevents_stopped, "avm2/movieclip_displayevents_stopped", 10),
(as3_movieclip_displayevents, "avm2/movieclip_displayevents", 9),
(as3_movieclip_drawrect, "avm2/movieclip_drawrect", 1),
(as3_movieclip_goto_during_frame_script, "avm2/movieclip_goto_during_frame_script", 1),

View File

@ -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 + "(frame " + this.currentFrame + "):" + 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);
}
}
}

View File

@ -0,0 +1,9 @@
package {
public class SymbolA extends EventWatcher {
public function SymbolA() {
super();
this.name = "SymbolA";
}
}
}

View File

@ -0,0 +1,9 @@
package {
public class SymbolB extends EventWatcher {
public function SymbolB() {
super();
this.name = "SymbolB";
}
}
}

View File

@ -0,0 +1,7 @@
package {
public class SymbolC extends EventWatcher {
public function SymbolC() {
super();
}
}
}

View File

@ -0,0 +1,113 @@
//this.addChild(new SymbolA());
SymbolA(frame 1):[Event type="added" bubbles=true cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="addedToStage" bubbles=false cancelable=false eventPhase=2]
//this.getChildAt(0).stop();
SymbolA(frame 1):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
//this.addChild(new SymbolB());
SymbolB(frame 1):[Event type="added" bubbles=true cancelable=false eventPhase=2]
SymbolB(frame 1):[Event type="addedToStage" bubbles=false cancelable=false eventPhase=2]
//this.getChildAt(1).gotoAndStop(3);
SymbolB(frame 3):[Event type="added" bubbles=true cancelable=false eventPhase=3]
symbol_c(frame 1):[Event type="added" bubbles=true cancelable=false eventPhase=2]
SymbolB(frame 3):[Event type="added" bubbles=true cancelable=false eventPhase=3]
symbol_c(frame 1):[Event type="addedToStage" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
SymbolB(frame 3):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
symbol_c(frame 1):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
SymbolB(frame 3):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
symbol_c(frame 1):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
SymbolB(frame 3):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
symbol_c(frame 1):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
SymbolB(frame 3):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
symbol_c(frame 2):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
SymbolB(frame 3):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
symbol_c(frame 2):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
SymbolB(frame 3):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
symbol_c(frame 2):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
SymbolB(frame 3):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
symbol_c(frame 3):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
SymbolB(frame 3):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
symbol_c(frame 3):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
SymbolB(frame 3):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
symbol_c(frame 3):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
SymbolB(frame 3):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
symbol_c(frame 4):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
SymbolB(frame 3):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
symbol_c(frame 4):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
SymbolB(frame 3):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
symbol_c(frame 4):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
SymbolB(frame 3):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
symbol_c(frame 5):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
SymbolB(frame 3):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
symbol_c(frame 5):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
SymbolB(frame 3):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
symbol_c(frame 5):[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
SymbolB(frame 3):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
symbol_c(frame 6):[Event type="enterFrame" bubbles=false cancelable=false eventPhase=2]
SymbolA(frame 1):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
SymbolB(frame 3):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
symbol_c(frame 6):[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
///name
root1
///currentFrame
10
///isPlaying
false
///children: 2
///name
SymbolA
///currentFrame
10
///isPlaying
false
///children: 1
///name
instance2
///end children
///name
SymbolB
///currentFrame
10
///isPlaying
false
///children: 2
///name
instance4
///name
symbol_c
///currentFrame
10
///isPlaying
false
///children: 1
///name
instance5
///end children
///end children
///end children