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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-with-illegal-args.html

Issue 2693043012: 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 PUBLIC "-//IETF//DTD HTML//EN"> 1 <script src="../../resources/testharness.js"></script>
2 <html> 2 <script src="../../resources/testharnessreport.js"></script>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body> 3 <body>
7 <script src="script-tests/canvas-with-illegal-args.js"></script> 4 <script>
5
6 function CheckPixelRGB(ctx, x, y, rgb)
7 {
8 var imageData = ctx.getImageData(x, y, 1, 1).data;
9 assert_array_equals(imageData.slice(0, 3), rgb);
10 }
11
12 function TestContextScale(scaleWidth, scaleHeight)
13 {
14 ctx = document.createElement('canvas').getContext('2d');
15 ctx.scale(scaleWidth, scaleHeight);
16 ctx.fillStyle = 'green';
17 ctx.fillRect(0, 0, 100, 100);
18 CheckPixelRGB(ctx, 50, 50, [0, 128, 0]);
19 }
20
21 function TestContextTranslate(scaleWidth, scaleHeight)
22 {
23 ctx = document.createElement('canvas').getContext('2d');
24 ctx.translate(scaleWidth, scaleHeight);
25 ctx.fillStyle = 'green';
26 ctx.fillRect(0, 0, 100, 100);
27 CheckPixelRGB(ctx, 50, 50, [0, 128, 0]);
28 }
29
30 function TestContextRotate(rotation)
31 {
32 ctx = document.createElement('canvas').getContext('2d');
33 ctx.rotate(rotation);
34 ctx.fillStyle = 'green';
35 ctx.fillRect(0, 0, 100, 100);
36 CheckPixelRGB(ctx, 50, 50, [0, 128, 0]);
37 }
38
39 var testScenariosScale = [
40 ['Test scale(NaN, 1)', NaN, 1],
41 ['Test scale(1, NaN)', 1, NaN],
42 ['Test scale(Infinity, 1)', Infinity, 1],
43 ['Test scale(1, Infinity)', 1, Infinity],
44 ];
45
46 var testScenariosTranslate = [
47 ['Test translate(NaN, 1)', NaN, 1],
48 ['Test translate(1, NaN)', 1, NaN],
49 ['Test translate(Infinity, 1)', Infinity, 1],
50 ['Test translate(1, Infinity)', 1, Infinity],
51 ];
52
53 var testScenariosRotate = [
54 ['Test rotate(NaN)', NaN],
55 ['Test translate(Infinity)', Infinity],
56 ];
57
58 generate_tests(TestContextScale, testScenariosScale);
59 generate_tests(TestContextTranslate, testScenariosTranslate);
60 generate_tests(TestContextRotate, testScenariosRotate);
61
62 </script>
8 </body> 63 </body>
9 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698