| Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-gradient-shadow.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-gradient-shadow.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-gradient-shadow.html
|
| index 93346e34ce5f6cd7bd4b60b3a7030f328aff9865..842509f6488ace62eb1964d1a0cabd0c3080a87d 100644
|
| --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-gradient-shadow.html
|
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-gradient-shadow.html
|
| @@ -1,9 +1,89 @@
|
| -<!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-fillPath-gradient-shadow.js"></script>
|
| +<script>
|
| +var canvas = document.createElement('canvas');
|
| +document.body.appendChild(canvas);
|
| +canvas.setAttribute('width', '600');
|
| +canvas.setAttribute('height', '1100');
|
| +var ctx = canvas.getContext('2d');
|
| +
|
| +var gradient = ctx.createLinearGradient(0, 0, 300, 0);
|
| +gradient.addColorStop(0, 'rgba(0, 0, 255, 0.5)');
|
| +gradient.addColorStop(1, 'rgba(0, 0, 255, 0.5)');
|
| +
|
| +ctx.save();
|
| +ctx.fillStyle = gradient;
|
| +ctx.shadowColor = 'rgba(255, 0, 0, 0.5)';
|
| +ctx.shadowOffsetX = 250;
|
| +
|
| +function fillShape(x, y) {
|
| + ctx.beginPath();
|
| + ctx.arc(x, y, 100, 0, Math.PI*2, true);
|
| + ctx.arc(x, y, 50, 0, Math.PI*2, false);
|
| + ctx.fill();
|
| +}
|
| +
|
| +// Alpha shadow.
|
| +ctx.shadowBlur = 0;
|
| +fillShape(150, 150);
|
| +
|
| +// Blurry shadow.
|
| +ctx.shadowBlur = 10;
|
| +fillShape(150, 400);
|
| +
|
| +ctx.rotate(Math.PI/2);
|
| +
|
| +// Rotated alpha shadow.
|
| +ctx.shadowBlur = 0;
|
| +fillShape(650, -150);
|
| +
|
| +// Rotated blurry shadow.
|
| +ctx.shadowBlur = 10;
|
| +fillShape(900, -150);
|
| +
|
| +ctx.restore();
|
| +ctx.fillStyle = 'black';
|
| +
|
| +function testPixelShadow(pixel, reference, alphaApprox) {
|
| + var testPassed = true;
|
| + for(i = 0; i < 3; i++)
|
| + if(pixel[i] != reference[i]) {
|
| + testPassed = false;
|
| + break;
|
| + }
|
| + assert_true(testPassed);
|
| + assert_approx_equals(pixel[3], reference[3], alphaApprox);
|
| +}
|
| +
|
| +testScenarios =
|
| + [
|
| + ['TestAlphaShadow 1', ctx.getImageData(400, 150, 1, 1).data, [ 0, 0, 0, 0, 0], 0],
|
| + ['TestAlphaShadow 2', ctx.getImageData(400, 75, 1, 1).data, [ 255, 0, 0, 64], 15],
|
| + ['TestAlphaShadow 3', ctx.getImageData(400, 225, 1, 1).data, [ 255, 0, 0, 64], 15],
|
| + ['TestAlphaShadow 4', ctx.getImageData(325, 150, 1, 1).data, [ 255, 0, 0, 64], 15],
|
| + ['TestAlphaShadow 5', ctx.getImageData(475, 150, 1, 1).data, [ 255, 0, 0, 64], 15],
|
| +
|
| + ['TestBlurryShadow 1', ctx.getImageData(400, 400, 1, 1).data, [ 0, 0, 0, 0, 0], 0],
|
| + ['TestBlurryShadow 2', ctx.getImageData(400, 300, 1, 1).data, [ 255, 0, 0, 31], 15],
|
| + ['TestBlurryShadow 3', ctx.getImageData(400, 500, 1, 1).data, [ 255, 0, 0, 31], 15],
|
| + ['TestBlurryShadow 4', ctx.getImageData(300, 400, 1, 1).data, [ 255, 0, 0, 31], 15],
|
| + ['TestBlurryShadow 5', ctx.getImageData(500, 400, 1, 1).data, [ 255, 0, 0, 31], 15],
|
| +
|
| + ['TestRotatedAlphaShadow 1', ctx.getImageData(400, 650, 1, 1).data, [ 0, 0, 0, 0, 0], 0],
|
| + ['TestRotatedAlphaShadow 2', ctx.getImageData(400, 575, 1, 1).data, [ 255, 0, 0, 64], 15],
|
| + ['TestRotatedAlphaShadow 3', ctx.getImageData(400, 725, 1, 1).data, [ 255, 0, 0, 64], 15],
|
| + ['TestRotatedAlphaShadow 4', ctx.getImageData(325, 650, 1, 1).data, [ 255, 0, 0, 64], 15],
|
| + ['TestRotatedAlphaShadow 5', ctx.getImageData(475, 650, 1, 1).data, [ 255, 0, 0, 64], 15],
|
| +
|
| + ['TestRotatedBlurryShadow 1', ctx.getImageData(400, 900, 1, 1).data, [ 0, 0, 0, 0, 0], 0],
|
| + ['TestRotatedBlurryShadow 2', ctx.getImageData(400, 800, 1, 1).data, [ 255, 0, 0, 31], 15],
|
| + ['TestRotatedBlurryShadow 3', ctx.getImageData(400, 1000, 1, 1).data, [ 255, 0, 0, 31], 15],
|
| + ['TestRotatedBlurryShadow 4', ctx.getImageData(300, 900, 1, 1).data, [ 255, 0, 0, 31], 15],
|
| + ['TestRotatedBlurryShadow 5', ctx.getImageData(500, 900, 1, 1).data, [ 255, 0, 0, 31], 15],
|
| + ];
|
| +
|
| +generate_tests(testPixelShadow, testScenarios);
|
| +
|
| + </script>
|
| </body>
|
| -</html>
|
|
|