-
-
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/edittext_set_html_same test
This test verifies the behavior of htmlText when setting to the same value.
- Loading branch information
Showing
4 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
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,48 @@ | ||
package { | ||
import flash.display.*; | ||
import flash.text.*; | ||
import flash.events.*; | ||
import flash.geom.*; | ||
|
||
public class Test extends MovieClip { | ||
public function Test() { | ||
var tf = new TextField(); | ||
tf.multiline = true; | ||
tf.defaultTextFormat = new TextFormat("Unknown Font"); | ||
tf.htmlText = "<p align=\"center\">x</p>"; | ||
|
||
trace("Before newline removal:"); | ||
trace(" " + tf.text.length); | ||
|
||
tf.replaceText(1, 2, ""); | ||
|
||
trace("After newline removal:"); | ||
trace(" " + tf.text.length); | ||
trace(" " + tf.htmlText); | ||
|
||
tf.htmlText = "<P ALIGN=\"CENTER\"><FONT FACE=\"Unknown Font\" SIZE=\"12\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\">x</FONT></P>"; | ||
|
||
trace("After setting to the same value:"); | ||
trace(" " + tf.text.length); | ||
trace(" " + tf.htmlText); | ||
|
||
tf.htmlText = "<P ALIGN=\"CENTER\"><FONT FACE=\"Unknown Font\" SIZE=\"12\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\">x</FONT></P>"; | ||
|
||
trace("After setting to a slightly different value:"); | ||
trace(" " + tf.text.length); | ||
trace(" " + tf.htmlText); | ||
|
||
tf.htmlText = "<font face='Unknown Font 2'><b>x</b></font>"; | ||
|
||
trace("After setting to HTML x:"); | ||
trace(" " + tf.text.length); | ||
trace(" " + tf.htmlText); | ||
|
||
tf.text = "x"; | ||
|
||
trace("After setting text to x:"); | ||
trace(" " + tf.text.length); | ||
trace(" " + tf.htmlText); | ||
} | ||
} | ||
} |
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,17 @@ | ||
Before newline removal: | ||
2 | ||
After newline removal: | ||
1 | ||
<P ALIGN="CENTER"><FONT FACE="Unknown Font" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0">x</FONT></P> | ||
After setting to the same value: | ||
1 | ||
<P ALIGN="CENTER"><FONT FACE="Unknown Font" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0">x</FONT></P> | ||
After setting to a slightly different value: | ||
2 | ||
<P ALIGN="CENTER"><FONT FACE="Unknown Font" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0">x</FONT></P> | ||
After setting to HTML x: | ||
1 | ||
<P ALIGN="LEFT"><FONT FACE="Unknown Font 2" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0"><B>x</B></FONT></P> | ||
After setting text to x: | ||
1 | ||
<P ALIGN="LEFT"><FONT FACE="Unknown Font 2" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0"><B>x</B></FONT></P> |
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 |