OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
4 <script src="./resources/geometry-interfaces-test-helpers.js"></script> | 4 <script src="./resources/geometry-interfaces-test-helpers.js"></script> |
5 <script> | 5 <script> |
6 | 6 |
7 var matrix2d = [5, 4, 11, 34, 55, 11]; | 7 var matrix2d = [5, 4, 11, 34, 55, 11]; |
8 var matrix3d = [5, 11, 55, 77, 44, 33, 55, 75, 88, 99, 12, 43, 65, 36, 85, 25]; | 8 var matrix3d = [5, 11, 55, 77, 44, 33, 55, 75, 88, 99, 12, 43, 65, 36, 85, 25]; |
9 | 9 |
10 test(() => { | 10 test(() => { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 assert_true(actualMatrix1.is2D); | 208 assert_true(actualMatrix1.is2D); |
209 actualMatrix2.setMatrixValue("matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0) translate(4
4px, 55px) skewX(30deg)"); | 209 actualMatrix2.setMatrixValue("matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0) translate(4
4px, 55px) skewX(30deg)"); |
210 assert_true(actualMatrix2.is2D); | 210 assert_true(actualMatrix2.is2D); |
211 expectedMatrix.multiplySelf(new DOMMatrix([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])) | 211 expectedMatrix.multiplySelf(new DOMMatrix([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])) |
212 expectedMatrix.translateSelf(44, 55) | 212 expectedMatrix.translateSelf(44, 55) |
213 expectedMatrix.skewXSelf(30); | 213 expectedMatrix.skewXSelf(30); |
214 assert_matrix_almost_equals(actualMatrix1, expectedMatrix); | 214 assert_matrix_almost_equals(actualMatrix1, expectedMatrix); |
215 assert_matrix_almost_equals(actualMatrix2, expectedMatrix); | 215 assert_matrix_almost_equals(actualMatrix2, expectedMatrix); |
216 }, "DOMMatrix setMatrix(multiple value)"); | 216 }, "DOMMatrix setMatrix(multiple value)"); |
217 | 217 |
218 // TODO(hs1217.lee) : calc() function take only absolute unit. should be pass th
is test. | 218 test(() => { |
219 // but calc() function is not supported not yet. | 219 var actualMatrix1 = new DOMMatrix(matrix2d); |
220 // refer to hasRelativeLengths() in TransformBuilder.cpp | 220 var actualMatrix2 = new DOMMatrix(matrix3d); |
221 // test(() => { | 221 var expectedMatrix = new DOMMatrix(); |
222 // var actualMatrix1 = new DOMMatrix(matrix2d); | 222 actualMatrix1.setMatrixValue("translateX(calc(10px + 1px))"); |
223 // var actualMatrix2 = new DOMMatrix(matrix3d); | 223 assert_true(actualMatrix1.is2D); |
224 // var expectedMatrix = new DOMMatrix(); | 224 actualMatrix2.setMatrixValue("translateX(calc(10px + 1px))"); |
225 // actualMatrix1.setMatrixValue("translateX(calc(10px + 1px))"); | 225 assert_true(actualMatrix2.is2D); |
226 // assert_true(actualMatrix1.is2D); | 226 expectedMatrix.translateSelf(11, 0) |
227 // actualMatrix2.setMatrixValue("translateX(calc(10px + 1px))"); | 227 assert_matrix_almost_equals(actualMatrix1, expectedMatrix); |
228 // assert_true(actualMatrix2.is2D); | 228 assert_matrix_almost_equals(actualMatrix2, expectedMatrix); |
229 // expectedMatrix.translateSelf(11, 0) | 229 }, "DOMMatrix setMatrix() with calc function"); |
230 // assert_matrix_almost_equals(actualMatrix1, expectedMatrix); | |
231 // assert_matrix_almost_equals(actualMatrix2, expectedMatrix); | |
232 // }, "DOMMatrix setMatrix(multiple value)"); | |
233 | 230 |
234 test(() => { | 231 test(() => { |
235 | 232 |
236 var actualMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 233 var actualMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
237 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 234 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
238 | 235 |
239 assert_throws(new SyntaxError(), () => { | 236 assert_throws(new SyntaxError(), () => { |
240 actualMatrix.setMatrixValue("initial"); | 237 actualMatrix.setMatrixValue("initial"); |
241 }, "CSS-wide keywords are disallowed"); | 238 }, "CSS-wide keywords are disallowed"); |
242 | 239 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 }, "using relative units should throw a SyntaxError"); | 274 }, "using relative units should throw a SyntaxError"); |
278 | 275 |
279 assert_throws(new SyntaxError(), () => { | 276 assert_throws(new SyntaxError(), () => { |
280 actualMatrix.setMatrixValue("translateX(10vmax)"); | 277 actualMatrix.setMatrixValue("translateX(10vmax)"); |
281 }, "using relative units should throw a SyntaxError"); | 278 }, "using relative units should throw a SyntaxError"); |
282 | 279 |
283 assert_throws(new SyntaxError(), () => { | 280 assert_throws(new SyntaxError(), () => { |
284 actualMatrix.setMatrixValue("translateX(calc(10px + 1em))"); | 281 actualMatrix.setMatrixValue("translateX(calc(10px + 1em))"); |
285 }, "using relative units should throw a SyntaxError"); | 282 }, "using relative units should throw a SyntaxError"); |
286 | 283 |
| 284 assert_throws(new SyntaxError(), () => { |
| 285 actualMatrix.setMatrixValue("translateX(calc(10px + 1%))"); |
| 286 }, "using relative units should throw a SyntaxError"); |
| 287 |
| 288 assert_throws(new SyntaxError(), () => { |
| 289 actualMatrix.setMatrixValue("translateX(calc(10vw + 1%))"); |
| 290 }, "using relative units should throw a SyntaxError"); |
| 291 |
287 //actualMatrix should be not changed. | 292 //actualMatrix should be not changed. |
288 assert_true(actualMatrix.is2D); | 293 assert_true(actualMatrix.is2D); |
289 assert_matrix_almost_equals(actualMatrix, expectedMatrix); | 294 assert_matrix_almost_equals(actualMatrix, expectedMatrix); |
290 | 295 |
291 }, "DOMMatrix.setMatrix(): Exception test"); | 296 }, "DOMMatrix.setMatrix(): Exception test"); |
292 | 297 |
293 </script> | 298 </script> |
OLD | NEW |