Skip to content

Commit

Permalink
tests: Add avm2/focus_stage test
Browse files Browse the repository at this point in the history
This test verifies the behavior of focus and focus highlight
for the stage object.
  • Loading branch information
kjarosh authored and Lord-McSweeney committed May 5, 2024
1 parent 42c26f6 commit 8a9d4f5
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/tests/swfs/avm2/focus_stage/Test.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package {

import flash.display.Sprite;
import flash.text.TextField;
import flash.display.Sprite;
import flash.display.Shape;
import flash.display.MovieClip;
import flash.events.FocusEvent;

[SWF(width="50", height="50", backgroundColor="#000000")]
public class Test extends MovieClip {
public function Test() {
super();

var shape = new Shape();
shape.graphics.beginFill(0xFFFF0000);
shape.graphics.drawRect(10, 10, 30, 30);
shape.graphics.endFill();
this.stage.addChild(shape);
this.stage.addEventListener("focusIn", function (evt:FocusEvent):void {
trace("Focus changed to stage");
});
this.stage.focus = this.stage;
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tests/tests/swfs/avm2/focus_stage/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Focus changed to stage
Binary file added tests/tests/swfs/avm2/focus_stage/test.swf
Binary file not shown.
6 changes: 6 additions & 0 deletions tests/tests/swfs/avm2/focus_stage/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
num_ticks = 1

image_comparisons."output".trigger = 1

[player_options]
with_renderer = { optional = false, sample_count = 1 }

0 comments on commit 8a9d4f5

Please sign in to comment.