From 6c0356a133968b68527112949587f1adbee65d7c 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 | 36 ++++++++++++++++++ .../avm2/edittext_set_html_same/output.txt | 11 ++++++ .../swfs/avm2/edittext_set_html_same/test.swf | Bin 0 -> 1209 bytes .../avm2/edittext_set_html_same/test.toml | 1 + 4 files changed, 48 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 0000000000000..3a0cbc5e3f1df --- /dev/null +++ b/tests/tests/swfs/avm2/edittext_set_html_same/Test.as @@ -0,0 +1,36 @@ +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); + } +} +} 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 0000000000000..400828a1bf825 --- /dev/null +++ b/tests/tests/swfs/avm2/edittext_set_html_same/output.txt @@ -0,0 +1,11 @@ +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

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..312b4cffc7108b83cc355e2facc05e0594105e5b GIT binary patch literal 1209 zcmV;q1V;NqS5qnb2LJ$g0lidBbJ|uEeNTJ{@lEW2Ly}ri+_-5037mEk0<;uN#%XGM zj5FQMgKroo$0UWs*CQ-qO0z*%C7Vmq*oHLgR|(ani2Ef zz2_Y6efQ|iQ1B%}$zKrKz^I+sKnQ)e_6j3Zvj=MRsNLabW8HA7u&Zy6D7C7hIGs*Q z)18uO55@9>2M3 zMXiagdy)f1Bsv)rgF0flR0g4eQdLcREYpT;S-PgkuADe4IwMngK9x^NQPpKjHvFMEF$P|x9`OR`(iEG>)cjA<8<jQkSS@jiNcrf z7x;=)x#!pGMr)#b^lyz~8G-3GP%=HawtrAOY<9a}9UQgMSqdz$^0d>h0yWfPUcY|* zEE<4R7~Wv|`5!xA6NG;K(fsQtSp6P7CJsfvt^W{0$jx}$G%C3uDd_DIB24h%Lw8-0 z9fqphF`3bhM)X0{n_-EVg6i#1 z%6gUI`Jj97VVxL5I*Qo@PEa8(G22u@?j43zJLH>B_8#rmh1Tx=@$Qk(sC5qZkNHls zwObe7u2$f?d(R+Nt_XbV;K{*JUAQfIkHA0KJqB*~u-V$%e^eJFf&XInXn(nOTW~eO zt%nWXufrh}COzb-$y4~M9eGT6=wL#s-$F(IZ%KuBN|Jd8hA^V~3x1%fDzRY}%kseJ z4i()W?%Z-=-yf+8-{($-sty-W}ljU1umFAI7Krw_rC0ph;9We z(+QM6zMp#ox|}bUcdmqRHXMp%nH&@0ve9fT8{fcroKNJF`BXlg&*ZN#8O#KNp)eca zqOo`)nM!A_uuOpF*WA>e2s4U X&nODK5Xf+A=hyLPaMu3