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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/css/geometry-1/DOMMatrix-001.html

Issue 2859293002: Use union instead of overload fo DOMMatrix/DOMMatrixReadOnly (Closed)
Patch Set: x Created 3 years, 7 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/external/wpt/css/geometry-1/DOMMatrix-001-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> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Geometry Interfaces: DOMMatrix and DOMMatrixReadOnly constructors</ti tle> 4 <title>Geometry Interfaces: DOMMatrix and DOMMatrixReadOnly constructors</ti tle>
5 <link rel="author" title="Dirk Schulze" href="mailto:dschulze@adobe.com" /> 5 <link rel="author" title="Dirk Schulze" href="mailto:dschulze@adobe.com" />
6 <link rel="help" href="http://www.w3.org/TR/geometry-1/#DOMMatrix"> 6 <link rel="help" href="http://www.w3.org/TR/geometry-1/#DOMMatrix">
7 <link rel="help" href="http://www.w3.org/TR/geometry-1/#dommatrix-constructo rs"> 7 <link rel="help" href="http://www.w3.org/TR/geometry-1/#dommatrix-constructo rs">
8 <link rel="help" href="http://www.w3.org/TR/geometry-1/#dom-dommatrix-dommat rix"> 8 <link rel="help" href="http://www.w3.org/TR/geometry-1/#dom-dommatrix-dommat rix">
9 <script src="support/dommatrix-test-util.js"></script> 9 <script src="support/dommatrix-test-util.js"></script>
10 <script src="/resources/testharness.js"></script> 10 <script src="/resources/testharness.js"></script>
11 <script src="/resources/testharnessreport.js"></script> 11 <script src="/resources/testharnessreport.js"></script>
12 </head> 12 </head>
13 <body> 13 <body>
14 <p>Test DOMMatrix and DOMMatrixReadOnly contructors</p> 14 <p>Test DOMMatrix and DOMMatrixReadOnly contructors</p>
15 <div id="log"></div> 15 <div id="log"></div>
16 <script> 16 <script>
17 initial = { 17 initial = {
18 m11: 1, m21: 0, m31: 0, m41: 0, 18 m11: 1, m21: 0, m31: 0, m41: 0,
19 m12: 0, m22: 1, m32: 0, m42: 0, 19 m12: 0, m22: 1, m32: 0, m42: 0,
20 m13: 0, m23: 0, m33: 1, m43: 0, 20 m13: 0, m23: 0, m33: 1, m43: 0,
21 m14: 0, m24: 0, m34: 0, m44: 1, 21 m14: 0, m24: 0, m34: 0, m44: 1,
22 is2D: true, 22 is2D: true,
23 isIdentity: true 23 isIdentity: true
24 }; 24 };
25 scaleTranslate2D = { 25 scaleTranslate2D = {
26 m11: 2, m21: 0, m31: 0, m41: 10, 26 m11: 2, m21: 0, m31: 0, m41: 10,
27 m12: 0, m22: 2, m32: 0, m42: 10, 27 m12: 0, m22: 2, m32: 0, m42: 10,
28 m13: 0, m23: 0, m33: 1, m43: 0, 28 m13: 0, m23: 0, m33: 1, m43: 0,
29 m14: 0, m24: 0, m34: 0, m44: 1, 29 m14: 0, m24: 0, m34: 0, m44: 1,
30 is2D: false, 30 is2D: true,
31 isIdentity: false 31 isIdentity: false
32 }; 32 };
33 33
34 test(function() { 34 test(function() {
35 checkDOMMatrix(new DOMMatrix(), initial); 35 checkDOMMatrix(new DOMMatrix(), initial);
36 },'testConstructor0'); 36 },'testConstructor0');
37 test(function() { 37 test(function() {
38 checkDOMMatrix(new DOMMatrix(new DOMMatrix()), initial); 38 checkDOMMatrix(new DOMMatrix(new DOMMatrix()), initial);
39 },'testConstructor1'); 39 },'testConstructor1');
40 test(function() { 40 test(function() {
41 var float32Array = new Float32Array( 41 var float32Array = new Float32Array([
42 2.0, 0.0, 0.0, 0.0, 42 2.0, 0.0, 0.0, 0.0,
43 0.0, 2.0, 0.0, 0.0, 43 0.0, 2.0, 0.0, 0.0,
44 0.0, 0.0, 1.0, 0.0, 44 0.0, 0.0, 1.0, 0.0,
45 10.0, 10.0, 0.0, 1.0); 45 10.0, 10.0, 0.0, 1.0]);
46 checkDOMMatrix(new DOMMatrix(float32Array), scaleTranslate2D, false) ; 46 checkDOMMatrix(new DOMMatrix(float32Array), scaleTranslate2D, false) ;
47 },'testConstructor2'); 47 },'testConstructor2');
48 test(function() { 48 test(function() {
49 var float32Array = new Float32Array(2.0, 0.0, 0.0, 2.0, 10.0, 10.0); 49 var float32Array = new Float32Array([2.0, 0.0, 0.0, 2.0, 10.0, 10.0] );
50 checkDOMMatrix(new DOMMatrix(float32Array), scaleTranslate2D); 50 checkDOMMatrix(new DOMMatrix(float32Array), scaleTranslate2D);
51 },'testConstructor3'); 51 },'testConstructor3');
52 test(function() { 52 test(function() {
53 var float64Array = new Float64Array([ 53 var float64Array = new Float64Array([
54 2.0, 0.0, 0.0, 0.0, 54 2.0, 0.0, 0.0, 0.0,
55 0.0, 2.0, 0.0, 0.0, 55 0.0, 2.0, 0.0, 0.0,
56 0.0, 0.0, 1.0, 0.0, 56 0.0, 0.0, 1.0, 0.0,
57 10.0, 10.0, 0.0, 1.0]); 57 10.0, 10.0, 0.0, 1.0]);
58 checkDOMMatrix(new DOMMatrix(float64Array), scaleTranslate2D, false) ; 58 checkDOMMatrix(new DOMMatrix(float64Array), scaleTranslate2D, false) ;
59 },'testConstructor4'); 59 },'testConstructor4');
60 test(function() { 60 test(function() {
61 var float64Array = new Float64Array(2.0, 0.0, 0.0, 2.0, 10.0, 10.0); 61 var float64Array = new Float64Array([2.0, 0.0, 0.0, 2.0, 10.0, 10.0] );
62 checkDOMMatrix(new DOMMatrix(float64Array), scaleTranslate2D); 62 checkDOMMatrix(new DOMMatrix(float64Array), scaleTranslate2D);
63 },'testConstructor5'); 63 },'testConstructor5');
64 test(function() { 64 test(function() {
65 var sequence = [ 65 var sequence = [
66 2.0, 0.0, 0.0, 0.0, 66 2.0, 0.0, 0.0, 0.0,
67 0.0, 2.0, 0.0, 0.0, 67 0.0, 2.0, 0.0, 0.0,
68 0.0, 0.0, 1.0, 0.0, 68 0.0, 0.0, 1.0, 0.0,
69 10.0, 10.0, 0.0, 1.0]; 69 10.0, 10.0, 0.0, 1.0];
70 checkDOMMatrix(new DOMMatrix(sequence), scaleTranslate2D, false); 70 checkDOMMatrix(new DOMMatrix(sequence), scaleTranslate2D, false);
71 },'testConstructor6'); 71 },'testConstructor6');
72 test(function() { 72 test(function() {
73 var sequence = [ 2.0, 0.0, 0.0, 2.0, 10.0, 10.0]; 73 var sequence = [ 2.0, 0.0, 0.0, 2.0, 10.0, 10.0];
74 checkDOMMatrix(new DOMMatrix(float64Array), scaleTranslate2D); 74 checkDOMMatrix(new DOMMatrix(sequence), scaleTranslate2D);
75 },'testConstructor7'); 75 },'testConstructor7');
76 test(function() { 76 test(function() {
77 var string = 'scale(2) translateX(5px) translateY(5px)'; 77 var string = 'scale(2) translateX(5px) translateY(5px)';
78 checkDOMMatrix(new DOMMatrix(string), scaleTranslate2D); 78 checkDOMMatrix(new DOMMatrix(string), scaleTranslate2D);
79 },'testConstructor8'); 79 },'testConstructor8');
80 test(function() { 80 test(function() {
81 var string = 'scale(2 2) translateX(5) translateY(5)'; 81 var string = 'scale(2, 2) translateX(5px) translateY(5px)';
Justin Novosad 2017/05/08 14:50:39 It seems the old version of the test was quite del
fserb 2017/05/08 15:31:19 It seems even the draft CSS transform doesn't acce
82 checkDOMMatrix(new DOMMatrix(string), scaleTranslate2D); 82 checkDOMMatrix(new DOMMatrix(string), scaleTranslate2D);
83 },'testConstructor9'); 83 },'testConstructor9');
84 test(function() { 84 test(function() {
85 var string = 'scale(2, 2), translateX(5) ,translateY(5)';
86 checkDOMMatrix(new DOMMatrix(string), scaleTranslate2D);
87 },'testConstructor10');
88 test(function() {
89 assert_throws('SyntaxError', function() { new DOMMatrix('translateX (5px)'); }); 85 assert_throws('SyntaxError', function() { new DOMMatrix('translateX (5px)'); });
90 assert_throws('SyntaxError', function() { new DOMMatrix('scale(2)tra nslateX(5px)'); });
Justin Novosad 2017/05/08 14:50:39 Why is this removed? Are you sure this case was no
fserb 2017/05/08 15:31:18 No spaces between function and (. But the space be
91 assert_throws('SyntaxError', function() { new DOMMatrix('translateX( 5em)'); }); 86 assert_throws('SyntaxError', function() { new DOMMatrix('translateX( 5em)'); });
92 assert_throws('SyntaxError', function() { new DOMMatrix('translateX( 5ex)'); }); 87 assert_throws('SyntaxError', function() { new DOMMatrix('translateX( 5ex)'); });
93 assert_throws('SyntaxError', function() { new DOMMatrix('translateX( 5ch)'); }); 88 assert_throws('SyntaxError', function() { new DOMMatrix('translateX( 5ch)'); });
94 assert_throws('SyntaxError', function() { new DOMMatrix('translateX( 5rem)'); }); 89 assert_throws('SyntaxError', function() { new DOMMatrix('translateX( 5rem)'); });
95 assert_throws('SyntaxError', function() { new DOMMatrix('translateX( 5vw)'); }); 90 assert_throws('SyntaxError', function() { new DOMMatrix('translateX( 5vw)'); });
96 assert_throws('SyntaxError', function() { new DOMMatrix('translateX( 5vh)'); }); 91 assert_throws('SyntaxError', function() { new DOMMatrix('translateX( 5vh)'); });
97 assert_throws('SyntaxError', function() { new DOMMatrix('translateX( 5vmin)'); }); 92 assert_throws('SyntaxError', function() { new DOMMatrix('translateX( 5vmin)'); });
98 assert_throws('SyntaxError', function() { new DOMMatrix('translateX( 5vmax)'); }); 93 assert_throws('SyntaxError', function() { new DOMMatrix('translateX( 5vmax)'); });
99 assert_throws('SyntaxError', function() { new DOMMatrix('translateX( 5%)'); }); 94 assert_throws('SyntaxError', function() { new DOMMatrix('translateX( 5%)'); });
100 },'testConstructor11'); 95 },'testConstructor10');
101 test(function() { 96 test(function() {
102 var sequence = [ 97 var sequence = [
103 2.0, 1.0, 0.0, 0.0, 98 2.0, 1.0, 0.0, 0.0,
104 1.0, 2.0, 0.0, 0.0, 99 1.0, 2.0, 0.0, 0.0,
105 0.0, 0.0, 1.0, 0.0, 100 0.0, 0.0, 1.0, 0.0,
106 10.0, 10.0, 0.0, 1.0]; 101 10.0, 10.0, 0.0, 1.0];
107 checkDOMMatrix(new DOMMatrix(sequence), { 102 checkDOMMatrix(new DOMMatrix(sequence), {
108 m11: 2, m21: 1, m31: 0, m41: 10, 103 m11: 2, m21: 1, m31: 0, m41: 10,
109 m12: 1, m22: 2, m32: 0, m42: 10, 104 m12: 1, m22: 2, m32: 0, m42: 10,
110 m13: 0, m23: 0, m33: 1, m43: 0, 105 m13: 0, m23: 0, m33: 1, m43: 0,
111 m14: 0, m24: 0, m34: 0, m44: 1, 106 m14: 0, m24: 0, m34: 0, m44: 1,
112 is2D: false, 107 is2D: false,
113 isIdentity: false 108 isIdentity: false
114 }); 109 });
115 },'testConstructor12'); 110 },'testConstructor11');
116 test(function() { 111 test(function() {
117 var matrix = new DOMMatrix([ 112 var matrix = new DOMMatrix([
118 2.0, 1.0, 0.0, 0.0, 113 2.0, 1.0, 0.0, 0.0,
119 1.0, 2.0, 0.0, 0.0, 114 1.0, 2.0, 0.0, 0.0,
120 0.0, 0.0, 1.0, 0.0, 115 0.0, 0.0, 1.0, 0.0,
121 10.0, 10.0, 0.0, 1.0]); 116 10.0, 10.0, 0.0, 1.0]);
122 checkDOMMatrix(new DOMMatrix(matrix), { 117 checkDOMMatrix(new DOMMatrix(matrix), {
123 m11: 2, m21: 1, m31: 0, m41: 10, 118 m11: 2, m21: 1, m31: 0, m41: 10,
124 m12: 1, m22: 2, m32: 0, m42: 10, 119 m12: 1, m22: 2, m32: 0, m42: 10,
125 m13: 0, m23: 0, m33: 1, m43: 0, 120 m13: 0, m23: 0, m33: 1, m43: 0,
126 m14: 0, m24: 0, m34: 0, m44: 1, 121 m14: 0, m24: 0, m34: 0, m44: 1,
127 is2D: false, 122 is2D: false,
128 isIdentity: false 123 isIdentity: false
129 }); 124 });
130 },'testConstructor13'); 125 },'testConstructor12');
131 test(function() {
132 assert_throws(new TypeError(), function() { new DOMMatrixReadOnly(); });
Justin Novosad 2017/05/08 14:50:39 Based on my reading of the spec, this call to the
fserb 2017/05/08 15:31:19 This is clearly off. The previous implementation h
133 },'testConstructorIllegal0');
134 test(function() { 126 test(function() {
135 var string = 'scale(2, 2), translateX(5px) translateY(5px)'; 127 var string = 'scale(2, 2), translateX(5px) translateY(5px)';
136 assert_throws(new TypeError(), function() { new DOMMatrixReadOnly(st ring); }); 128 assert_throws(new SyntaxError(), function() { new DOMMatrixReadOnly( string); });
Justin Novosad 2017/05/08 14:50:39 I agree with this correction under the assumption
137 },'testConstructorIllegal1'); 129 },'testConstructorIllegal0');
138 test(function() { 130 test(function() {
139 var sequence = [ 2.0, 0.0, 0.0, 2.0, 10.0]; 131 var sequence = [ 2.0, 0.0, 0.0, 2.0, 10.0];
140 assert_throws(new TypeError(), function() { new DOMMatrixReadOnly(se quence); }); 132 assert_throws(new TypeError(), function() { new DOMMatrixReadOnly(se quence); });
141 },'testConstructorIllegal2'); 133 },'testConstructorIllegal1');
142 134
143 </script> 135 </script>
144 </body> 136 </body>
145 </html> 137 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/external/wpt/css/geometry-1/DOMMatrix-001-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698