Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-pattern-over-pattern.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-pattern-over-pattern.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-pattern-over-pattern.html |
| index 9c22020d6858b08bb73de0f496e27a2a3b1f527b..bda3cef34eaf787728d6f2dcfffe3ae94f64187c 100644 |
| --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-pattern-over-pattern.html |
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-pattern-over-pattern.html |
| @@ -1,64 +1,47 @@ |
| -<!DOCTYPE HTML> |
| -<html> |
| -<head> |
| - <script type="text/javascript"> |
| - if (window.testRunner) |
| - testRunner.waitUntilDone(); |
| - window.jsTestIsAsync = true |
| - </script> |
| -</head> |
| -<body> |
| - <script src="../../resources/js-test.js"></script> |
| - <script type="text/javascript" src="canvas-blending-helpers.js"></script> |
| - <script type="text/javascript"> |
| - |
| - description("Series of tests to ensure correct results on applying different blend modes when drawing a pattern on top of another."); |
| - |
| - var context; |
| - function actualColor(x, y) { |
| - return context.getImageData(x, y, 1, 1).data; |
| - } |
| - |
| - function checkBlendModeResult(i, context, sigma) { |
| - var expectedColor = blendColors([129 / 255, 1, 129 / 255, 1], [1, 129 / 255, 129 / 255, 1], i); |
| - var ac = "actualColor(0, 0)"; |
| - shouldBeCloseTo(ac + "[0]", expectedColor[0], sigma); |
| - shouldBeCloseTo(ac + "[1]", expectedColor[1], sigma); |
| - shouldBeCloseTo(ac + "[2]", expectedColor[2], sigma); |
| - shouldBeCloseTo(ac + "[3]", expectedColor[3], sigma); |
| - } |
| - |
| - function drawElement(context, i) { |
| - if (i >= blendModes.length) { |
| - finishJSTest(); |
| - return; |
| - } |
| - debug("Testing blend mode " + blendModes[i]); |
| - |
| - context.clearRect(0, 0, 10, 10); |
| - context.save(); |
| - drawBackdropColorPatternInContext(context, function() { |
| - context.globalCompositeOperation = blendModes[i]; |
| - |
| - drawSourceColorPatternInContext(context, function() { |
| - checkBlendModeResult(i, context, 5); |
| - context.restore(); |
| - debug(''); |
| - drawElement(context, ++i); |
| - }); |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script type="text/javascript" src="canvas-blending-helpers.js"></script> |
| +<script> |
| +test(function(t) { |
|
Justin Novosad
2017/02/07 19:03:39
async
zakerinasab
2017/02/07 21:41:28
Done.
|
| + var context; |
| + function actualColor(x, y) { |
| + return context.getImageData(x, y, 1, 1).data; |
| + } |
| + |
| + function checkBlendModeResult(i, context, sigma) { |
| + var expectedColor = blendColors([129 / 255, 1, 129 / 255, 1], [1, 129 / 255, 129 / 255, 1], i); |
| + var ac = actualColor(0, 0); |
| + assert_approx_equals(ac[0], expectedColor[0], sigma); |
| + assert_approx_equals(ac[1], expectedColor[1], sigma); |
| + assert_approx_equals(ac[2], expectedColor[2], sigma); |
| + assert_approx_equals(ac[3], expectedColor[3], sigma); |
| + } |
| + |
| + function drawElement(context, i) { |
| + if (i >= blendModes.length) |
| + return; |
|
Justin Novosad
2017/02/07 19:03:39
t.done
zakerinasab
2017/02/07 21:41:28
Done.
|
| + |
| + context.clearRect(0, 0, 10, 10); |
| + context.save(); |
| + drawBackdropColorPatternInContext(context, function() { |
| + context.globalCompositeOperation = blendModes[i]; |
| + drawSourceColorPatternInContext(context, function() { |
| + checkBlendModeResult(i, context, 5); |
| + context.restore(); |
| + drawElement(context, ++i); |
| }); |
| - } |
| - |
| - function runTest() { |
| - var canvas = document.createElement("canvas"); |
| - var sigma = 5; |
| - canvas.width = 10; |
| - canvas.height = 10; |
| - context = canvas.getContext("2d"); |
| - drawElement(context, 0); |
| - } |
| - |
| - runTest(); |
| - </script> |
| -</body> |
| -</html> |
| + }); |
| + } |
| + |
| + function runTest() { |
| + var canvas = document.createElement('canvas'); |
| + var sigma = 5; |
| + canvas.width = 10; |
| + canvas.height = 10; |
| + context = canvas.getContext('2d'); |
| + drawElement(context, 0); |
| + } |
| + |
| + runTest(); |
| +}, 'Series of tests to ensure correct results on applying different blend modes when drawing a pattern on top of another.'); |
| +</script> |