From 4f97e88c8b1f5218dd7320d82ffa9b2ad94791c1 Mon Sep 17 00:00:00 2001 From: Kamil Jarosz Date: Thu, 19 Dec 2024 00:31:26 +0100 Subject: [PATCH] tests: Add avm2/edittext_set_text_vs_html test This test verifies the behavior of htmlText vs text setters and how they set the HTML bit. --- .../avm2/edittext_set_text_vs_html/Test.as | 32 ++++++++++++++++++ .../avm2/edittext_set_text_vs_html/output.txt | 9 +++++ .../avm2/edittext_set_text_vs_html/test.swf | Bin 0 -> 1047 bytes .../avm2/edittext_set_text_vs_html/test.toml | 1 + 4 files changed, 42 insertions(+) create mode 100644 tests/tests/swfs/avm2/edittext_set_text_vs_html/Test.as create mode 100644 tests/tests/swfs/avm2/edittext_set_text_vs_html/output.txt create mode 100644 tests/tests/swfs/avm2/edittext_set_text_vs_html/test.swf create mode 100644 tests/tests/swfs/avm2/edittext_set_text_vs_html/test.toml diff --git a/tests/tests/swfs/avm2/edittext_set_text_vs_html/Test.as b/tests/tests/swfs/avm2/edittext_set_text_vs_html/Test.as new file mode 100644 index 000000000000..9fe8eb659e04 --- /dev/null +++ b/tests/tests/swfs/avm2/edittext_set_text_vs_html/Test.as @@ -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 = "bold"; + + 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 = "text"; + + trace("After setting text with HTML entities:"); + trace(" " + tf.text); + trace(" " + tf.htmlText); + } +} +} diff --git a/tests/tests/swfs/avm2/edittext_set_text_vs_html/output.txt b/tests/tests/swfs/avm2/edittext_set_text_vs_html/output.txt new file mode 100644 index 000000000000..22934a24ea1f --- /dev/null +++ b/tests/tests/swfs/avm2/edittext_set_text_vs_html/output.txt @@ -0,0 +1,9 @@ +After setting HTML: + bold +

bold

+After setting text: + text +

text

+After setting text with HTML entities: + text +

<b>text</b>

diff --git a/tests/tests/swfs/avm2/edittext_set_text_vs_html/test.swf b/tests/tests/swfs/avm2/edittext_set_text_vs_html/test.swf new file mode 100644 index 0000000000000000000000000000000000000000..61638a18a6da0d1c4236d9d6f1d30f414e5d566f GIT binary patch literal 1047 zcmV+y1nB!iS5qm$1^@tf0fkh}bK67|-<3aP`P)tEBu>(*G}IJqOLhv=xQ-zc6KIDv zOdSS>8INZzuWV6S(n#yrJu$<-z(2r=e}V%i4&0IhH%^>-tNRy(w^F_o4rpd~_PzIe zzkMJ3G)K{Y5X%0F&?-iq!YV@O$E7zIp_V(;n=d;D@_b@iUK6C<@|ZEFsVKAAtTx-O z+3rZG@9gX-YC~x>s(`3^uPsLARm;0yZuS?awFvGTFPDlp!lWYjq$RYE9jCCxo?$-$>_WwFvz_^P^tkIN=Xq#I7Z@NC`rOMBMFxu`=O|Cz#$PKme zD2SJ9TM94zwN{*Kpu269%}>`}99F;H>vq3AeAz)KId}r0uakchX`y}L?Ck9OWCToc zSke5eKeyqTAoO;9^Y5SG^hffDdJO%(+>Ii{ExwpXH4geH>Pr~~I{4%XKi7ySFkL#L zb9P`*bC~pdSYsdq5h(qRr#n<9Q?le|s`5Vs;gma4A>HmkOm@rKQrcP{2YY8jFhwDVa)VvblUACkio95G4sqMJz^Fq!R2{ z6z_^rSxnp$#rH(q;`=Z-0t~_(SOO9r;PM9#arr~c$^2=-0v0%SEhTlaNi4zspQ}h-`k+hI{_!&k&{k2G*_Jm5}nSe=Tk-B!yoK|j==pxsP zRaOsT_~9ZCr?pc({);aa0x23uOQ)3*i7#%0a@{uZ0pN8|Zu;Pj5O^~L zz5_W30_5}Qi3&-G6!j!sQhP}~srFKOO6{ffwA#z)8MT+yvuZD)C;aU@v>AM35&U96 RBQ0J2R6c_u{tM3127r#R0A2t9 literal 0 HcmV?d00001 diff --git a/tests/tests/swfs/avm2/edittext_set_text_vs_html/test.toml b/tests/tests/swfs/avm2/edittext_set_text_vs_html/test.toml new file mode 100644 index 000000000000..cf6123969a1d --- /dev/null +++ b/tests/tests/swfs/avm2/edittext_set_text_vs_html/test.toml @@ -0,0 +1 @@ +num_ticks = 1