From 492ba87e7a4a55ad74a876964452e9f866a46743 Mon Sep 17 00:00:00 2001 From: Kamil Jarosz Date: Thu, 19 Dec 2024 00:46:16 +0100 Subject: [PATCH] tests: Add avm2/edittext_empty_text_format test This test verifies the text format of empty text. It is observable in empty input text fields, because they have to show the caret. --- .../avm2/edittext_empty_text_format/Test.as | 30 ++++++++++++++++++ .../edittext_empty_text_format/TestFont.ttf | Bin 0 -> 1600 bytes .../edittext_empty_text_format/output.txt | 7 ++++ .../avm2/edittext_empty_text_format/test.swf | Bin 0 -> 1809 bytes .../avm2/edittext_empty_text_format/test.toml | 1 + 5 files changed, 38 insertions(+) create mode 100644 tests/tests/swfs/avm2/edittext_empty_text_format/Test.as create mode 100644 tests/tests/swfs/avm2/edittext_empty_text_format/TestFont.ttf create mode 100644 tests/tests/swfs/avm2/edittext_empty_text_format/output.txt create mode 100644 tests/tests/swfs/avm2/edittext_empty_text_format/test.swf create mode 100644 tests/tests/swfs/avm2/edittext_empty_text_format/test.toml diff --git a/tests/tests/swfs/avm2/edittext_empty_text_format/Test.as b/tests/tests/swfs/avm2/edittext_empty_text_format/Test.as new file mode 100644 index 000000000000..d058c22780f6 --- /dev/null +++ b/tests/tests/swfs/avm2/edittext_empty_text_format/Test.as @@ -0,0 +1,30 @@ +package { +import flash.display.*; +import flash.text.*; +import flash.events.*; +import flash.geom.*; + +public class Test extends MovieClip { + [Embed(source="TestFont.ttf", fontName="TestFont", embedAsCFF="false", unicodeRange="U+0061-U+0064")] + private var TestFont:Class; + + public function Test() { + stage.scaleMode = "noScale"; + + var field = new TextField(); + var tf = new TextFormat("TestFont", 10); + tf.leading = 5; + field.defaultTextFormat = tf; + field.type = "input"; + field.embedFonts = true; + + trace(field.textHeight); + trace(field.getLineMetrics(0).ascent); + trace(field.getLineMetrics(0).descent); + trace(field.getLineMetrics(0).height); + trace(field.getLineMetrics(0).leading); + trace(field.getLineMetrics(0).width); + trace(field.getLineMetrics(0).x); + } +} +} diff --git a/tests/tests/swfs/avm2/edittext_empty_text_format/TestFont.ttf b/tests/tests/swfs/avm2/edittext_empty_text_format/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_empty_text_format/output.txt b/tests/tests/swfs/avm2/edittext_empty_text_format/output.txt new file mode 100644 index 000000000000..dc2d57c442fd --- /dev/null +++ b/tests/tests/swfs/avm2/edittext_empty_text_format/output.txt @@ -0,0 +1,7 @@ +15 +8 +2 +15 +5 +0 +2 diff --git a/tests/tests/swfs/avm2/edittext_empty_text_format/test.swf b/tests/tests/swfs/avm2/edittext_empty_text_format/test.swf new file mode 100644 index 0000000000000000000000000000000000000000..de51368e7d5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S!?RY|H$``ll^{^{_NPWE(;> zb64}YYm)OfHrkl8;ok^U|Ln0?IU1W&a|>JVp@z9qFm^J z=m<~w@`Y}QhGa`4ECpN84R~=v;^}yv`35$cZM06mF>a1ArphNjQg6)ohVDRP{1;~Q z|3~kNSurLffnW*ZXSWoTA6zL&h_L|{2vpOMPS#fhn4GHwFlREl4TB#5G$Eab2pNc8 literal 0 HcmV?d00001 diff --git a/tests/tests/swfs/avm2/edittext_empty_text_format/test.toml b/tests/tests/swfs/avm2/edittext_empty_text_format/test.toml new file mode 100644 index 000000000000..cf6123969a1d --- /dev/null +++ b/tests/tests/swfs/avm2/edittext_empty_text_format/test.toml @@ -0,0 +1 @@ +num_ticks = 1