Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-2d-clip-anti-aliasing.html |
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-2d-clip-anti-aliasing.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-2d-clip-anti-aliasing.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1596a6d267c2aba8546f85358e1850986f60f20e |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-2d-clip-anti-aliasing.html |
@@ -0,0 +1,41 @@ |
+<!DOCTYPE html> |
+ |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<canvas id="myCanvas" width="240" height="240" style="border:1px solid #d3d3d3;"></canvas> |
+ |
+<script> |
+ |
+test(function() { |
+ var c = document.getElementById("myCanvas"); |
+ var ctx = c.getContext("2d"); |
+ |
+ ctx.beginPath(); |
+ ctx.moveTo(120, 20); |
+ ctx.lineTo(220, 120); |
+ ctx.lineTo(120, 220); |
+ ctx.lineTo(20, 120); |
+ ctx.lineTo(120, 20); |
+ ctx.closePath(); |
+ ctx.clip(); |
+ |
+ ctx.lineWidth = 1; |
+ ctx.strokeStyle="#FF0000"; |
+ ctx.stroke(); |
+ |
+ // When canvas clips are not anti-aliased, only the first two segments of |
+ // the diamond-shaped closed path are drawn on the canvas. |
+ // To check that canvas clip anti-aliasing works fine, we check the |
+ // junction of the third and fourth segments of the path. |
Justin Novosad
2016/09/22 19:15:18
You should check multiple points. you never know h
|
+ var colorData = ctx.getImageData(20, 120, 1, 1).data; |
+ assert_equals(colorData[0], 255); |
+ assert_equals(colorData[1], 0); |
+ assert_equals(colorData[2], 0); |
+ assert_not_equals(colorData[3], 0); |
+ |
+}, 'canvas-2d-clip-anti-aliasing should not return any error'); |
Justin Novosad
2016/09/22 19:15:18
The description you put here should describe what
|
+ |
+</script> |
+ |
+ |
+ |