Skip to content

Commit 69db0c3

Browse files
committed
tests: Add avm2/edittext_ime_focus_lost test
This test verifies how IME behaves when the focus is lost.
1 parent 9ccdecc commit 69db0c3

File tree

5 files changed

+57
-0
lines changed

5 files changed

+57
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package {
2+
import flash.display.*;
3+
import flash.text.*;
4+
import flash.events.*;
5+
import flash.utils.setTimeout;
6+
7+
[SWF(width="100", height="100", frameRate="1")]
8+
public class Test extends MovieClip {
9+
public function Test() {
10+
var tf = new TextField();
11+
tf.border = true;
12+
tf.type = "input";
13+
tf.width = 100;
14+
tf.height = 100;
15+
addChild(tf);
16+
stage.focus = tf;
17+
18+
setTimeout(function() {
19+
trace("Before: " + tf.text);
20+
trace(" " + tf.length);
21+
trace(" " + tf.selectionBeginIndex);
22+
trace(" " + tf.selectionEndIndex);
23+
24+
stage.focus = null;
25+
26+
trace("After: " + tf.text);
27+
trace(" " + tf.length);
28+
trace(" " + tf.selectionBeginIndex);
29+
trace(" " + tf.selectionEndIndex);
30+
}, 4500);
31+
32+
tf.addEventListener("textInput", function(evt:TextEvent):void {
33+
trace("input " + evt.text);
34+
});
35+
}
36+
}
37+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
{ "type": "ImePreedit", "text": "", "cursor": null },
3+
{ "type": "ImePreedit", "text": "q", "cursor": [1, 1] },
4+
{ "type": "Wait" },
5+
{ "type": "Wait" },
6+
{ "type": "Wait" },
7+
{ "type": "Wait" },
8+
{ "type": "Wait" },
9+
{ "type": "ImePreedit", "text": "", "cursor": null }
10+
]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Before: q
2+
1
3+
1
4+
1
5+
input q
6+
After: q
7+
1
8+
1
9+
1
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
num_ticks = 6

0 commit comments

Comments
 (0)