Skip to content

Commit d5f06ac

Browse files
committed
tests: Add avm2/edittext_set_html_same test
This test verifies the behavior of htmlText when setting to the same value.
1 parent d16c71e commit d5f06ac

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package {
2+
import flash.display.*;
3+
import flash.text.*;
4+
import flash.events.*;
5+
import flash.geom.*;
6+
7+
public class Test extends MovieClip {
8+
public function Test() {
9+
var tf = new TextField();
10+
tf.multiline = true;
11+
tf.defaultTextFormat = new TextFormat("Unknown Font");
12+
tf.htmlText = "<p align=\"center\">x</p>";
13+
14+
trace("Before newline removal:");
15+
trace(" " + tf.text.length);
16+
17+
tf.replaceText(1, 2, "");
18+
19+
trace("After newline removal:");
20+
trace(" " + tf.text.length);
21+
trace(" " + tf.htmlText);
22+
23+
tf.htmlText = "<P ALIGN=\"CENTER\"><FONT FACE=\"Unknown Font\" SIZE=\"12\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\">x</FONT></P>";
24+
25+
trace("After setting to the same value:");
26+
trace(" " + tf.text.length);
27+
trace(" " + tf.htmlText);
28+
29+
tf.htmlText = "<P ALIGN=\"CENTER\"><FONT FACE=\"Unknown Font\" SIZE=\"12\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\">x</FONT></P>";
30+
31+
trace("After setting to a slightly different value:");
32+
trace(" " + tf.text.length);
33+
trace(" " + tf.htmlText);
34+
35+
tf.htmlText = "<font face='Unknown Font 2'><b>x</b></font>";
36+
37+
trace("After setting to HTML x:");
38+
trace(" " + tf.text.length);
39+
trace(" " + tf.htmlText);
40+
41+
tf.text = "x";
42+
43+
trace("After setting text to x:");
44+
trace(" " + tf.text.length);
45+
trace(" " + tf.htmlText);
46+
}
47+
}
48+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Before newline removal:
2+
2
3+
After newline removal:
4+
1
5+
<P ALIGN="CENTER"><FONT FACE="Unknown Font" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0">x</FONT></P>
6+
After setting to the same value:
7+
1
8+
<P ALIGN="CENTER"><FONT FACE="Unknown Font" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0">x</FONT></P>
9+
After setting to a slightly different value:
10+
2
11+
<P ALIGN="CENTER"><FONT FACE="Unknown Font" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0">x</FONT></P>
12+
After setting to HTML x:
13+
1
14+
<P ALIGN="LEFT"><FONT FACE="Unknown Font 2" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0"><B>x</B></FONT></P>
15+
After setting text to x:
16+
1
17+
<P ALIGN="LEFT"><FONT FACE="Unknown Font 2" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0"><B>x</B></FONT></P>
1.25 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
num_ticks = 1

0 commit comments

Comments
 (0)