summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-path-addpath.js
diff options
context:
space:
mode:
authorjunov@chromium.org <junov@chromium.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538>2014-04-09 19:59:55 +0000
committerjunov@chromium.org <junov@chromium.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538>2014-04-09 19:59:55 +0000
commit728730bb92a70859f817e62e1ccdc48e1a1c8323 (patch)
treed6765a99cdc9caf9e7f34cb8247e1735d1a91d82 /third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-path-addpath.js
parent857bf9a84b9a1feeab884c767176f030fe1f01c3 (diff)
downloadchromium_src-728730bb92a70859f817e62e1ccdc48e1a1c8323.zip
chromium_src-728730bb92a70859f817e62e1ccdc48e1a1c8323.tar.gz
chromium_src-728730bb92a70859f817e62e1ccdc48e1a1c8323.tar.bz2
Make optional the transform argument of Path2D.addPath
BUG=361686 Review URL: https://codereview.chromium.org/231453002 git-svn-id: svn://svn.chromium.org/blink/trunk@171172 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-path-addpath.js')
-rw-r--r--third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-path-addpath.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-path-addpath.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-path-addpath.js
index c2fa3f2..ed7b69f 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-path-addpath.js
+++ b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-path-addpath.js
@@ -1,7 +1,9 @@
description("Test addPath() method.");
-var ctx = document.createElement('canvas').getContext('2d');
+var canvas = document.createElement('canvas');
+var ctx = canvas.getContext('2d');
debug("Test addPath() with transform as identity matrix.")
+ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.beginPath();
var p1 = new Path2D();
p1.rect(0,0,100,100);
@@ -21,6 +23,7 @@ shouldBe("imgdata[7]", "255");
debug("");
debug("Test addPath() with transform as translate(100, -100).")
+ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.beginPath();
var p3 = new Path2D();
p3.rect(0,0,100,100);
@@ -42,6 +45,7 @@ shouldBe("imgdata[7]", "255");
debug("");
debug("Test addPath() with non-invertible transform.")
+ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.beginPath();
var p5 = new Path2D();
p5.rect(0,0,100,100);
@@ -63,6 +67,7 @@ shouldNotBe("imgdata[7]", "255");
debug("");
debug("Test addPath() with transform as null or invalid type.")
+ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.beginPath();
var p7 = new Path2D();
p7.rect(0,0,100,100);
@@ -82,6 +87,24 @@ shouldBe("imgdata[6]", "0");
shouldBe("imgdata[7]", "255");
debug("");
+debug("Test addPath() with transform omitted.")
+ctx.clearRect(0, 0, canvas.width, canvas.height);
+ctx.beginPath();
+var p9 = new Path2D();
+var p10 = new Path2D();
+p9.rect(0,0,10,10);
+p10.addPath(p9);
+ctx.fillStyle = 'red';
+ctx.currentPath = p10;
+ctx.fill();
+imageData = ctx.getImageData(1, 1, 1, 1);
+imgdata = imageData.data;
+shouldBe("imgdata[0]", "255");
+shouldBe("imgdata[1]", "0");
+shouldBe("imgdata[2]", "0");
+shouldBe("imgdata[3]", "255");
+debug("");
+
debug("Test addPath() with path as null and invalid type");
var p9 = new Path2D();
p9.rect(0,0,100,100);