Skip to content

Commit

Permalink
tests: Add flags/tab_skip test
Browse files Browse the repository at this point in the history
This test verifies the behavior of tab_skip flag.
  • Loading branch information
kjarosh committed Dec 14, 2024
1 parent 69188c1 commit 7b6a4ce
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/tests/swfs/flags/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Compatibility flags tests

Warning: Outputs for these tests does not come from Flash Player!
They are meant to test the behavior of Ruffle with flags incompatible with Flash Player.
51 changes: 51 additions & 0 deletions tests/tests/swfs/flags/tab_skip/Test.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;

public class Test extends MovieClip {
private var obj1: TextField;
private var obj2: TextField;
private var obj3: TextField;

public function Test() {
stage.scaleMode = "noScale";

obj1 = new TextField();
obj1.type = "input";
obj1.border = true;
obj1.name = "obj1";
obj1.x = 70;
obj1.y = 10;
obj1.width = 10;
obj1.height = 10;

obj2 = new TextField();
obj2.type = "input";
obj2.border = true;
obj2.name = "obj2";
obj2.x = 10;
obj2.y = 20;
obj2.width = 10;
obj2.height = 10;

obj3 = new TextField();
obj3.type = "input";
obj3.border = true;
obj3.name = "obj3";
obj3.x = 40;
obj3.y = 40;
obj3.width = 10;
obj3.height = 10;

stage.focus = obj1;

for each (var obj in [obj1, obj2, obj3]) {
obj.addEventListener("focusIn", function (evt:FocusEvent):void {
trace("Focus changed: " + evt.relatedObject.name + " -> " + evt.target.name);
});
this.stage.addChild(obj);
}
}
}
}
6 changes: 6 additions & 0 deletions tests/tests/swfs/flags/tab_skip/input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{ "type": "KeyDown", "key_code": 9 },
{ "type": "KeyDown", "key_code": 9 },
{ "type": "KeyDown", "key_code": 9 },
{ "type": "KeyDown", "key_code": 9 }
]
4 changes: 4 additions & 0 deletions tests/tests/swfs/flags/tab_skip/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Focus changed: obj1 -> obj2
Focus changed: obj2 -> obj3
Focus changed: obj3 -> obj1
Focus changed: obj1 -> obj2
Binary file added tests/tests/swfs/flags/tab_skip/test.swf
Binary file not shown.
3 changes: 3 additions & 0 deletions tests/tests/swfs/flags/tab_skip/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
num_ticks = 1

flags = "-tab_skip"

0 comments on commit 7b6a4ce

Please sign in to comment.