-
-
Notifications
You must be signed in to change notification settings - Fork 828
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Add avm2/tab_ordering_automatic_basic
This is an AVM2 version of avm1/tab_ordering_automatic_basic
- Loading branch information
Showing
5 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
79 changes: 79 additions & 0 deletions
79
tests/tests/swfs/avm2/tab_ordering_automatic_basic/Test.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package { | ||
|
||
import flash.display.DisplayObject; | ||
import flash.display.InteractiveObject; | ||
import flash.events.KeyboardEvent; | ||
import flash.text.TextField; | ||
import flash.display.Sprite; | ||
import flash.display.SimpleButton; | ||
import flash.display.MovieClip; | ||
import flash.events.Event; | ||
import flash.events.FocusEvent; | ||
|
||
public class Test extends MovieClip { | ||
var text1:TextField; | ||
var text2:TextField; | ||
var text3:TextField; | ||
var text4:TextField; | ||
var testStage:int = 0; | ||
|
||
public function Test() { | ||
super(); | ||
|
||
text1 = this.newTextField(1); | ||
text2 = this.newTextField(2); | ||
text3 = this.newTextField(3); | ||
text4 = this.newTextField(4); | ||
|
||
this.stage.focus = text1; | ||
|
||
var test:Test = this; | ||
for each (var obj in [text1, text2, text3, text4]) { | ||
obj.addEventListener("focusIn", function (evt:FocusEvent):void { | ||
trace("Focus changed: " + evt.relatedObject.name + " -> " + evt.target.name); | ||
}); | ||
this.stage.addChild(obj); | ||
} | ||
|
||
this.stage.addEventListener("keyDown", function(evt:KeyboardEvent) { | ||
if (evt.keyCode == 27) { | ||
test.testStage += 1; | ||
trace("Escape pressed, moving to stage " + test.testStage); | ||
test.setUpTestStage(); | ||
} else if (evt.keyCode == 9) { | ||
trace("Tab pressed"); | ||
} | ||
}); | ||
} | ||
|
||
function setUpTestStage() { | ||
if (this.testStage == 0) { | ||
// already set up | ||
} | ||
if (this.testStage == 1) { | ||
this.stage.focus = text4; | ||
} | ||
if (this.testStage == 2) { | ||
this.stage.focus = text1; | ||
text2.tabEnabled = false; | ||
} | ||
if (this.testStage == 3) { | ||
this.stage.focus = text1; | ||
text1.tabEnabled = false; | ||
text2.tabEnabled = true; | ||
} | ||
} | ||
|
||
function newTextField(i:int):TextField { | ||
var tf:TextField = new TextField(); | ||
tf.type = "input"; | ||
tf.name = "text" + i; | ||
tf.border = true; | ||
tf.x = 0; | ||
tf.y = i * 20; | ||
tf.height = 20; | ||
tf.width = 100; | ||
return tf; | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
tests/tests/swfs/avm2/tab_ordering_automatic_basic/input.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[ | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 27 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 27 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 27 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 9 } | ||
] |
45 changes: 45 additions & 0 deletions
45
tests/tests/swfs/avm2/tab_ordering_automatic_basic/output.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
Tab pressed | ||
Focus changed: text1 -> text2 | ||
Tab pressed | ||
Focus changed: text2 -> text3 | ||
Tab pressed | ||
Focus changed: text3 -> text4 | ||
Tab pressed | ||
Focus changed: text4 -> text1 | ||
Tab pressed | ||
Focus changed: text1 -> text2 | ||
Escape pressed, moving to stage 1 | ||
Focus changed: text2 -> text4 | ||
Tab pressed | ||
Focus changed: text4 -> text1 | ||
Tab pressed | ||
Focus changed: text1 -> text2 | ||
Tab pressed | ||
Focus changed: text2 -> text3 | ||
Tab pressed | ||
Focus changed: text3 -> text4 | ||
Tab pressed | ||
Focus changed: text4 -> text1 | ||
Escape pressed, moving to stage 2 | ||
Tab pressed | ||
Focus changed: text1 -> text3 | ||
Tab pressed | ||
Focus changed: text3 -> text4 | ||
Tab pressed | ||
Focus changed: text4 -> text1 | ||
Tab pressed | ||
Focus changed: text1 -> text3 | ||
Tab pressed | ||
Focus changed: text3 -> text4 | ||
Escape pressed, moving to stage 3 | ||
Focus changed: text4 -> text1 | ||
Tab pressed | ||
Focus changed: text1 -> text2 | ||
Tab pressed | ||
Focus changed: text2 -> text3 | ||
Tab pressed | ||
Focus changed: text3 -> text4 | ||
Tab pressed | ||
Focus changed: text4 -> text2 | ||
Tab pressed | ||
Focus changed: text2 -> text3 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
num_ticks = 1 |