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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-fill-style.html

Issue 2673883002: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Addressing comments Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML> 1 <script src="../../resources/testharness.js"></script>
2 <html> 2 <script src="../../resources/testharnessreport.js"></script>
3 <body> 3 <script type="text/javascript" src="canvas-blending-helpers.js"></script>
4 <script src="../../resources/js-test.js"></script> 4 <script>
5 <script type="text/javascript" src="canvas-blending-helpers.js"></script> 5 test(function(t) {
6 <script type="text/javascript"> 6 var canvas = document.createElement("canvas");
7 7 var sigma = 5;
8 description("Series of tests to ensure correct results on applying diffe rent blend modes when drawing paths."); 8 canvas.width = 10;
9 9 canvas.height = 10;
10 var context; 10 context = canvas.getContext("2d");
11 function actualColor(x, y) { 11 for (var i = 0; i < blendModes.length; ++i) {
12 return context.getImageData(x, y, 1, 1).data; 12 context.clearRect(0, 0, 10, 10);
13 } 13 context.save();
14 14 fillPathWithBackdropInContext(context);
15 function checkBlendModeResult(i, context, sigma) { 15 context.globalCompositeOperation = blendModes[i];
16 var expectedColor = blendColors([129 / 255, 1, 129 / 255, 1], [1, 12 9 / 255, 129 / 255, 1], i); 16 fillPathWithSourceInContext(context);
17 var ac = "actualColor(0, 0)"; 17 checkBlendModeResult(i, context, sigma);
18 shouldBeCloseTo(ac + "[0]", expectedColor[0], sigma); 18 context.restore();
19 shouldBeCloseTo(ac + "[1]", expectedColor[1], sigma); 19 }
20 shouldBeCloseTo(ac + "[2]", expectedColor[2], sigma); 20 }, 'Series of tests to ensure correct results on applying different blend modes when drawing paths.');
21 shouldBeCloseTo(ac + "[3]", expectedColor[3], sigma); 21 </script>
22 }
23
24 function runTest() {
25 var canvas = document.createElement("canvas");
26 var sigma = 5;
27 canvas.width = 10;
28 canvas.height = 10;
29 context = canvas.getContext("2d");
30
31 for (var i = 0; i < blendModes.length; ++i) {
32 debug("Testing blend mode " + blendModes[i]);
33
34 context.clearRect(0, 0, 10, 10);
35 context.save();
36 fillPathWithBackdropInContext(context);
37 context.globalCompositeOperation = blendModes[i];
38 fillPathWithSourceInContext(context);
39 checkBlendModeResult(i, context, sigma);
40 context.restore();
41 debug('');
42 }
43 }
44
45 runTest();
46 </script>
47 </body>
48 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698