Skip to content

Commit

Permalink
tests: Add avm2/edittext_set_text_vs_html test
Browse files Browse the repository at this point in the history
This test verifies the behavior of htmlText vs text setters and
how they set the HTML bit.
  • Loading branch information
kjarosh committed Dec 19, 2024
1 parent 9005b60 commit 4f97e88
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/tests/swfs/avm2/edittext_set_text_vs_html/Test.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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.defaultTextFormat = new TextFormat("Default Font");
tf.defaultTextFormat = new TextFormat("Default Font");

tf.htmlText = "<font face='NonDefault Font'><b>bold</b></font>";

trace("After setting HTML:");
trace(" " + tf.text);
trace(" " + tf.htmlText);

tf.text = "text";

trace("After setting text:");
trace(" " + tf.text);
trace(" " + tf.htmlText);

tf.text = "<b>text</b>";

trace("After setting text with HTML entities:");
trace(" " + tf.text);
trace(" " + tf.htmlText);
}
}
}
9 changes: 9 additions & 0 deletions tests/tests/swfs/avm2/edittext_set_text_vs_html/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
After setting HTML:
bold
<P ALIGN="LEFT"><FONT FACE="NonDefault Font" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0"><B>bold</B></FONT></P>
After setting text:
text
<P ALIGN="LEFT"><FONT FACE="Default Font" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0">text</FONT></P>
After setting text with HTML entities:
<b>text</b>
<P ALIGN="LEFT"><FONT FACE="Default Font" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0">&lt;b&gt;text&lt;/b&gt;</FONT></P>
Binary file not shown.
1 change: 1 addition & 0 deletions tests/tests/swfs/avm2/edittext_set_text_vs_html/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
num_ticks = 1

0 comments on commit 4f97e88

Please sign in to comment.