From 7988f04c4dd2cd9979c73f09e64f5e38cf6be757 Mon Sep 17 00:00:00 2001 From: Kamil Jarosz Date: Mon, 14 Oct 2024 12:45:19 +0200 Subject: [PATCH] tests: Add edittext_gutter test This test verifies how the gutter of a text field behaves. --- .../visual/edittext/edittext_gutter/Test.as | 76 ++++++++++++++++ .../edittext/edittext_gutter/TestFont.sfd | 83 ++++++++++++++++++ .../edittext/edittext_gutter/TestFont.ttf | Bin 0 -> 1600 bytes .../edittext_gutter/output.expected.png | Bin 0 -> 522 bytes .../edittext/edittext_gutter/output.txt | 0 .../visual/edittext/edittext_gutter/test.swf | Bin 0 -> 1417 bytes .../visual/edittext/edittext_gutter/test.toml | 7 ++ 7 files changed, 166 insertions(+) create mode 100644 tests/tests/swfs/visual/edittext/edittext_gutter/Test.as create mode 100644 tests/tests/swfs/visual/edittext/edittext_gutter/TestFont.sfd create mode 100644 tests/tests/swfs/visual/edittext/edittext_gutter/TestFont.ttf create mode 100644 tests/tests/swfs/visual/edittext/edittext_gutter/output.expected.png create mode 100644 tests/tests/swfs/visual/edittext/edittext_gutter/output.txt create mode 100644 tests/tests/swfs/visual/edittext/edittext_gutter/test.swf create mode 100644 tests/tests/swfs/visual/edittext/edittext_gutter/test.toml diff --git a/tests/tests/swfs/visual/edittext/edittext_gutter/Test.as b/tests/tests/swfs/visual/edittext/edittext_gutter/Test.as new file mode 100644 index 0000000000000..066da6710e6cd --- /dev/null +++ b/tests/tests/swfs/visual/edittext/edittext_gutter/Test.as @@ -0,0 +1,76 @@ +package { +import flash.display.Sprite; +import flash.text.TextField; +import flash.text.TextFormat; + +[SWF(width="100", height="110")] +public class Test extends Sprite { + [Embed(source="TestFont.ttf", fontName="TestFont", embedAsCFF="false", unicodeRange="U+0061-U+0062")] + private var testFont:Class; + + private var nextX:int = 2; + private var nextY:int = 2; + + public function Test() { + stage.scaleMode = "noScale"; + + newTextField("a", 0, 0); + newTextField("a", 1, 0); + newTextField("a", 2, 0); + newTextField("a", 3, 0); + newTextField("a", 4, 0); + newTextField("a", 5, 0); + newTextField("a", 6, 0); + newTextField("a", 7, 0); + newTextField("a", 8, 0); + newTextField("a", 40, 0); + nextY += 34; + nextX = 2; + + newTextField("b", 0, 0); + newTextField("b", 1, 0); + newTextField("b", 2, 0); + newTextField("b", 3, 0); + newTextField("b", 4, 0); + newTextField("b", 5, 0); + newTextField("b", 6, 0); + newTextField("b", 7, 0); + newTextField("b", 8, 0); + newTextField("b", 40, 0); + nextY += 34; + nextX = 2; + + newTextField("b", 6, 0); + newTextField("b", 6, 1); + newTextField("b", 6, 2); + newTextField("b", 6, 3); + newTextField("b", 6, 4); + newTextField("b", 6, 5); + newTextField("b", 6, 6); + newTextField("b", 6, 18); + newTextField("b", 6, 19); + newTextField("b", 6, 20); + newTextField("b", 6, 21); + newTextField("b", 6, 22); + } + + private function newTextField(value: String, width: int, hscroll: int): void { + var text:TextField = new TextField(); + text.border = true; + text.width = width; + text.x = nextX; + text.y = nextY; + text.height = 30; + text.embedFonts = true; + var tf = new TextFormat(); + tf.font = "TestFont"; + tf.size = 20; + text.defaultTextFormat = tf; + text.text = value; + text.scrollH = hscroll; + nextX += text.width + 2; + addChild(text); + } + +} +} diff --git a/tests/tests/swfs/visual/edittext/edittext_gutter/TestFont.sfd b/tests/tests/swfs/visual/edittext/edittext_gutter/TestFont.sfd new file mode 100644 index 0000000000000..a9227ec73ce79 --- /dev/null +++ b/tests/tests/swfs/visual/edittext/edittext_gutter/TestFont.sfd @@ -0,0 +1,83 @@ +SplineFontDB: 3.2 +FontName: TestFont +FullName: TestFont +FamilyName: TestFont +Weight: Regular +Copyright: Copyright (c) 2024, Kamil Jarosz +UComments: "2024-7-24: Created with FontForge (http://fontforge.org)" +Version: 001.000 +ItalicAngle: 0 +UnderlinePosition: -100 +UnderlineWidth: 50 +Ascent: 800 +Descent: 200 +InvalidEm: 0 +LayerCount: 2 +Layer: 0 0 "Back" 1 +Layer: 1 0 "Fore" 0 +XUID: [1021 253 198287149 6396829] +StyleMap: 0x0000 +FSType: 0 +OS2Version: 0 +OS2_WeightWidthSlopeOnly: 0 +OS2_UseTypoMetrics: 1 +CreationTime: 1721856925 +ModificationTime: 1728902792 +OS2TypoAscent: 0 +OS2TypoAOffset: 1 +OS2TypoDescent: 0 +OS2TypoDOffset: 1 +OS2TypoLinegap: 90 +OS2WinAscent: 0 +OS2WinAOffset: 1 +OS2WinDescent: 0 +OS2WinDOffset: 1 +HheadAscent: 0 +HheadAOffset: 1 +HheadDescent: 0 +HheadDOffset: 1 +OS2Vendor: 'PfEd' +MarkAttachClasses: 1 +DEI: 91125 +Encoding: ISO8859-1 +UnicodeInterp: none +NameList: AGL For New Fonts +DisplaySize: -48 +AntiAlias: 1 +FitToEm: 0 +WinInfo: 0 30 10 +BeginPrivate: 0 +EndPrivate +BeginChars: 256 2 + +StartChar: a +Encoding: 97 97 0 +Width: 50 +Flags: HW +LayerCount: 2 +Fore +SplineSet +0 800 m 1 + 50 800 l 1 + 50 0 l 1 + 0 0 l 1 + 0 800 l 1 +EndSplineSet +EndChar + +StartChar: b +Encoding: 98 98 1 +Width: 1000 +Flags: HW +LayerCount: 2 +Fore +SplineSet +0 800 m 1 + 1000 800 l 1 + 1000 0 l 1 + 0 0 l 1 + 0 800 l 1 +EndSplineSet +EndChar +EndChars +EndSplineFont diff --git a/tests/tests/swfs/visual/edittext/edittext_gutter/TestFont.ttf b/tests/tests/swfs/visual/edittext/edittext_gutter/TestFont.ttf new file mode 100644 index 0000000000000000000000000000000000000000..e819e244398d8578404fe5e7ea881ca9a1b3a6a7 GIT binary patch literal 1600 zcmcgsO=uHA6#iy^(uhB8KtZ(11go~i#?4xaN)BS%s1;GPig>ZxxJ?2{6E;z-pm^{g zA|ePP9=&)IS`a*VuLo~>>_O_K2lb$MYl+{RY>SF`5u9aqzW2SKdGqE63cx1ZhK-4Q ze*Dz)m2Z21L=V~SV_a6I9R>RfW6AtIrE2qf z;vLeI-%#FMsTBfD;0gUjzo8mjuj2#`QGcAWo(`&E_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-52p~Xp~oA~ XNYMMF#lQW$>7!35|MbD1liFS8`|huh literal 0 HcmV?d00001 diff --git a/tests/tests/swfs/visual/edittext/edittext_gutter/test.toml b/tests/tests/swfs/visual/edittext/edittext_gutter/test.toml new file mode 100644 index 0000000000000..454b7bf7f4dcb --- /dev/null +++ b/tests/tests/swfs/visual/edittext/edittext_gutter/test.toml @@ -0,0 +1,7 @@ +num_ticks = 1 + +[image_comparisons.output] +tolerance = 128 + +[player_options] +with_renderer = { optional = false, sample_count = 4 }