From 22498f7d8bb9efa61ae5675ad58fe234eb8e2087 Mon Sep 17 00:00:00 2001 From: Kamil Jarosz Date: Tue, 5 Nov 2024 23:26:47 +0100 Subject: [PATCH] tests: Add edittext_autosize_align test This test verifies how text align is handled when autosize and/or word wrap is set. --- .../swfs/avm2/edittext_autosize_align/Test.as | 68 ++++++++++++++++++ .../avm2/edittext_autosize_align/TestFont.ttf | Bin 0 -> 1600 bytes .../output.expected.png | Bin 0 -> 2535 bytes .../avm2/edittext_autosize_align/output.txt | 0 .../avm2/edittext_autosize_align/test.swf | Bin 0 -> 2134 bytes .../avm2/edittext_autosize_align/test.toml | 7 ++ 6 files changed, 75 insertions(+) create mode 100644 tests/tests/swfs/avm2/edittext_autosize_align/Test.as create mode 100644 tests/tests/swfs/avm2/edittext_autosize_align/TestFont.ttf create mode 100644 tests/tests/swfs/avm2/edittext_autosize_align/output.expected.png create mode 100644 tests/tests/swfs/avm2/edittext_autosize_align/output.txt create mode 100644 tests/tests/swfs/avm2/edittext_autosize_align/test.swf create mode 100644 tests/tests/swfs/avm2/edittext_autosize_align/test.toml diff --git a/tests/tests/swfs/avm2/edittext_autosize_align/Test.as b/tests/tests/swfs/avm2/edittext_autosize_align/Test.as new file mode 100644 index 000000000000..30f369a68400 --- /dev/null +++ b/tests/tests/swfs/avm2/edittext_autosize_align/Test.as @@ -0,0 +1,68 @@ +package { +import flash.display.Sprite; +import flash.text.TextField; +import flash.text.TextFormat; + +[SWF(width="200", height="800")] +public class Test extends Sprite { + [Embed(source="TestFont.ttf", fontName="TestFont", embedAsCFF="false", unicodeRange="U+0061-U+0064")] + private var TestFont:Class; + + private var nextY: int = 0; + private var nextX: int = 0; + + public function Test() { + stage.scaleMode = "noScale"; + + newTextField("none", "left", false); + newTextField("none", "center", false); + newTextField("none", "right", false); + newTextField("left", "left", false); + newTextField("left", "center", false); + newTextField("left", "right", false); + newTextField("center", "left", false); + newTextField("center", "center", false); + newTextField("center", "right", false); + newTextField("right", "left", false); + newTextField("right", "center", false); + newTextField("right", "right", false); + + nextY = 0; + nextX = 100; + newTextField("none", "left", true); + newTextField("none", "center", true); + newTextField("none", "right", true); + newTextField("left", "left", true); + newTextField("left", "center", true); + newTextField("left", "right", true); + newTextField("center", "left", true); + newTextField("center", "center", true); + newTextField("center", "right", true); + newTextField("right", "left", true); + newTextField("right", "center", true); + newTextField("right", "right", true); + } + + private function newTextField(autosize: String, align: String, wordWrap: Boolean):void { + var text = new TextField(); + text.multiline = true; + text.wordWrap = wordWrap; + text.border = true; + text.x = nextX; + text.y = nextY; + nextY += 62; + text.width = 100; + text.height = 60; + text.embedFonts = true; + var tf = new TextFormat(); + tf.font = "TestFont"; + tf.size = 20; + tf.align = align; + tf.leading = 5; + text.defaultTextFormat = tf; + text.text = "ab\nabab"; + text.autoSize = autosize; + addChild(text); + } +} +} diff --git a/tests/tests/swfs/avm2/edittext_autosize_align/TestFont.ttf b/tests/tests/swfs/avm2/edittext_autosize_align/TestFont.ttf new file mode 100644 index 0000000000000000000000000000000000000000..761128c1eb3c323d499229f8c34f7523983545de GIT binary patch literal 1600 zcmcgsOK4L;6g~4kX-ma^u!vA)9v1tdO<$5?t7K8s#!nGNLlIHzYnmp3{CG*Fbs;WA zL|loe3lYJc*n%MFJ}zB|t1e1cF6>g=RN|SJX>Gd@x^W)EoO|xQGw03R83+LTaStY@ z6N%)-H_u=80-+wV-Dl5CB+!Kew40TE>FRKF>h#FD9KThYr+ zA+Zr(<`%9;V;xRMZ>-~}BU--KYR0qQbB=LMZ*x#}JS&DcrrcOnoxjUnRuxG^U&QGO ze5wF=Yu|1iki;pC1#56#V}lAGX>6hgs~THq76&!9(I&<<4w0Wx6=JDc9A|G}fp(-c zHn{FxjZK`x6OApj3tM9wM}*WkME){Pql7XR;Uk9(vZz9$k8}2OjKXCf;r*1DWStin zlPA7F>@%;TZt&?+dC|{hvQ^oa>X%VBIx;9Hy+ST8FL-{b!iXf&46P!;lp;qY)0JwX zR3y4WSBATi4`#%bbY?#9`Pd3oDLy08ftoP&NStKfJ!ON9A%Y={vTrJfS|(BQGiezO zyYi&mT$(Tz85$i@djF|#ifj9np9{oGDsZ`qQldUgrTt2-RFtk83A-+d-O9H8EKg0} v)cSiW)YZlDZ{sV(6E|4R6AJO}8@dAcs`9;8mr~6kbk}pNS$!mSzL$RhFdoS* literal 0 HcmV?d00001 diff --git a/tests/tests/swfs/avm2/edittext_autosize_align/output.expected.png b/tests/tests/swfs/avm2/edittext_autosize_align/output.expected.png new file mode 100644 index 0000000000000000000000000000000000000000..42dbd4fdc4d40061366a59be449150b6ccc72c79 GIT binary patch literal 2535 zcma)8dsI?)97jcA`GBl8A1HLR<4##>RwE}0vxclRE6=otn#_FETAG%m#v|4-vze>Y zW7U*RmYyBOQJQaq#7AjqRx=e8q4`A0nX={3-OB|8vz`5M5BL1I_w)OFzTeOH^SfCg z!DQ}vvnr@vX z$8R`LbUijt-8*XZ_0`~>+jHs|u()T<$$W%r4 zVa&ae|77f_-Xo%;XOrU_MzAF!ny56~fc3(+`B+y!hpM&4y!AVA9tFJ}MFco6cR+dT zbT32zC=nHi2b38^^|+gt^HVF+E5L?DBX9TeHm8(yMjkUzY^0i4T~|E3UXbo_H0QKE zoL=uHai{ttv3_MjvWI$SDh73r$}%oFlQ`c65k2>I2K*VVc1HCGcOc8$)I^1g=xTe0 z(J^JY9PJGAkDuhUYfGu`oFNPnPW2BA?(y$9;-58YL(7t-y{1fL` zeaAIj*Hxa|+j?%DS*_~N!H=(zZnsW%)$H5)w;(U&PGE_Dh303KG<^HvWxt6`7dRQv#j4@C_BDR-V_11z(Y3Ur zlW9@>-?2p#@s-gJ$yhZxx?y=G1!1Hg8UoD{G3PBaM~#?Rx)VDA-v;QdL?nfnOmodN zW|gYIHoTbNc$V1ECpl<${sQ}gj)t`4UU-G*R;w8^l(dNU)$#;rlwJ)yPYU^g-LIfz zTE_u$>>xQ8|BsxKg>nw5E(FV5xJu1zEm};CAu>dlBy-Mf8eg&MRX7_Tj;x<;4-LNH z;*B@YQ9ZuH+3a2n1_8PqL^42wdW=K2q)xLHv$OST*QDHhwp?Iq2{$D>VJgzBUpe0= z(Wki$=j>l9ofvLkombF*Mxt^W%Ql&S71TxyWHu13Wwc9D7k-r-Replts6sF}8!nZ>AC5UckhbYqP-f-nRUaDhhqj5C zYCRWO+*(kYR+DGlKR5*`D74<~=g{q&;&@9CWCdZF;BB z))M^hp@dsX_k2nEX~B#vpa8_h%`yh3mu@Tf(&h!C`Eq2#r?kfa?tw{ zyi@7IiL9!KULw{8&HPUKcQr+Ki`e0f1nU5h4x8rI=#BnO=We-hR|Vn>Xkr7;8v!wi zAPDJTcRVmboAu2rL9I@v9d8F_iZ$xpB8hUZP9nf%+xLsPY)!q5Fo?C;D?A2Q=F*~* z9x&{9nZ%wts`5hh5UmoS`-ITX?Y!u-YTU?Mp&by0IhpowFgB&mBC-eH%?Z56p%X9V z^&!rj?1YeWtvTQE>wE<1$-T2QFBpwf$UMH@UvSmY*@+5#z`-b6gSYTLJ8=46k)~+k literal 0 HcmV?d00001 diff --git a/tests/tests/swfs/avm2/edittext_autosize_align/output.txt b/tests/tests/swfs/avm2/edittext_autosize_align/output.txt new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/tests/swfs/avm2/edittext_autosize_align/test.swf b/tests/tests/swfs/avm2/edittext_autosize_align/test.swf new file mode 100644 index 0000000000000000000000000000000000000000..9337a6f99910c743714769f62805fa08e9b2768a GIT binary patch literal 2134 zcmV-c2&wl&S5qnA4gdgn0j*ZuZ`;Tb-{seevMtNDqS$hBmSZK(hb&SbactS~*|Foh zq-at^Ns|^)jipFhY$Q=2Xt7#+;aBZPi3_YaKFwrASaX9tJbUc1%tt1!F2 z+6;njRnyMS&I)Jcg6kb?#m&u4O)qJs(i%vt`ENS`?X7kEmDL@t;K1@5p3@B+x07WG zso|ak_g7a3TFu6}((Z}Z;wsICX0@!g)d_s9SSW%bvr)BOuT6s;+U>TS24(8B-kRTZ z8*k3&skLUesNdYyE(F=0zzJH`&R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