diff --git a/core/src/display_object/edit_text.rs b/core/src/display_object/edit_text.rs index 602796e35b5a..4ee791b05791 100644 --- a/core/src/display_object/edit_text.rs +++ b/core/src/display_object/edit_text.rs @@ -791,23 +791,32 @@ impl<'gc> EditText<'gc> { /// coordinate space into this object's local space. fn layout_to_local_matrix(self) -> Matrix { let bounds = self.0.bounds.get(); - Matrix::translate( + let matrix = Matrix::translate( bounds.x_min + Self::GUTTER - Twips::from_pixels(self.0.hscroll.get()), bounds.y_min + Self::GUTTER - self.0.vertical_scroll_offset(), - ) + ); + + if self.font_type() == FontType::Device { + // Device text cannot be scaled independently in x/y. + // Here we have to make sure the independent x/y scale applied for + // the local coordinate space is reversed, leaving only y scale + // and keeping the original aspect ratio in x. + let m = self.local_to_global_matrix(); + let device_font_scale_x = m.d / m.a; + matrix * Matrix::scale(device_font_scale_x, 1.0f32) + } else { + matrix + } } /// Returns the matrix for transforming from this object's /// local space into its layout coordinate space. - fn local_to_layout_matrix(self) -> Matrix { - // layout_to_local contains only a translation, - // no need to inverse the matrix generically. - let Matrix { tx, ty, .. } = self.layout_to_local_matrix(); - Matrix::translate(-tx, -ty) + fn local_to_layout_matrix(self) -> Option { + self.layout_to_local_matrix().inverse() } - fn local_to_layout(self, local: Point) -> Point { - self.local_to_layout_matrix() * local + fn local_to_layout(self, local: Point) -> Option> { + Some(self.local_to_layout_matrix()? * local) } pub fn replace_text( @@ -969,6 +978,7 @@ impl<'gc> EditText<'gc> { /// The returned tuple should be interpreted as width, then height. pub fn measure_text(self, _context: &mut UpdateContext<'gc>) -> (Twips, Twips) { let text_size = self.0.layout.borrow().text_size(); + let text_size = self.layout_to_local_matrix() * text_size; (text_size.width(), text_size.height()) } @@ -1592,7 +1602,7 @@ impl<'gc> EditText<'gc> { /// Characters are divided in half, the last line is extended, etc. pub fn screen_position_to_index(self, position: Point) -> Option { let position = self.global_to_local(position)?; - let position = self.local_to_layout(position); + let position = self.local_to_layout(position)?; // TODO We can use binary search for both y and x here @@ -2261,13 +2271,15 @@ impl<'gc> EditText<'gc> { let line = layout.lines().get(line)?; let bounds = line.bounds(); + // TODO What about internal bounds? + let bounds = self.layout_to_local_matrix() * bounds; Some(LayoutMetrics { ascent: line.ascent(), descent: line.descent(), leading: line.leading(), width: bounds.width(), height: bounds.height() + line.leading(), - x: bounds.offset_x() + Self::GUTTER, + x: bounds.offset_x(), }) } @@ -2302,7 +2314,7 @@ impl<'gc> EditText<'gc> { return None; } - let position = self.local_to_layout(position); + let position = self.local_to_layout(position)?; Some( self.0 diff --git a/core/src/html/dimensions.rs b/core/src/html/dimensions.rs index 65dd737ca4c0..87c095e17e2d 100644 --- a/core/src/html/dimensions.rs +++ b/core/src/html/dimensions.rs @@ -152,6 +152,34 @@ impl From> for Size { } } +impl From> for Size { + fn from(size: swf::PointDelta) -> Self { + Self { + width: size.dx, + height: size.dy, + } + } +} + +impl From> for swf::PointDelta { + fn from(size: Size) -> Self { + Self { + dx: size.width, + dy: size.height, + } + } +} + +impl std::ops::Mul> for ruffle_render::matrix::Matrix { + type Output = Size; + + fn mul(self, size: Size) -> Size { + // Size has the same semantics as PointDelta when applying a matrix + let size: swf::PointDelta = size.into(); + (self * size).into() + } +} + /// A type which represents the offset and size of a text box. #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct BoxBounds { @@ -203,6 +231,16 @@ where } } +impl std::ops::Mul> for ruffle_render::matrix::Matrix { + type Output = BoxBounds; + + fn mul(self, bounds: BoxBounds) -> BoxBounds { + // BoxBounds have the same semantics as Rectangle when applying a matrix + let bounds: Rectangle = bounds.into(); + (self * bounds).into() + } +} + impl BoxBounds where T: Add + Sub + Copy, diff --git a/tests/tests/swfs/visual/edittext/edittext_device_transform_basic/Test.as b/tests/tests/swfs/visual/edittext/edittext_device_transform_basic/Test.as new file mode 100644 index 000000000000..596c8fff102f --- /dev/null +++ b/tests/tests/swfs/visual/edittext/edittext_device_transform_basic/Test.as @@ -0,0 +1,63 @@ +package { +import flash.display.*; +import flash.text.*; +import flash.geom.*; + +[SWF(width="200", height="200")] +public class Test extends Sprite { + [Embed(source="TestFont.ttf", fontName="TestFont", embedAsCFF="false", unicodeRange="U+0061-U+0064")] + private var TestFont:Class; + + private var nextX:int = 0; + private var nextY:int = 0; + + public function Test() { + stage.scaleMode = "noScale"; + + test(false); + test(false, 2); + test(false, 1, 2); + test(false, 2, 2); + + nextX = 100; + nextY = 0; + + test(true); + test(true, 2); + test(true, 1, 2); + test(true, 2, 2); + } + + private function test(device: Boolean, scaleX: Number = 1, scaleY: Number = 1):TextField { + var text:TextField = new TextField(); + text.x = nextX; + text.y = nextY; + text.border = true; + text.width = 40; + text.height = 20; + text.embedFonts = !device; + var tf:TextFormat = new TextFormat(); + tf.font = "TestFont"; + tf.size = 10; + text.defaultTextFormat = tf; + + text.multiline = true; + text.text = "ab\n\n\n\n\n\n\n\n\n\n\nab"; + text.scaleX = scaleX; + text.scaleY = scaleY; + addChild(text); + + nextY += 50; + + trace("" + device + " = " + text.getCharBoundaries(0) + "," + text.getCharBoundaries(1)); + trace("" + device + " = " + metricsToString(text.getLineMetrics(0))); + trace("" + device + " = " + text.textWidth); + + return text; + } + + private function metricsToString(m:TextLineMetrics): String { + return "width=" + Math.round(m.width); + } +} +} diff --git a/tests/tests/swfs/visual/edittext/edittext_device_transform_basic/TestFont.ttf b/tests/tests/swfs/visual/edittext/edittext_device_transform_basic/TestFont.ttf new file mode 100644 index 000000000000..761128c1eb3c Binary files /dev/null and b/tests/tests/swfs/visual/edittext/edittext_device_transform_basic/TestFont.ttf differ diff --git a/tests/tests/swfs/visual/edittext/edittext_device_transform_basic/output.expected.png b/tests/tests/swfs/visual/edittext/edittext_device_transform_basic/output.expected.png new file mode 100644 index 000000000000..17fb34882470 Binary files /dev/null and b/tests/tests/swfs/visual/edittext/edittext_device_transform_basic/output.expected.png differ diff --git a/tests/tests/swfs/visual/edittext/edittext_device_transform_basic/output.txt b/tests/tests/swfs/visual/edittext/edittext_device_transform_basic/output.txt new file mode 100644 index 000000000000..cc88537d1095 --- /dev/null +++ b/tests/tests/swfs/visual/edittext/edittext_device_transform_basic/output.txt @@ -0,0 +1,24 @@ +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = width=16 +false = 16 +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = width=16 +false = 16 +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = width=16 +false = 16 +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = width=16 +false = 16 +true = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +true = width=16 +true = 16 +true = (x=2, y=2, w=4, h=10),(x=6, y=2, w=4, h=10) +true = width=8 +true = 8 +true = (x=2, y=2, w=16, h=10),(x=18, y=2, w=16, h=10) +true = width=32 +true = 32 +true = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +true = width=16 +true = 16 diff --git a/tests/tests/swfs/visual/edittext/edittext_device_transform_basic/test.swf b/tests/tests/swfs/visual/edittext/edittext_device_transform_basic/test.swf new file mode 100644 index 000000000000..7d74601360e5 Binary files /dev/null and b/tests/tests/swfs/visual/edittext/edittext_device_transform_basic/test.swf differ diff --git a/tests/tests/swfs/visual/edittext/edittext_device_transform_basic/test.toml b/tests/tests/swfs/visual/edittext/edittext_device_transform_basic/test.toml new file mode 100644 index 000000000000..897bd201aae9 --- /dev/null +++ b/tests/tests/swfs/visual/edittext/edittext_device_transform_basic/test.toml @@ -0,0 +1,18 @@ +num_ticks = 1 + +[[image_comparisons.output.checks]] +tolerance = 0 +max_outliers = 90 + +[[image_comparisons.output.checks]] +tolerance = 128 +max_outliers = 14 + +[player_options] +with_renderer = { optional = true, sample_count = 4 } + +[fonts.test_font] +family = "TestFont" +path = "TestFont.ttf" +bold = false +italic = false diff --git a/tests/tests/swfs/visual/edittext/edittext_device_transform_metrics/Test.as b/tests/tests/swfs/visual/edittext/edittext_device_transform_metrics/Test.as new file mode 100644 index 000000000000..b4b52e777f66 --- /dev/null +++ b/tests/tests/swfs/visual/edittext/edittext_device_transform_metrics/Test.as @@ -0,0 +1,81 @@ +package { +import flash.display.*; +import flash.text.*; +import flash.geom.*; + +[SWF(width="200", height="200")] +public class Test extends Sprite { + [Embed(source="TestFont.ttf", fontName="TestFont", embedAsCFF="false", unicodeRange="U+0061-U+0064")] + private var TestFont:Class; + + private var nextX:int = 0; + private var nextY:int = 0; + + public function Test() { + stage.scaleMode = "noScale"; + + test(false); + test(false, 2); + test(false, 1, 2); + test(false, 2, 2); + + nextX = 100; + nextY = 0; + + test(true); + test(true, 2); + test(true, 1, 2); + test(true, 2, 2); + } + + private function test(device: Boolean, scaleX: Number = 1, scaleY: Number = 1):TextField { + var text:TextField = new TextField(); + text.x = nextX; + text.y = nextY; + text.border = true; + text.width = 40; + text.height = 20; + text.embedFonts = !device; + var tf:TextFormat = new TextFormat(); + tf.font = "TestFont"; + tf.size = 10; + text.defaultTextFormat = tf; + + text.multiline = true; + text.text = "ab\n\n\n\n\n\n\n\n\n\n\nab"; + text.scaleX = scaleX; + text.scaleY = scaleY; + addChild(text); + + nextY += 50; + + trace("" + device + " = " + text.getCharBoundaries(0) + "," + text.getCharBoundaries(1)); + trace("" + device + " = " + + text.getCharIndexAtPoint(1, 5) + "," + + text.getCharIndexAtPoint(2, 5) + "," + + text.getCharIndexAtPoint(5, 5) + "," + + text.getCharIndexAtPoint(8, 5) + "," + + text.getCharIndexAtPoint(10, 5) + "," + + text.getCharIndexAtPoint(12, 5) + "," + + text.getCharIndexAtPoint(15, 5) + "," + + text.getCharIndexAtPoint(8, 1) + "," + + text.getCharIndexAtPoint(12, 1) + "," + + text.getCharIndexAtPoint(8, 12) + "," + + text.getCharIndexAtPoint(12, 12) + "," + + ""); + trace("" + device + " = " + metricsToString(text.getLineMetrics(0))); + trace("" + device + " = " + text.textHeight); + trace("" + device + " = " + text.textWidth); + + return text; + } + + private function metricsToString(m:TextLineMetrics): String { + return "height=" + Math.round(m.height) + + ",width=" + Math.round(m.width) + + ",x=" + Math.round(m.x) + + ",ascent=" + Math.round(m.ascent) + + ",descent=" + Math.round(m.descent); + } +} +} diff --git a/tests/tests/swfs/visual/edittext/edittext_device_transform_metrics/TestFont.ttf b/tests/tests/swfs/visual/edittext/edittext_device_transform_metrics/TestFont.ttf new file mode 100644 index 000000000000..761128c1eb3c Binary files /dev/null and b/tests/tests/swfs/visual/edittext/edittext_device_transform_metrics/TestFont.ttf differ diff --git a/tests/tests/swfs/visual/edittext/edittext_device_transform_metrics/output.txt b/tests/tests/swfs/visual/edittext/edittext_device_transform_metrics/output.txt new file mode 100644 index 000000000000..69da5c8b549c --- /dev/null +++ b/tests/tests/swfs/visual/edittext/edittext_device_transform_metrics/output.txt @@ -0,0 +1,40 @@ +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = 0,0,0,0,1,1,1,-1,-1,-1,-1, +false = height=10,width=16,x=2,ascent=8,descent=2 +false = 120 +false = 16 +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = 0,0,0,0,1,1,1,-1,-1,-1,-1, +false = height=10,width=16,x=2,ascent=8,descent=2 +false = 120 +false = 16 +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = 0,0,0,0,1,1,1,-1,-1,-1,-1, +false = height=10,width=16,x=2,ascent=8,descent=2 +false = 120 +false = 16 +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = 0,0,0,0,1,1,1,-1,-1,-1,-1, +false = height=10,width=16,x=2,ascent=8,descent=2 +false = 120 +false = 16 +true = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +true = 0,0,0,0,1,1,1,-1,-1,-1,-1, +true = height=10,width=16,x=102,ascent=8,descent=2 +true = 120 +true = 16 +true = (x=2, y=2, w=4, h=10),(x=6, y=2, w=4, h=10) +true = 0,0,0,1,-1,-1,-1,-1,-1,-1,-1, +true = height=5,width=8,x=52,ascent=4,descent=1 +true = 60 +true = 8 +true = (x=2, y=2, w=16, h=10),(x=18, y=2, w=16, h=10) +true = 0,0,0,0,0,0,0,-1,-1,-1,-1, +true = height=20,width=32,x=102,ascent=16,descent=4 +true = 240 +true = 32 +true = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +true = 0,0,0,0,1,1,1,-1,-1,-1,-1, +true = height=10,width=16,x=52,ascent=8,descent=2 +true = 120 +true = 16 diff --git a/tests/tests/swfs/visual/edittext/edittext_device_transform_metrics/test.swf b/tests/tests/swfs/visual/edittext/edittext_device_transform_metrics/test.swf new file mode 100644 index 000000000000..79d58219adee Binary files /dev/null and b/tests/tests/swfs/visual/edittext/edittext_device_transform_metrics/test.swf differ diff --git a/tests/tests/swfs/visual/edittext/edittext_device_transform_metrics/test.toml b/tests/tests/swfs/visual/edittext/edittext_device_transform_metrics/test.toml new file mode 100644 index 000000000000..0af2dd62aacc --- /dev/null +++ b/tests/tests/swfs/visual/edittext/edittext_device_transform_metrics/test.toml @@ -0,0 +1,8 @@ +num_ticks = 1 +known_failure = true + +[fonts.test_font] +family = "TestFont" +path = "TestFont.ttf" +bold = false +italic = false diff --git a/tests/tests/swfs/visual/edittext/edittext_device_transform_negative/Test.as b/tests/tests/swfs/visual/edittext/edittext_device_transform_negative/Test.as new file mode 100644 index 000000000000..65cfb2458430 --- /dev/null +++ b/tests/tests/swfs/visual/edittext/edittext_device_transform_negative/Test.as @@ -0,0 +1,126 @@ +package { +import flash.display.*; +import flash.text.*; +import flash.geom.*; + +public class Test extends Sprite { + [Embed(source="TestFont.ttf", fontName="TestFont", embedAsCFF="false", unicodeRange="U+0061-U+0064")] + private var TestFont:Class; + + private var nextX = 0; + private var nextY = 0; + + public function Test() { + stage.scaleMode = "noScale"; + + test(false); + test(false, 2); + test(false, 1, 2); + test(false, 2, 2); + + nextX += 50; + test(false, 1, 1, 90); + test(false, 1, 2, 90); + nextX -= 50; + + nextX = 100; + nextY = 0; + + test(true); + test(true, 2); + test(true, 1, 2); + test(true, 2, 2); + + nextX += 50; + test(true, 1, 1, 90); + test(true, 1, 2, 90); + nextX -= 50; + + nextX = 200; + nextY = 0; + + test(false); + test(false, -2); + test(false, -1, -2); + test(false, -2, -2); + + nextY += 50; + test(false, -1, -1, 90); + test(false, -1, -2, 90); + nextY -= 50; + + nextX = 300; + nextY = 0; + + test(true); + test(true, -2); + test(true, -1, -2); + test(true, -2, -2); + + nextY += 50; + test(true, -1, -1, 90); + test(true, -1, -2, 90); + nextY -= 50; + + nextX = 400; + nextY = 0; + } + + private function test(device: Boolean, scaleX: Number = 1, scaleY: Number = 1, rotation: Number = 0):TextField { + var text = new TextField(); + text.x = nextX; + text.y = nextY; + if (rotation == 0 && scaleX < 0) { + text.x += 100; + } + if (rotation == 0 && scaleY < 0) { + text.y += 50; + } + text.border = true; + text.width = 40; + text.height = 20; + text.embedFonts = !device; + var tf = new TextFormat(); + tf.font = "TestFont"; + tf.size = 10; + text.defaultTextFormat = tf; + + text.multiline = true; + text.text = "ab\n\n\n\n\n\n\n\n\n\n\nab"; + text.scaleX = scaleX; + text.scaleY = scaleY; + text.rotation = rotation; + addChild(text); + + nextY += 50; + + trace("" + device + " = " + text.getCharBoundaries(0) + "," + text.getCharBoundaries(1)); + trace("" + device + " = " + + text.getCharIndexAtPoint(1, 5) + "," + + text.getCharIndexAtPoint(2, 5) + "," + + text.getCharIndexAtPoint(5, 5) + "," + + text.getCharIndexAtPoint(8, 5) + "," + + text.getCharIndexAtPoint(10, 5) + "," + + text.getCharIndexAtPoint(12, 5) + "," + + text.getCharIndexAtPoint(15, 5) + "," + + text.getCharIndexAtPoint(8, 1) + "," + + text.getCharIndexAtPoint(12, 1) + "," + + text.getCharIndexAtPoint(8, 12) + "," + + text.getCharIndexAtPoint(12, 12) + "," + + ""); + trace("" + device + " = " + metricsToString(text.getLineMetrics(0))); + trace("" + device + " = " + text.textHeight); + trace("" + device + " = " + text.textWidth); + + return text; + } + + private function metricsToString(m:TextLineMetrics): String { + return "height=" + Math.round(m.height) + + ",width=" + Math.round(m.width) + + ",x=" + Math.round(m.x) + + ",ascent=" + Math.round(m.ascent) + + ",descent=" + Math.round(m.descent); + } +} +} diff --git a/tests/tests/swfs/visual/edittext/edittext_device_transform_negative/TestFont.ttf b/tests/tests/swfs/visual/edittext/edittext_device_transform_negative/TestFont.ttf new file mode 100644 index 000000000000..761128c1eb3c Binary files /dev/null and b/tests/tests/swfs/visual/edittext/edittext_device_transform_negative/TestFont.ttf differ diff --git a/tests/tests/swfs/visual/edittext/edittext_device_transform_negative/output.expected.png b/tests/tests/swfs/visual/edittext/edittext_device_transform_negative/output.expected.png new file mode 100644 index 000000000000..01840d1e1464 Binary files /dev/null and b/tests/tests/swfs/visual/edittext/edittext_device_transform_negative/output.expected.png differ diff --git a/tests/tests/swfs/visual/edittext/edittext_device_transform_negative/output.txt b/tests/tests/swfs/visual/edittext/edittext_device_transform_negative/output.txt new file mode 100644 index 000000000000..8a8ce87fa140 --- /dev/null +++ b/tests/tests/swfs/visual/edittext/edittext_device_transform_negative/output.txt @@ -0,0 +1,120 @@ +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = 0,0,0,0,1,1,1,-1,-1,-1,-1, +false = height=10,width=16,x=2,ascent=8,descent=2 +false = 120 +false = 16 +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = 0,0,0,0,1,1,1,-1,-1,-1,-1, +false = height=10,width=16,x=2,ascent=8,descent=2 +false = 120 +false = 16 +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = 0,0,0,0,1,1,1,-1,-1,-1,-1, +false = height=10,width=16,x=2,ascent=8,descent=2 +false = 120 +false = 16 +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = 0,0,0,0,1,1,1,-1,-1,-1,-1, +false = height=10,width=16,x=2,ascent=8,descent=2 +false = 120 +false = 16 +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = 0,0,0,0,1,1,1,-1,-1,-1,-1, +false = height=10,width=16,x=2,ascent=8,descent=2 +false = 120 +false = 16 +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = 0,0,0,0,1,1,1,-1,-1,-1,-1, +false = height=10,width=16,x=2,ascent=8,descent=2 +false = 120 +false = 16 +true = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +true = 0,0,0,0,1,1,1,-1,-1,-1,-1, +true = height=10,width=16,x=102,ascent=8,descent=2 +true = 120 +true = 16 +true = (x=2, y=2, w=4, h=10),(x=6, y=2, w=4, h=10) +true = 0,0,0,1,-1,-1,-1,-1,-1,-1,-1, +true = height=5,width=8,x=52,ascent=4,descent=1 +true = 60 +true = 8 +true = (x=2, y=2, w=16, h=10),(x=18, y=2, w=16, h=10) +true = 0,0,0,0,0,0,0,-1,-1,-1,-1, +true = height=20,width=32,x=102,ascent=16,descent=4 +true = 240 +true = 32 +true = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +true = 0,0,0,0,1,1,1,-1,-1,-1,-1, +true = height=10,width=16,x=52,ascent=8,descent=2 +true = 120 +true = 16 +true = (x=2, y=18, w=2, h=-2),(x=2, y=16, w=2, h=-2) +true = 0,0,0,0,0,0,0,0,0,0,0, +true = height=2,width=4,x=132,ascent=2,descent=0 +true = 24 +true = 4 +true = (x=2, y=18, w=2, h=-1),(x=2, y=17, w=2, h=-1) +true = 0,0,0,0,0,0,0,0,0,0,0, +true = height=1,width=2,x=57,ascent=1,descent=0 +true = 12 +true = 2 +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = 0,0,0,0,1,1,1,-1,-1,-1,-1, +false = height=10,width=16,x=2,ascent=8,descent=2 +false = 120 +false = 16 +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = 0,0,0,0,1,1,1,-1,-1,-1,-1, +false = height=10,width=16,x=2,ascent=8,descent=2 +false = 120 +false = 16 +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = 0,0,0,0,1,1,1,-1,-1,-1,-1, +false = height=10,width=16,x=2,ascent=8,descent=2 +false = 120 +false = 16 +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = 0,0,0,0,1,1,1,-1,-1,-1,-1, +false = height=10,width=16,x=2,ascent=8,descent=2 +false = 120 +false = 16 +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = 0,0,0,0,1,1,1,-1,-1,-1,-1, +false = height=10,width=16,x=2,ascent=8,descent=2 +false = 120 +false = 16 +false = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +false = 0,0,0,0,1,1,1,-1,-1,-1,-1, +false = height=10,width=16,x=2,ascent=8,descent=2 +false = 120 +false = 16 +true = (x=2, y=2, w=8, h=10),(x=10, y=2, w=8, h=10) +true = 0,0,0,0,1,1,1,-1,-1,-1,-1, +true = height=10,width=16,x=302,ascent=8,descent=2 +true = 120 +true = 16 +true = (x=38, y=2, w=-4, h=10),(x=34, y=2, w=-4, h=10) +true = 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, +true = height=5,width=8,x=162,ascent=4,descent=1 +true = 60 +true = 8 +true = (x=38, y=18, w=-16, h=-10),(x=22, y=18, w=-16, h=-10) +true = -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, +true = height=20,width=32,x=362,ascent=16,descent=4 +true = 240 +true = 32 +true = (x=38, y=18, w=-8, h=-10),(x=30, y=18, w=-8, h=-10) +true = -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, +true = height=10,width=16,x=162,ascent=8,descent=2 +true = 120 +true = 16 +true = (x=38, y=2, w=-2, h=2),(x=38, y=4, w=-2, h=2) +true = 0,0,0,0,0,0,0,0,0,0,0, +true = height=2,width=4,x=302,ascent=2,descent=0 +true = 24 +true = 4 +true = (x=38, y=2, w=-2, h=1),(x=38, y=3, w=-2, h=1) +true = 0,0,0,0,0,0,0,0,0,0,0, +true = height=1,width=2,x=152,ascent=1,descent=0 +true = 12 +true = 2 diff --git a/tests/tests/swfs/visual/edittext/edittext_device_transform_negative/test.swf b/tests/tests/swfs/visual/edittext/edittext_device_transform_negative/test.swf new file mode 100644 index 000000000000..82a672296604 Binary files /dev/null and b/tests/tests/swfs/visual/edittext/edittext_device_transform_negative/test.swf differ diff --git a/tests/tests/swfs/visual/edittext/edittext_device_transform_negative/test.toml b/tests/tests/swfs/visual/edittext/edittext_device_transform_negative/test.toml new file mode 100644 index 000000000000..ca0673a36864 --- /dev/null +++ b/tests/tests/swfs/visual/edittext/edittext_device_transform_negative/test.toml @@ -0,0 +1,19 @@ +num_ticks = 1 +known_failure = true + +[[image_comparisons.output.checks]] +tolerance = 0 +max_outliers = 160 + +[[image_comparisons.output.checks]] +tolerance = 128 +max_outliers = 30 + +[player_options] +with_renderer = { optional = true, sample_count = 4 } + +[fonts.test_font] +family = "TestFont" +path = "TestFont.ttf" +bold = false +italic = false