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

Side by Side Diff: third_party/WebKit/LayoutTests/svg/dom/SVGTransform.html

Issue 2362653002: Convert LayoutTests/svg/dom/SVGTransform*.html js-tests.js to testharness.js based tests (Closed)
Patch Set: Align with review comments Created 4 years, 2 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/svg/dom/SVGTransform-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML>
2 <html> 2 <title>SVGTransform interface</title>
3 <head> 3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/testharnessreport.js"></script>
5 </head> 5 <script>
6 <body> 6 test(function() {
7 <p id="description"></p> 7 // This test checks the SVGTransform API.
8 <div id="console"></div> 8
9 <script src="script-tests/SVGTransform.js"></script> 9 var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg") ;
10 </body> 10 var transform = svgElement.createSVGTransform();
11 </html> 11
12 // Check initial transform values.
13 assert_equals(transform.type, SVGTransform.SVG_TRANSFORM_MATRIX);
14 assert_equals(transform.angle, 0);
15 assert_equals(transform.matrix.a, 1);
16 assert_equals(transform.matrix.b, 0);
17 assert_equals(transform.matrix.c, 0);
18 assert_equals(transform.matrix.d, 1);
19 assert_equals(transform.matrix.e, 0);
20 assert_equals(transform.matrix.f, 0);
21
22 // Change to skewX transformation.
23 transform.setSkewX(45);
24 assert_equals(transform.type, SVGTransform.SVG_TRANSFORM_SKEWX);
25 assert_equals(transform.angle, 45);
26 assert_equals(transform.matrix.a, 1);
27 assert_equals(transform.matrix.b, 0);
28 assert_equals(transform.matrix.c.toFixed(1), "1.0");
29 assert_equals(transform.matrix.d, 1);
30 assert_equals(transform.matrix.e, 0);
31 assert_equals(transform.matrix.f, 0);
32
33 // Changing matrix.e to 100, should reset transformation type to MATRIX, and a ngle should be 0.
34 transform.matrix.e = 100;
35 assert_equals(transform.matrix.e, 100);
36 assert_equals(transform.type, SVGTransform.SVG_TRANSFORM_MATRIX);
37 assert_equals(transform.angle, 0);
38 assert_equals(transform.matrix.a, 1);
39 assert_equals(transform.matrix.b, 0);
40 assert_equals(transform.matrix.c.toFixed(1), "1.0");
41 assert_equals(transform.matrix.d, 1);
42 assert_equals(transform.matrix.e, 100);
43 assert_equals(transform.matrix.f, 0);
44
45 // Now revert to initial matrix.
46 transform.matrix.c = 0;
47 transform.matrix.e = 0;
48 assert_equals(transform.matrix.c, 0);
49 assert_equals(transform.matrix.e, 0);
50 assert_equals(transform.type, SVGTransform.SVG_TRANSFORM_MATRIX);
51 assert_equals(transform.angle, 0);
52 assert_equals(transform.matrix.a, 1);
53 assert_equals(transform.matrix.b, 0);
54 assert_equals(transform.matrix.c, 0);
55 assert_equals(transform.matrix.d, 1);
56 assert_equals(transform.matrix.e, 0);
57 assert_equals(transform.matrix.f, 0);
58
59 // Check passing invalid arguments to 'setMatrix'.
60 assert_throws(new TypeError(), function() { transform.setMatrix(); });
61 assert_throws(new TypeError(), function() { transform.setMatrix(transform); }) ;
62 assert_throws(new TypeError(), function() { transform.setMatrix(svgElement); } );
63 assert_throws(new TypeError(), function() { transform.setMatrix('aString'); }) ;
64 assert_throws(new TypeError(), function() { transform.setMatrix(1); });
65 assert_throws(new TypeError(), function() { transform.setMatrix(false); });
66
67 // Check passing invalid arguments to 'setTranslate'.
68 assert_throws(new TypeError(), function() { transform.setTranslate(); });
69 assert_throws(new TypeError(), function() { transform.setTranslate(transform); });
70 assert_throws(new TypeError(), function() { transform.setTranslate(svgElement) ; });
71 assert_throws(new TypeError(), function() { transform.setTranslate('aString'); });
72 assert_throws(new TypeError(), function() { transform.setTranslate(1, transfor m); });
73 assert_throws(new TypeError(), function() { transform.setTranslate(1, svgEleme nt); });
74 assert_throws(new TypeError(), function() { transform.setTranslate(1, 'aString '); });
75 assert_throws(new TypeError(), function() { transform.setTranslate(transform, 1); });
76 assert_throws(new TypeError(), function() { transform.setTranslate(svgElement, 1); });
77 assert_throws(new TypeError(), function() { transform.setTranslate('aString', 1); });
78 assert_throws(new TypeError(), function() { transform.setTranslate(transform, transform); });
79 assert_throws(new TypeError(), function() { transform.setTranslate(svgElement, svgElement); });
80 assert_throws(new TypeError(), function() { transform.setTranslate('aString', 'aString'); });
81 assert_throws(new TypeError(), function() { transform.setTranslate(NaN, 1); }) ;
82 assert_throws(new TypeError(), function() { transform.setTranslate(Infinity, 1 ); });
83 assert_throws(new TypeError(), function() { transform.setTranslate(1, NaN); }) ;
84 assert_throws(new TypeError(), function() { transform.setTranslate(1, Infinity ); });
85
86 // Check passing invalid arguments to 'setScale'.
87 assert_throws(new TypeError(), function() { transform.setScale(); });
88 assert_throws(new TypeError(), function() { transform.setScale(transform); });
89 assert_throws(new TypeError(), function() { transform.setScale(svgElement); }) ;
90 assert_throws(new TypeError(), function() { transform.setScale('aString'); });
91 assert_throws(new TypeError(), function() { transform.setScale(1, transform); });
92 assert_throws(new TypeError(), function() { transform.setScale(1, svgElement); });
93 assert_throws(new TypeError(), function() { transform.setScale(1, 'aString'); });
94 assert_throws(new TypeError(), function() { transform.setScale(transform, 1); });
95 assert_throws(new TypeError(), function() { transform.setScale(svgElement, 1); });
96 assert_throws(new TypeError(), function() { transform.setScale('aString', 1); });
97 assert_throws(new TypeError(), function() { transform.setScale(transform, tran sform); });
98 assert_throws(new TypeError(), function() { transform.setScale(svgElement, svg Element); });
99 assert_throws(new TypeError(), function() { transform.setScale('aString', 'aSt ring'); });
100 assert_throws(new TypeError(), function() { transform.setScale(NaN, 1); });
101 assert_throws(new TypeError(), function() { transform.setScale(Infinity, 1); } );
102 assert_throws(new TypeError(), function() { transform.setScale(1, NaN); });
103 assert_throws(new TypeError(), function() { transform.setScale(1, Infinity); } );
104
105 // Check passing invalid arguments to 'setRotate'.
106 assert_throws(new TypeError(), function() { transform.setRotate(); });
107 assert_throws(new TypeError(), function() { transform.setRotate(transform); }) ;
108 assert_throws(new TypeError(), function() { transform.setRotate(svgElement); } );
109 assert_throws(new TypeError(), function() { transform.setRotate('aString'); }) ;
110 assert_throws(new TypeError(), function() { transform.setRotate(1, transform); });
111 assert_throws(new TypeError(), function() { transform.setRotate(1, svgElement) ; });
112 assert_throws(new TypeError(), function() { transform.setRotate(1, 'aString'); });
113 assert_throws(new TypeError(), function() { transform.setRotate(1, 1, transfor m); });
114 assert_throws(new TypeError(), function() { transform.setRotate(1, 1, svgEleme nt); });
115 assert_throws(new TypeError(), function() { transform.setRotate(1, 1, 'aString '); });
116 assert_throws(new TypeError(), function() { transform.setRotate(NaN, 1, 1); }) ;
117 assert_throws(new TypeError(), function() { transform.setRotate(Infinity, 1, 1 ); });
118 assert_throws(new TypeError(), function() { transform.setRotate(1, NaN, 1); }) ;
119 assert_throws(new TypeError(), function() { transform.setRotate(1, Infinity, 1 ); });
120 assert_throws(new TypeError(), function() { transform.setRotate(1, 1, NaN); }) ;
121 assert_throws(new TypeError(), function() { transform.setRotate(1, 1, Infinity ); });
122
123 // Check passing invalid arguments to 'setSkewX'.
124 assert_throws(new TypeError(), function() { transform.setSkewX(); });
125 assert_throws(new TypeError(), function() { transform.setSkewX(transform); });
126 assert_throws(new TypeError(), function() { transform.setSkewX(svgElement); }) ;
127 assert_throws(new TypeError(), function() { transform.setSkewX('aString'); });
128 assert_throws(new TypeError(), function() { transform.setSkewX(NaN); });
129 assert_throws(new TypeError(), function() { transform.setSkewX(Infinity); });
130
131 // Check passing invalid arguments to 'setSkewY'.
132 assert_throws(new TypeError(), function() { transform.setSkewY(); });
133 assert_throws(new TypeError(), function() { transform.setSkewY(transform); });
134 assert_throws(new TypeError(), function() { transform.setSkewY(svgElement); }) ;
135 assert_throws(new TypeError(), function() { transform.setSkewY('aString'); });
136 assert_throws(new TypeError(), function() { transform.setSkewY(NaN); });
137 assert_throws(new TypeError(), function() { transform.setSkewY(Infinity); });
138 });
139 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/svg/dom/SVGTransform-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698