Skip to content

Commit

Permalink
tests: Add focus_highlight_avm2_button_bounds test
Browse files Browse the repository at this point in the history
  • Loading branch information
kjarosh committed Jun 29, 2024
1 parent a06a822 commit 3ac5b5a
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package {

import flash.display.MovieClip;
import flash.display.Shape;
import flash.display.SimpleButton;
import flash.events.FocusEvent;

[SWF(width="50", height="50", backgroundColor="#000000")]
public class Test extends MovieClip {
private var button: SimpleButton;

public function Test() {
var buttonState = new Shape();
buttonState.graphics.beginFill(0xFF00FF);
buttonState.graphics.drawRect(-10, -10, 20, 20);
buttonState.graphics.endFill();
var hitState = new Shape();
hitState.graphics.beginFill(0xFF0000);
hitState.graphics.drawRect(-5, -5, 10, 10);
hitState.graphics.endFill();

button = new SimpleButton();
button.hitTestState = hitState;
button.upState = buttonState;
button.downState = buttonState;
button.overState = buttonState;
button.x = 25;
button.y = 25;
button.tabIndex = 1;

stage.addChild(button);

stage.addEventListener("focusIn", function (evt: FocusEvent): void {
trace("Focus changed: " + evt.relatedObject + " -> " + evt.target);
});
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[
{ "type": "KeyDown", "key_code": 9 },
{ "type": "Wait" }
]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Focus changed: null -> [object SimpleButton]
Binary file not shown.
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 3ac5b5a

Please sign in to comment.