From 71405d47b694ad13943636559a0778bd218268b2 Mon Sep 17 00:00:00 2001 From: Kamil Jarosz Date: Wed, 18 Dec 2024 22:02:35 +0100 Subject: [PATCH] tests: Add avm2/edittext_set_html_same test This test verifies the behavior of htmlText when setting to the same value. --- .../swfs/avm2/edittext_set_html_same/Test.as | 48 ++++++++++++++++++ .../avm2/edittext_set_html_same/output.txt | 17 +++++++ .../swfs/avm2/edittext_set_html_same/test.swf | Bin 0 -> 1284 bytes .../avm2/edittext_set_html_same/test.toml | 1 + 4 files changed, 66 insertions(+) create mode 100644 tests/tests/swfs/avm2/edittext_set_html_same/Test.as create mode 100644 tests/tests/swfs/avm2/edittext_set_html_same/output.txt create mode 100644 tests/tests/swfs/avm2/edittext_set_html_same/test.swf create mode 100644 tests/tests/swfs/avm2/edittext_set_html_same/test.toml diff --git a/tests/tests/swfs/avm2/edittext_set_html_same/Test.as b/tests/tests/swfs/avm2/edittext_set_html_same/Test.as new file mode 100644 index 000000000000..29c38209a4fb --- /dev/null +++ b/tests/tests/swfs/avm2/edittext_set_html_same/Test.as @@ -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 = "

x

"; + + 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 = "

x

"; + + trace("After setting to the same value:"); + trace(" " + tf.text.length); + trace(" " + tf.htmlText); + + tf.htmlText = "

x

"; + + trace("After setting to a slightly different value:"); + trace(" " + tf.text.length); + trace(" " + tf.htmlText); + + tf.htmlText = "x"; + + 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); + } +} +} diff --git a/tests/tests/swfs/avm2/edittext_set_html_same/output.txt b/tests/tests/swfs/avm2/edittext_set_html_same/output.txt new file mode 100644 index 000000000000..6af451f8798b --- /dev/null +++ b/tests/tests/swfs/avm2/edittext_set_html_same/output.txt @@ -0,0 +1,17 @@ +Before newline removal: + 2 +After newline removal: + 1 +

x

+After setting to the same value: + 1 +

x

+After setting to a slightly different value: + 2 +

x

+After setting to HTML x: + 1 +

x

+After setting text to x: + 1 +

x

diff --git a/tests/tests/swfs/avm2/edittext_set_html_same/test.swf b/tests/tests/swfs/avm2/edittext_set_html_same/test.swf new file mode 100644 index 0000000000000000000000000000000000000000..42201c03f7e42e51a5520eafc501762c5fddd037 GIT binary patch literal 1284 zcmV+f1^fC#S5pbO2mk37mFn0<;uN>cp`< z#+i09!!Q?d1!{z(N*6;`o#`v|1-k08uh4F~=*}#XDc5@M7EVKSK% zCOZY)90eA~8I>UKcMb@w)T!MBC zQHY9bbpuI5%(qlL4(t*(+rP}Sw%DZ%5e4K#J9#+~S2;V*8241g8e;SPd)m58 zCdh;r>SL|%WaVnp=+40?~*Au7@aV>G}utaV?u9nA}qvjaqMt%)VRxSQik zV(GD)uWhXecImIQVqt;q)~INFeCzNie_U_3zdAZ;Qs*%kfu*Y%f9t7G4d&gucdvpT zaQWf(#$W%w17ku_KTpg*e}Jdof~VLb)GzDL!Ebw0FT{N2)T=su>9+u$ie%D}qrA49Q5fF&}}HaOw*T9}?y@Jh7|Gn|P$3A+^l# zyw@(gU&Y#h3_~V{3QE`xOx9(PyB1+oj`{k*{?o&1rm=T;x_6SPRa!@fr+lm4*sEr) zW}D&L`>()OEM@q{(ZSJ4HM1!?SB5{>JB8TxalNsB__Uf4GyLg zVu==a=wOHoItLWZ(7`4RKH5XkG#B)oi%;R`@-o5DugpK5dEi`xd!PE7_EOxO>(I|= z>ia+D!P!H^%tNz|C%690LnH4zJj*4KZyxRVbGKT4dV3y&r}Ru_<-m{5Ix*X#x0oE$ z;yl~)HE@35nAcaZo9^1@2Bl`Xd!Tv?jJ$)VSMb|Q_}y9VKH&Gjm~n7^1;4+9Z_aX? zfIk4^mV-ZB!Lv*F_AK`RvGYe@eCXi06+FL$7od;~14aGpT!c!pnCgV(u-J*n5wR1M uqhco}$HY!tj*FdyoDe%9Ipq9&P2F{`VG!bcAj7R){F!_Xo%|Qz@R>LOzmC5E literal 0 HcmV?d00001 diff --git a/tests/tests/swfs/avm2/edittext_set_html_same/test.toml b/tests/tests/swfs/avm2/edittext_set_html_same/test.toml new file mode 100644 index 000000000000..cf6123969a1d --- /dev/null +++ b/tests/tests/swfs/avm2/edittext_set_html_same/test.toml @@ -0,0 +1 @@ +num_ticks = 1