| Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-strokePath-shadow.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-strokePath-shadow.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-strokePath-shadow.html
|
| index 9d462aac1ec4ba7b98ba98c02005b228d20fa90b..9b0e1016ec8b5e7bd3fa26135c39d6ae7490b4ce 100644
|
| --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-strokePath-shadow.html
|
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-strokePath-shadow.html
|
| @@ -1,9 +1,64 @@
|
| -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
| -<html>
|
| -<head>
|
| -<script src="../../resources/js-test.js"></script>
|
| -</head>
|
| +<script src="../../resources/testharness.js"></script>
|
| +<script src="../../resources/testharnessreport.js"></script>
|
| <body>
|
| -<script src="script-tests/canvas-strokePath-shadow.js"></script>
|
| +<script>
|
| +// Ensure correct behavior of canvas with path stroke shadow.
|
| +
|
| +var canvas = document.createElement('canvas');
|
| +document.body.appendChild(canvas);
|
| +canvas.setAttribute('width', '700');
|
| +canvas.setAttribute('height', '700');
|
| +var ctx = canvas.getContext('2d');
|
| +
|
| +ctx.beginPath();
|
| +ctx.moveTo(300, 300);
|
| +ctx.lineTo(300, 50);
|
| +ctx.bezierCurveTo(200, 40, 75, 150, 30, 30);
|
| +ctx.quadraticCurveTo(250, 75, 50, 300);
|
| +ctx.shadowOffsetX = 350;
|
| +ctx.shadowColor = 'rgba(255, 20, 0, 0.5)';
|
| +ctx.shadowBlur = 0;
|
| +ctx.strokeStyle = 'rgba(0, 0, 255, 1)';
|
| +ctx.lineWidth = 30;
|
| +ctx.closePath();
|
| +ctx.stroke();
|
| +
|
| +ctx.beginPath();
|
| +ctx.moveTo(300,650);
|
| +ctx.lineTo(300,400);
|
| +ctx.bezierCurveTo(200, 390, 75, 500, 30, 380);
|
| +ctx.quadraticCurveTo(250, 425, 50, 650);
|
| +ctx.shadowOffsetX = 350;
|
| +ctx.shadowColor = 'rgba(255, 0, 0, 0.5)';
|
| +ctx.shadowBlur = 30;
|
| +ctx.strokeStyle = 'rgba(0, 0, 255, 1)';
|
| +ctx.lineWidth = 30;
|
| +ctx.closePath();
|
| +ctx.stroke();
|
| +
|
| +var colorTolerance = 2;
|
| +function checkPixelWithTolerance(x, y, rgbNOTa) {
|
| + data = ctx.getImageData(x, y, 1, 1).data;
|
| + for (i = 0; i < 3; i++)
|
| + assert_approx_equals(data[i], rgbNOTa[i], colorTolerance);
|
| + if(rgbNOTa.length == 4)
|
| + assert_not_equals(data[3], rgbNOTa[3]);
|
| +}
|
| +
|
| +var testScenarios = [
|
| + ['Verify solid shadow 1', 650, 300, [255, 20, 0]],
|
| + ['Verify solid shadow 2', 650, 50, [255, 20, 0]],
|
| + ['Verify solid shadow 3', 380, 30, [255, 20, 0]],
|
| + ['Verify solid shadow 4', 400, 40, [255, 20, 0]],
|
| +
|
| + ['Verify blurry shadow 1', 640, 640, [255, 0, 0, 255]],
|
| + ['Verify blurry shadow 2', 650, 400, [255, 0, 0, 255]],
|
| + ['Verify blurry shadow 3', 380, 380, [255, 0, 0, 255]],
|
| + ['Verify blurry shadow 4', 350, 380, [255, 0, 0, 255]],
|
| +
|
| +];
|
| +
|
| +generate_tests(checkPixelWithTolerance, testScenarios);
|
| +
|
| +</script>
|
| </body>
|
| -</html>
|
|
|