Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-lineDash.js

Issue 1381973002: Disable canvas line dashing when dash sequence is all zeros. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added test for 'null' Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-lineDash.js
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-lineDash.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-lineDash.js
index 885bb4afb6b1bf4d9d2e9a7eedcd06de69dcee7d..8c3c8002811d3e7e74632b9ed1cf54817ff4b390 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-lineDash.js
+++ b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-lineDash.js
@@ -39,6 +39,12 @@ shouldBe('lineDash[0]', '15');
shouldBe('lineDash[1]', '10');
shouldBe('ctx.lineDashOffset', '5');
+// Verify setting line dash to sequence of nulls is interpreted as zeros
+ctx.setLineDash([null, null]);
+lineDash = ctx.getLineDash();
+shouldBe('lineDash[0]', '0');
+shouldBe('lineDash[1]', '0');
+
// Set dash style to even number
ctx.setLineDash([5, 10, 15]);
ctx.strokeRect(20, 20, 120, 120);
@@ -104,3 +110,11 @@ pixelShouldBe(105, 40, [0, 255, 0, 255]);
pixelShouldBe(90, 35, [0, 0, 0, 0]);
pixelShouldBe(90, 25, [0, 255, 0, 255]);
+// Verify that all zero dash sequence results in no dashing
+ctx.setLineDash([0, 0]);
+ctx.lineDashOffset = 0;
+ctx.strokeRect(130.5, 10.5, 30, 30);
+pixelShouldBe(130, 10, [0, 255, 0, 255]);
+pixelShouldBe(130, 15, [0, 255, 0, 255]);
+pixelShouldBe(130, 25, [0, 255, 0, 255]);
+pixelShouldBe(130, 35, [0, 255, 0, 255]);

Powered by Google App Engine
This is Rietveld 408576698