tests: Add avm1/tab_ordering_custom_m1

This test verifies the behavior of tabIndex = -1.
This commit is contained in:
Kamil Jarosz 2024-04-30 13:43:34 +02:00 committed by Nathan Adams
parent 8f288b5e97
commit e89869660f
5 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,10 @@
[
{ "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": 9 },
{ "type": "KeyDown", "key_code": 9 },
{ "type": "KeyDown", "key_code": 9 }
]

View File

@ -0,0 +1,29 @@
Tab pressed
Focus changed
old: null
new: _level0.text6
Tab pressed
Focus changed
old: _level0.text6
new: _level0.text5
Tab pressed
Focus changed
old: _level0.text5
new: _level0.text2
Tab pressed
Focus changed
old: _level0.text2
new: _level0.text1
Tab pressed
Focus changed
old: _level0.text1
new: _level0.text4
Tab pressed
Focus changed
old: _level0.text4
new: _level0.text6
Tab pressed
Focus changed
old: _level0.text6
new: _level0.text5
Tab pressed

View File

@ -0,0 +1,32 @@
var stopTrace = false;
var tracedCount = 0;
var listener = new Object();
listener.onSetFocus = function(oldFocus, newFocus) {
if (newFocus && !stopTrace) {
trace("Focus changed");
trace(" old: " + oldFocus);
trace(" new: " + newFocus);
}
};
Selection.addListener(listener);
var listener = new Object();
listener.onKeyDown = function() {
if (Key.getCode() == 9 && !stopTrace) {
++tracedCount;
if (tracedCount == 9) {
stopTrace = true;
} else {
trace("Tab pressed");
}
}
};
Key.addListener(listener);
text1.tabIndex = 1;
text2.tabIndex = 0;
text3.tabIndex = -1;
text4.tabIndex = 2;
text5.tabIndex = -2;
text6.tabIndex = -3;

Binary file not shown.

View File

@ -0,0 +1 @@
num_ticks = 1