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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/drawImage-with-negative-source-destination.html

Issue 2700823002: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Addressing comments Created 3 years, 9 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 PUBLIC "-//IETF//DTD HTML//EN">
2 <!-- Test based on that found at 1 <!-- Test based on that found at
3 http://philip.html5.org/tests/canvas/suite/tests/2d.drawImage.negativesourc e.html 2 http://philip.html5.org/tests/canvas/suite/tests/2d.drawImage.negativesourc e.html
4 --> 3 -->
5 <html> 4 <script src="../../resources/testharness.js"></script>
6 <head> 5 <script src="../../resources/testharnessreport.js"></script>
7 <script src="../../resources/js-test.js"></script>
8 </head>
9 <body>
10 <canvas id="canvas" width="100" height="100"></canvas> 6 <canvas id="canvas" width="100" height="100"></canvas>
11 <script src="drawImage-with-negative-source-destination.js"></script> 7 <script>
12 </body> 8
13 </html> 9 test(function(){
10
11 var canvas2 = document.createElement('canvas');
12 canvas2.width = 100;
13 canvas2.height = 100;
14 var ctx2 = canvas2.getContext('2d');
15 ctx2.fillStyle = '#f00';
16 ctx2.fillRect(0, 0, 100, 50);
17 ctx2.fillStyle = '#0f0';
18 ctx2.fillRect(0, 50, 100, 50);
19
20 var canvas = document.getElementById('canvas').getContext('2d');
21 canvas.drawImage(canvas2, 100, 50, -50, 50, 0, 0, 50, 50);
22 canvas.drawImage(canvas2, 100, 100, -50, -50, 0, 100, 50, -50);
23 canvas.drawImage(canvas2, 0, 100, 100, -50, 100, 100, -50, -50);
24 canvas.drawImage(canvas2, 0, 50, 100, 50, 100, 0, -50, 50);
25
26 var imageData = canvas.getImageData(1, 0, 1, 1).data;
27 assert_array_equals(imageData.slice(0,3), [0, 255, 0]);
28
29 // test width or height -1
30 canvas.fillStyle = '#000';
31 canvas.fillRect(0, 0, 1, 2);
32 canvas.drawImage(canvas2, 0, 0, 1, 1, 1, 1, -1, -1);
33 var imageData = canvas.getImageData(0, 0, 1, 2).data;
34 assert_array_equals(imageData.slice(0,3), [255, 0, 0]);
35 assert_array_equals(imageData.slice(4,7), [0, 0, 0]);
36
37 }, "Series of tests to ensure correct behaviour on negative source/destination o f a HTMLCanvasElement");
38 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698