diff --git a/tests/tests/swfs/avm2/graphics_direct_commands/Test.as b/tests/tests/swfs/avm2/graphics_direct_commands/Test.as new file mode 100644 index 000000000..c9ca8aeba --- /dev/null +++ b/tests/tests/swfs/avm2/graphics_direct_commands/Test.as @@ -0,0 +1,89 @@ +package { + + import flash.display.CapsStyle; + import flash.display.JointStyle; + import flash.display.LineScaleMode; + import flash.display.MovieClip; + import flash.display.Graphics; + import flash.display.Shape; + + + public class Test extends MovieClip { + + + public function Test() { + trapezoid(); + dashes(); + // cubicCircle(); // currently broken in ruffle at time of writing + curveCircle(); + } + + function trapezoid() { + var trapezoid:Shape = new Shape(); + + trapezoid.graphics.lineStyle(10, 0xFFD700, 1, false, LineScaleMode.VERTICAL, + CapsStyle.NONE, JointStyle.MITER, 10); + + trapezoid.graphics.moveTo(100, 100); + + trapezoid.graphics.lineTo(120, 50); + trapezoid.graphics.lineTo(200, 50); + trapezoid.graphics.lineTo(220, 100); + trapezoid.graphics.lineTo(100, 100); + + this.addChild(trapezoid); + } + + function dashes() { + var shape:Shape = new Shape(); + shape.graphics.lineStyle(3, 0x990000, 0.25, false, + LineScaleMode.NONE, CapsStyle.SQUARE); + + shape.graphics.moveTo(10, 20); + shape.graphics.lineTo(20, 20); + shape.graphics.moveTo(30, 20); + shape.graphics.lineTo(50, 20); + shape.graphics.moveTo(60, 20); + shape.graphics.lineTo(80, 20); + shape.graphics.moveTo(90, 20); + shape.graphics.lineTo(110, 20); + shape.graphics.moveTo(120, 20); + shape.graphics.lineTo(130, 20); + this.addChild(shape); + } + + function cubicCircle() { + var shape:Shape = new Shape(); + + shape.graphics.beginFill(0x0000FF); + shape.graphics.moveTo(250, 0); + shape.graphics.cubicCurveTo(275, 0, 300, 25, 300, 50); + shape.graphics.cubicCurveTo(300, 75, 275, 100, 250, 100); + shape.graphics.cubicCurveTo(225, 100, 200, 75, 200, 50); + shape.graphics.cubicCurveTo(200, 25, 225, 0, 250, 0); + shape.graphics.endFill(); + + shape.x = 100; + + this.addChild(shape); + } + + function curveCircle() { + var shape:Shape = new Shape(); + + shape.graphics.beginFill(0x00FF00); + shape.graphics.moveTo(250, 0); + shape.graphics.curveTo(300, 0, 300, 50); + shape.graphics.curveTo(300, 100, 250, 100); + shape.graphics.curveTo(200, 100, 200, 50); + shape.graphics.curveTo(200, 0, 250, 0); + shape.graphics.endFill(); + + shape.x = 100; + shape.y = 100; + + this.addChild(shape); + } + } + +} diff --git a/tests/tests/swfs/avm2/graphics_direct_commands/expected.png b/tests/tests/swfs/avm2/graphics_direct_commands/expected.png new file mode 100644 index 000000000..45cb1377a Binary files /dev/null and b/tests/tests/swfs/avm2/graphics_direct_commands/expected.png differ diff --git a/tests/tests/swfs/avm2/graphics_direct_commands/output.txt b/tests/tests/swfs/avm2/graphics_direct_commands/output.txt new file mode 100644 index 000000000..e69de29bb diff --git a/tests/tests/swfs/avm2/graphics_direct_commands/test.fla b/tests/tests/swfs/avm2/graphics_direct_commands/test.fla new file mode 100644 index 000000000..c5e87817e Binary files /dev/null and b/tests/tests/swfs/avm2/graphics_direct_commands/test.fla differ diff --git a/tests/tests/swfs/avm2/graphics_direct_commands/test.swf b/tests/tests/swfs/avm2/graphics_direct_commands/test.swf new file mode 100644 index 000000000..b28401c2c Binary files /dev/null and b/tests/tests/swfs/avm2/graphics_direct_commands/test.swf differ diff --git a/tests/tests/swfs/avm2/graphics_direct_commands/test.toml b/tests/tests/swfs/avm2/graphics_direct_commands/test.toml new file mode 100644 index 000000000..83d67fa61 --- /dev/null +++ b/tests/tests/swfs/avm2/graphics_direct_commands/test.toml @@ -0,0 +1,7 @@ +num_frames = 1 + +[image_comparison] +tolerance = 1 + +[player_options] +with_renderer = { optional = false, sample_count = 1 } \ No newline at end of file