tests: Add currently-failing tests for the `SimpleButton` constructor and order-of-events.
This commit is contained in:
parent
44e82ea480
commit
d7deaf5e00
|
@ -0,0 +1,10 @@
|
|||
package {
|
||||
import flash.display.MovieClip
|
||||
|
||||
public class DownButtonShape extends MovieClip {
|
||||
public function DownButtonShape() {
|
||||
trace("//Constructed DownButtonShape (", this.name, ")!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package {
|
||||
import flash.display.MovieClip
|
||||
|
||||
public class HitButtonShape extends MovieClip {
|
||||
public function HitButtonShape() {
|
||||
trace("//Constructed HitButtonShape (", this.name, ")!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package {
|
||||
import flash.display.MovieClip
|
||||
|
||||
public class OverButtonShape extends MovieClip {
|
||||
public function OverButtonShape() {
|
||||
trace("//Constructed OverButtonShape (", this.name, ")!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package {
|
||||
import flash.display.MovieClip
|
||||
|
||||
public class UpButtonShape extends MovieClip {
|
||||
public function UpButtonShape() {
|
||||
trace("//Constructed UpButtonShape (", this.name, ")!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
//var my_button = new SimpleButton();
|
||||
//this.addChild(my_button);
|
||||
//my_button
|
||||
[object SimpleButton]
|
||||
//my_button.upState
|
||||
null
|
||||
//my_button.overState
|
||||
null
|
||||
//my_button.downState
|
||||
null
|
||||
//my_button.hitTestState
|
||||
null
|
||||
//my_button.upState = new UpButtonShape();
|
||||
//Constructed UpButtonShape ( instance2 )!
|
||||
//Up Button Shape frame 1
|
||||
//my_button.overState = new OverButtonShape();
|
||||
//Constructed OverButtonShape ( instance4 )!
|
||||
//my_button.downState = new DownButtonShape();
|
||||
//Constructed DownButtonShape ( instance6 )!
|
||||
//my_button.hitTestState = new HitButtonShape();
|
||||
//Constructed HitButtonShape ( instance8 )!
|
||||
//my_button.upState
|
||||
[object UpButtonShape]
|
||||
// numChildren: 1
|
||||
[object Shape]
|
||||
//my_button.overState
|
||||
[object OverButtonShape]
|
||||
// numChildren: 1
|
||||
[object Shape]
|
||||
//my_button.downState
|
||||
[object DownButtonShape]
|
||||
// numChildren: 1
|
||||
[object Shape]
|
||||
//my_button.hitTestState
|
||||
[object HitButtonShape]
|
||||
// numChildren: 1
|
||||
[object Shape]
|
||||
//Down Button Shape frame 1
|
||||
//Hit Button Shape frame 1
|
||||
//Hit Button Shape Frame 2
|
||||
//Down Button Shape Frame 2
|
||||
//Over Button Shape Frame 2
|
||||
//Up Button Shape Frame 2
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,10 @@
|
|||
package {
|
||||
import flash.display.MovieClip
|
||||
|
||||
public class DownButtonShape extends EventWatcher {
|
||||
public function DownButtonShape() {
|
||||
trace("//Constructed DownButtonShape (", this.name, ")!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package {
|
||||
import flash.display.MovieClip
|
||||
|
||||
public class HitButtonShape extends EventWatcher {
|
||||
public function HitButtonShape() {
|
||||
trace("//Constructed HitButtonShape (", this.name, ")!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package {
|
||||
import flash.display.MovieClip
|
||||
|
||||
public class OverButtonShape extends EventWatcher {
|
||||
public function OverButtonShape() {
|
||||
trace("//Constructed OverButtonShape (", this.name, ")!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package {
|
||||
import flash.display.MovieClip
|
||||
|
||||
public class UpButtonShape extends EventWatcher {
|
||||
public function UpButtonShape() {
|
||||
trace("//Constructed UpButtonShape (", this.name, ")!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
//var my_button = new SimpleButton();
|
||||
//this.addChild(my_button);
|
||||
//my_button
|
||||
[object SimpleButton] , instance1
|
||||
//my_button.upState
|
||||
//my_button.overState
|
||||
//my_button.downState
|
||||
//my_button.hitTestState
|
||||
//my_button.upState = new UpButtonShape();
|
||||
//Constructed UpButtonShape ( instance2 )!
|
||||
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]
|
||||
//Up Button Shape frame 1
|
||||
instance2:[Event type="exitFrame" bubbles=false cancelable=false eventPhase=2]
|
||||
//my_button.overState = new OverButtonShape();
|
||||
//Constructed OverButtonShape ( instance4 )!
|
||||
//my_button.downState = new DownButtonShape();
|
||||
//Constructed DownButtonShape ( instance6 )!
|
||||
//my_button.hitTestState = new HitButtonShape();
|
||||
//Constructed HitButtonShape ( instance8 )!
|
||||
//my_button.upState
|
||||
[object UpButtonShape] , instance2
|
||||
// numChildren: 1
|
||||
[object Shape] , instance3
|
||||
//my_button.overState
|
||||
[object OverButtonShape] , instance4
|
||||
// numChildren: 1
|
||||
[object Shape] , instance5
|
||||
//my_button.downState
|
||||
[object DownButtonShape] , instance6
|
||||
// numChildren: 1
|
||||
[object Shape] , instance7
|
||||
//my_button.hitTestState
|
||||
[object HitButtonShape] , instance8
|
||||
// numChildren: 1
|
||||
[object Shape] , instance9
|
||||
//Down Button Shape frame 1
|
||||
//Hit 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]
|
||||
instance8:[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]
|
||||
instance8:[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]
|
||||
instance8:[Event type="frameConstructed" bubbles=false cancelable=false eventPhase=2]
|
||||
//Hit Button Shape Frame 2
|
||||
//Down Button Shape Frame 2
|
||||
//Over Button Shape Frame 2
|
||||
//Up Button Shape Frame 2
|
Binary file not shown.
Binary file not shown.
|
@ -575,6 +575,8 @@ swf_tests! {
|
|||
(as3_simplebutton_structure, "avm2/simplebutton_structure", 2),
|
||||
(as3_simplebutton_childevents, "avm2/simplebutton_childevents", 2),
|
||||
(as3_simplebutton_childevents_nested, "avm2/simplebutton_childevents_nested", 2),
|
||||
(as3_simplebutton_constr, "avm2/simplebutton_constr", 2),
|
||||
(as3_simplebutton_constr_childevents, "avm2/simplebutton_constr_childevents", 2),
|
||||
}
|
||||
|
||||
// TODO: These tests have some inaccuracies currently, so we use approx_eq to test that numeric values are close enough.
|
||||
|
|
Loading…
Reference in New Issue