| OLD | NEW |
| 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="https://drafts.fxtf.org/geometry/#DOMMatrix"> | 6 <link rel="help" href="https://drafts.fxtf.org/geometry/#DOMMatrix"> |
| 7 <link rel="help" href="https://drafts.fxtf.org/geometry/#dommatrix-construct
ors"> | 7 <link rel="help" href="https://drafts.fxtf.org/geometry/#dommatrix-construct
ors"> |
| 8 <link rel="help" href="https://drafts.fxtf.org/geometry/#dom-dommatrix-domma
trix"> | 8 <link rel="help" href="https://drafts.fxtf.org/geometry/#dom-dommatrix-domma
trix"> |
| 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 <div id="log"></div> | 14 <div id="log"></div> |
| 15 <script> | 15 <script> |
| 16 var initial = { | 16 var initial = { |
| 17 m11: 1, m21: 0, m31: 0, m41: 0, | 17 m11: 1, m21: 0, m31: 0, m41: 0, |
| 18 m12: 0, m22: 1, m32: 0, m42: 0, | 18 m12: 0, m22: 1, m32: 0, m42: 0, |
| 19 m13: 0, m23: 0, m33: 1, m43: 0, | 19 m13: 0, m23: 0, m33: 1, m43: 0, |
| 20 m14: 0, m24: 0, m34: 0, m44: 1, | 20 m14: 0, m24: 0, m34: 0, m44: 1, |
| 21 is2D: true, | 21 is2D: true, |
| 22 isIdentity: true | 22 isIdentity: true |
| 23 }; | 23 }; |
| 24 var scaleTranslate2D = { | 24 var scaleTranslate2D = { |
| 25 m11: 2, m21: 0, m31: 0, m41: 10, | 25 m11: 2, m21: 0, m31: 0, m41: 10, |
| 26 m12: 0, m22: 2, m32: 0, m42: 10, | 26 m12: 0, m22: 2, m32: 0, m42: 10, |
| 27 m13: 0, m23: 0, m33: 1, m43: 0, | 27 m13: 0, m23: 0, m33: 1, m43: 0, |
| 28 m14: 0, m24: 0, m34: 0, m44: 1, | 28 m14: 0, m24: 0, m34: 0, m44: 1, |
| 29 is2D: false, | 29 is2D: true, |
| 30 isIdentity: false | 30 isIdentity: false |
| 31 }; | 31 }; |
| 32 ["DOMMatrix", "DOMMatrixReadOnly"].forEach(function(constr) { | 32 ["DOMMatrix", "DOMMatrixReadOnly"].forEach(function(constr) { |
| 33 test(function() { | 33 test(function() { |
| 34 checkDOMMatrix(new self[constr](), initial); | 34 checkDOMMatrix(new self[constr](), initial); |
| 35 }, `new ${constr}()`); | 35 }, `new ${constr}()`); |
| 36 | 36 |
| 37 test(function() { | 37 test(function() { |
| 38 checkDOMMatrix(new self[constr](undefined), initial); | 38 checkDOMMatrix(new self[constr](undefined), initial); |
| 39 }, `new ${constr}(undefined)`); | 39 }, `new ${constr}(undefined)`); |
| 40 | 40 |
| 41 test(function() { | 41 test(function() { |
| 42 checkDOMMatrix(new self[constr](new self[constr]()), initial); | 42 checkDOMMatrix(new self[constr](new self[constr]()), initial); |
| 43 }, `new ${constr}(new ${constr}())`); | 43 }, `new ${constr}(new ${constr}())`); |
| 44 | 44 |
| 45 ['none', | 45 ['none', |
| 46 ' none', | 46 ' none', |
| 47 'none ', | 47 'none ', |
| 48 'NONE', | 48 'NONE', |
| 49 'none/**/', | 49 'none/**/', |
| 50 '/**/none', | 50 '/**/none', |
| 51 '', | 51 '', |
| 52 ].forEach(function(string) { | 52 ].forEach(function(string) { |
| 53 test(function() { | 53 test(function() { |
| 54 checkDOMMatrix(new self[constr](string), initial); | 54 checkDOMMatrix(new self[constr](string), initial); |
| 55 }, `new ${constr}(${format_value(string)})`); | 55 }, `new ${constr}(${format_value(string)})`); |
| 56 }); | 56 }); |
| 57 | 57 |
| 58 test(function() { | 58 test(function() { |
| 59 var float32Array = new Float32Array( | 59 var float32Array = new Float32Array([ |
| 60 2.0, 0.0, 0.0, 0.0, | 60 2.0, 0.0, 0.0, 0.0, |
| 61 0.0, 2.0, 0.0, 0.0, | 61 0.0, 2.0, 0.0, 0.0, |
| 62 0.0, 0.0, 1.0, 0.0, | 62 0.0, 0.0, 1.0, 0.0, |
| 63 10.0, 10.0, 0.0, 1.0); | 63 10.0, 10.0, 0.0, 1.0]); |
| 64 checkDOMMatrix(new self[constr](float32Array), scaleTranslate2D,
false); | 64 checkDOMMatrix(new self[constr](float32Array), scaleTranslate2D,
false); |
| 65 }, `new ${constr}(float32Array) 16 elements`); | 65 }, `new ${constr}(float32Array) 16 elements`); |
| 66 | 66 |
| 67 test(function() { | 67 test(function() { |
| 68 var float32Array = new Float32Array(2.0, 0.0, 0.0, 2.0, 10.0, 10
.0); | 68 var float32Array = new Float32Array([2.0, 0.0, 0.0, 2.0, 10.0, 1
0.0]); |
| 69 checkDOMMatrix(new self[constr](float32Array), scaleTranslate2D)
; | 69 checkDOMMatrix(new self[constr](float32Array), scaleTranslate2D)
; |
| 70 }, `new ${constr}(float32Array) 6 elements`); | 70 }, `new ${constr}(float32Array) 6 elements`); |
| 71 | 71 |
| 72 test(function() { | 72 test(function() { |
| 73 var float64Array = new Float64Array([ | 73 var float64Array = new Float64Array([ |
| 74 2.0, 0.0, 0.0, 0.0, | 74 2.0, 0.0, 0.0, 0.0, |
| 75 0.0, 2.0, 0.0, 0.0, | 75 0.0, 2.0, 0.0, 0.0, |
| 76 0.0, 0.0, 1.0, 0.0, | 76 0.0, 0.0, 1.0, 0.0, |
| 77 10.0, 10.0, 0.0, 1.0]); | 77 10.0, 10.0, 0.0, 1.0]); |
| 78 checkDOMMatrix(new self[constr](float64Array), scaleTranslate2D,
false); | 78 checkDOMMatrix(new self[constr](float64Array), scaleTranslate2D,
false); |
| 79 }, `new ${constr}(float64Array) 16 elements`); | 79 }, `new ${constr}(float64Array) 16 elements`); |
| 80 | 80 |
| 81 test(function() { | 81 test(function() { |
| 82 var float64Array = new Float64Array(2.0, 0.0, 0.0, 2.0, 10.0, 10
.0); | 82 var float64Array = new Float64Array([2.0, 0.0, 0.0, 2.0, 10.0, 1
0.0]); |
| 83 checkDOMMatrix(new self[constr](float64Array), scaleTranslate2D)
; | 83 checkDOMMatrix(new self[constr](float64Array), scaleTranslate2D)
; |
| 84 }, `new ${constr}((float64Array) 6 elements`); | 84 }, `new ${constr}((float64Array) 6 elements`); |
| 85 | 85 |
| 86 [ | 86 [ |
| 87 [2.0, 0.0, 0.0, 0.0, | 87 [2.0, 0.0, 0.0, 0.0, |
| 88 0.0, 2.0, 0.0, 0.0, | 88 0.0, 2.0, 0.0, 0.0, |
| 89 0.0, 0.0, 1.0, 0.0, | 89 0.0, 0.0, 1.0, 0.0, |
| 90 10.0, 10.0, 0.0, 1.0], | 90 10.0, 10.0, 0.0, 1.0], |
| 91 [2.0, 0.0, 0.0, 2.0, 10.0, 10.0], | 91 [2.0, 0.0, 0.0, 2.0, 10.0, 10.0], |
| 92 ].forEach(function(sequence) { | 92 ].forEach(function(sequence) { |
| 93 test(function() { | 93 test(function() { |
| 94 checkDOMMatrix(new self[constr](sequence), scaleTranslate2D,
false); | 94 checkDOMMatrix(new self[constr](sequence), scaleTranslate2D, |
| 95 sequence.length == 6); |
| 95 }, `new ${constr}(sequence) ${sequence.length} elements`); | 96 }, `new ${constr}(sequence) ${sequence.length} elements`); |
| 96 }); | 97 }); |
| 97 | 98 |
| 98 ['scale(2) translateX(5px) translateY(5px)', | 99 ['scale(2) translateX(5px) translateY(5px)', |
| 99 'scale(2 2) translateX(5) translateY(5)', | 100 'scale(2 2) translateX(5) translateY(5)', |
| 100 'scale(2, 2), translateX(5) ,translateY(5)', | 101 'scale(2, 2), translateX(5) ,translateY(5)', |
| 101 ].forEach(function(string) { | 102 ].forEach(function(string) { |
| 102 test(function() { | 103 test(function() { |
| 103 checkDOMMatrix(new self[constr](string), scaleTranslate2D); | 104 checkDOMMatrix(new self[constr](string), scaleTranslate2D); |
| 104 }, `new ${constr}(${format_value(string)})`); | 105 }, `new ${constr}(${format_value(string)})`); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 [], // 0 elements | 185 [], // 0 elements |
| 185 ].forEach(function(sequence) { | 186 ].forEach(function(sequence) { |
| 186 test(function() { | 187 test(function() { |
| 187 assert_throws(new TypeError(), function() { new self[constr]
(sequence); }); | 188 assert_throws(new TypeError(), function() { new self[constr]
(sequence); }); |
| 188 }, `new ${constr}(sequence) ${sequence.length} elements`); | 189 }, `new ${constr}(sequence) ${sequence.length} elements`); |
| 189 }); | 190 }); |
| 190 }); | 191 }); |
| 191 </script> | 192 </script> |
| 192 </body> | 193 </body> |
| 193 </html> | 194 </html> |
| OLD | NEW |