View Javadoc
1   /*
2    * Copyright (c) 2002-2025 Gargoyle Software Inc.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * https://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  package org.htmlunit.javascript.host.dom;
16  
17  import org.htmlunit.WebDriverTestCase;
18  import org.htmlunit.junit.annotation.Alerts;
19  import org.htmlunit.junit.annotation.HtmlUnitNYI;
20  import org.junit.jupiter.api.Test;
21  
22  /**
23   * Tests for {@link DOMMatrixReadOnly}.
24   *
25   * @author Ronald Brill
26   */
27  public class DOMMatrixReadOnlyTest extends WebDriverTestCase {
28  
29      public static final String DUMP_FUNCTION = "function r(num) { return Math.round(num * 1000) / 1000 }\n"
30              + "function dump(m) {\n"
31              + "  log('[' + r(m.a) + ', ' + r(m.b) + ', ' + r(m.c)"
32                          + " + ', ' + r(m.d) + ', ' + r(m.e) + ', ' + r(m.f) + ']');\n"
33              + "  log('1[' + r(m.m11) + ', ' + r(m.m12) + ', ' + r(m.m13) + ', ' + r(m.m14) + ']');\n"
34              + "  log('2[' + r(m.m21) + ', ' + r(m.m22) + ', ' + r(m.m23) + ', ' + r(m.m24) + ']');\n"
35              + "  log('3[' + r(m.m31) + ', ' + r(m.m32) + ', ' + r(m.m33) + ', ' + r(m.m34) + ']');\n"
36              + "  log('4[' + r(m.m41) + ', ' + r(m.m42) + ', ' + r(m.m43) + ', ' + r(m.m44) + ']');\n"
37              + "  log(m.is2D);\n"
38              + "}\n";
39  
40      public static final String DUMP_2D_FUNCTION = "function dump(m) {\n"
41              + "  log('[' + m.a + ', ' + m.b + ', ' + m.c + ', ' + m.d + ', ' + m.e + ', ' + m.f + ']');\n"
42              + "  log(m.is2D);\n"
43              + "}\n";
44  
45      /**
46       * @throws Exception on test failure
47       */
48      @Test
49      @Alerts({"[1, 0, 0, 1, 0, 0]",
50               "1[1, 0, 0, 0]",
51               "2[0, 1, 0, 0]",
52               "3[0, 0, 1, 0]",
53               "4[0, 0, 0, 1]",
54               "true"})
55      public void contructor() throws Exception {
56          final String html = DOCTYPE_HTML
57                  + "<html>\n"
58                  + "<body>\n"
59                  + "<script>\n"
60                  + LOG_TITLE_FUNCTION
61                  + DUMP_FUNCTION
62                  + "let m = new DOMMatrixReadOnly();\n"
63                  + "dump(m);\n"
64                  + "</script>\n"
65                  + "</body></html>";
66  
67          loadPageVerifyTitle2(html);
68      }
69  
70      /**
71       * @throws Exception on test failure
72       */
73      @Test
74      @Alerts({"[6, 5, 4, 3, 2, 1]",
75               "1[6, 5, 0, 0]",
76               "2[4, 3, 0, 0]",
77               "3[0, 0, 1, 0]",
78               "4[2, 1, 0, 1]",
79               "true"})
80      public void contructor6Numbers() throws Exception {
81          final String html = DOCTYPE_HTML
82                  + "<html>\n"
83                  + "<body>\n"
84                  + "<script>\n"
85                  + LOG_TITLE_FUNCTION
86                  + DUMP_FUNCTION
87                  + "let m = new DOMMatrixReadOnly([6, 5, 4, 3, 2, 1]);\n"
88                  + "dump(m);\n"
89                  + "</script>\n"
90                  + "</body></html>";
91  
92          loadPageVerifyTitle2(html);
93      }
94  
95      /**
96       * @throws Exception on test failure
97       */
98      @Test
99      @Alerts({"[6, 1, 0, NaN, 2, NaN]",
100              "true"})
101     @HtmlUnitNYI(CHROME = {"[6, 1, 0, 0, 2, NaN]", "true"},
102             EDGE = {"[6, 1, 0, 0, 2, NaN]", "true"},
103             FF = {"[6, 1, 0, 0, 2, NaN]", "true"},
104             FF_ESR = {"[6, 1, 0, 0, 2, NaN]", "true"})
105     public void contructor6Mixed() throws Exception {
106         final String html = DOCTYPE_HTML
107                 + "<html>\n"
108                 + "<body>\n"
109                 + "<script>\n"
110                 + LOG_TITLE_FUNCTION
111                 + DUMP_2D_FUNCTION
112                 + "let m = new DOMMatrixReadOnly([6, true, null, undefined, '2', 'eins']);\n"
113                 + "dump(m);\n"
114                 + "</script>\n"
115                 + "</body></html>";
116 
117         loadPageVerifyTitle2(html);
118     }
119 
120     /**
121      * @throws Exception on test failure
122      */
123     @Test
124     @Alerts("TypeError")
125     public void contructor5Numbers() throws Exception {
126         final String html = DOCTYPE_HTML
127                 + "<html>\n"
128                 + "<body>\n"
129                 + "<script>\n"
130                 + LOG_TITLE_FUNCTION
131                 + DUMP_FUNCTION
132                 + "try {"
133                 + "  let m = new DOMMatrixReadOnly([5, 4, 3, 2, 1]);\n"
134                 + "  dump(m);\n"
135                 + "} catch(e) { logEx(e); }"
136                 + "</script>\n"
137                 + "</body></html>";
138 
139         loadPageVerifyTitle2(html);
140     }
141 
142     /**
143      * @throws Exception on test failure
144      */
145     @Test
146     @Alerts("TypeError")
147     public void contructor7Numbers() throws Exception {
148         final String html = DOCTYPE_HTML
149                 + "<html>\n"
150                 + "<body>\n"
151                 + "<script>\n"
152                 + LOG_TITLE_FUNCTION
153                 + DUMP_FUNCTION
154                 + "try {"
155                 + "  let m = new DOMMatrixReadOnly([7, 6, 5, 4, 3, 2, 1]);\n"
156                 + "  dump(m);\n"
157                 + "} catch(e) { logEx(e); }"
158                 + "</script>\n"
159                 + "</body></html>";
160 
161         loadPageVerifyTitle2(html);
162     }
163 
164     /**
165      * @throws Exception on test failure
166      */
167     @Test
168     @Alerts({"[16, 15, 12, 11, 4, 3]",
169              "1[16, 15, 14, 13]",
170              "2[12, 11, 10, 9]",
171              "3[8, 7, 6, 5]",
172              "4[4, 3, 2, 1]",
173              "false"})
174     public void contructor16Numbers() throws Exception {
175         final String html = DOCTYPE_HTML
176                 + "<html>\n"
177                 + "<body>\n"
178                 + "<script>\n"
179                 + LOG_TITLE_FUNCTION
180                 + DUMP_FUNCTION
181                 + "let m = new DOMMatrixReadOnly([16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]);\n"
182                 + "dump(m);\n"
183                 + "</script>\n"
184                 + "</body></html>";
185 
186         loadPageVerifyTitle2(html);
187     }
188 
189     /**
190      * @throws Exception on test failure
191      */
192     @Test
193     @Alerts("TypeError")
194     public void contructor15Numbers() throws Exception {
195         final String html = DOCTYPE_HTML
196                 + "<html>\n"
197                 + "<body>\n"
198                 + "<script>\n"
199                 + LOG_TITLE_FUNCTION
200                 + DUMP_FUNCTION
201                 + "try {"
202                 + "  let m = new DOMMatrixReadOnly([15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]);\n"
203                 + "  dump(m);\n"
204                 + "} catch(e) { logEx(e); }"
205                 + "</script>\n"
206                 + "</body></html>";
207 
208         loadPageVerifyTitle2(html);
209     }
210 
211     /**
212      * @throws Exception on test failure
213      */
214     @Test
215     @Alerts("TypeError")
216     public void contructor17Numbers() throws Exception {
217         final String html = DOCTYPE_HTML
218                 + "<html>\n"
219                 + "<body>\n"
220                 + "<script>\n"
221                 + LOG_TITLE_FUNCTION
222                 + DUMP_FUNCTION
223                 + "try {"
224                 + "  let m = new DOMMatrixReadOnly([17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]);\n"
225                 + "  dump(m);\n"
226                 + "} catch(e) { logEx(e); }"
227                 + "</script>\n"
228                 + "</body></html>";
229 
230         loadPageVerifyTitle2(html);
231     }
232 
233     /**
234      * @throws Exception on test failure
235      */
236     @Test
237     @Alerts("SyntaxError/DOMException")
238     public void contructorSingleNumber() throws Exception {
239         final String html = DOCTYPE_HTML
240                 + "<html>\n"
241                 + "<body>\n"
242                 + "<script>\n"
243                 + LOG_TITLE_FUNCTION
244                 + DUMP_FUNCTION
245                 + "try {"
246                 + "  let m = new DOMMatrixReadOnly(7);\n"
247                 + "  dump(m);\n"
248                 + "} catch(e) { logEx(e); }"
249                 + "</script>\n"
250                 + "</body></html>";
251 
252         loadPageVerifyTitle2(html);
253     }
254 
255     /**
256      * @throws Exception on test failure
257      */
258     @Test
259     @Alerts("SyntaxError/DOMException")
260     public void contructorNull() throws Exception {
261         final String html = DOCTYPE_HTML
262                 + "<html>\n"
263                 + "<body>\n"
264                 + "<script>\n"
265                 + LOG_TITLE_FUNCTION
266                 + DUMP_FUNCTION
267                 + "try {"
268                 + "  let m = new DOMMatrixReadOnly(null);\n"
269                 + "  dump(m);\n"
270                 + "} catch(e) { logEx(e); }"
271                 + "</script>\n"
272                 + "</body></html>";
273 
274         loadPageVerifyTitle2(html);
275     }
276 
277     /**
278      * @throws Exception on test failure
279      */
280     @Test
281     @Alerts({"[1, 0, 0, 1, 0, 0]",
282              "1[1, 0, 0, 0]",
283              "2[0, 1, 0, 0]",
284              "3[0, 0, 1, 0]",
285              "4[0, 0, 0, 1]",
286              "true"})
287     public void contructorUndefined() throws Exception {
288         final String html = DOCTYPE_HTML
289                 + "<html>\n"
290                 + "<body>\n"
291                 + "<script>\n"
292                 + LOG_TITLE_FUNCTION
293                 + DUMP_FUNCTION
294                 + "try {"
295                 + "  let m = new DOMMatrixReadOnly(undefined);\n"
296                 + "  dump(m);\n"
297                 + "} catch(e) { logEx(e); }"
298                 + "</script>\n"
299                 + "</body></html>";
300 
301         loadPageVerifyTitle2(html);
302     }
303 
304     /**
305      * @throws Exception on test failure
306      */
307     @Test
308     @Alerts("TypeError")
309     public void contructorEmptyArray() throws Exception {
310         final String html = DOCTYPE_HTML
311                 + "<html>\n"
312                 + "<body>\n"
313                 + "<script>\n"
314                 + LOG_TITLE_FUNCTION
315                 + DUMP_FUNCTION
316                 + "try {"
317                 + "  let m = new DOMMatrixReadOnly([]);\n"
318                 + "  dump(m);\n"
319                 + "} catch(e) { logEx(e); }"
320                 + "</script>\n"
321                 + "</body></html>";
322 
323         loadPageVerifyTitle2(html);
324     }
325 
326     /**
327      * @throws Exception on test failure
328      */
329     @Test
330     @Alerts({"[-1, 0, 0, 1, 0, 0]",
331              "true"})
332     public void flipX_identity() throws Exception {
333         final String html = DOCTYPE_HTML
334                 + "<html>\n"
335                 + "<body>\n"
336                 + "<script>\n"
337                 + LOG_TITLE_FUNCTION
338                 + DUMP_2D_FUNCTION
339                 + "let m = new DOMMatrixReadOnly();\n"
340                 + "let flipped = m.flipX();\n"
341                 + "dump(flipped);\n"
342                 + "</script>\n"
343                 + "</body></html>";
344 
345         loadPageVerifyTitle2(html);
346     }
347 
348     /**
349      * @throws Exception on test failure
350      */
351     @Test
352     @Alerts({"[1, 0, 0, -1, 0, 0]",
353              "true"})
354     public void flipY_identity() throws Exception {
355         final String html = DOCTYPE_HTML
356                 + "<html>\n"
357                 + "<body>\n"
358                 + "<script>\n"
359                 + LOG_TITLE_FUNCTION
360                 + DUMP_2D_FUNCTION
361                 + "let m = new DOMMatrixReadOnly();\n"
362                 + "let flipped = m.flipY();\n"
363                 + "dump(flipped);\n"
364                 + "</script>\n"
365                 + "</body></html>";
366 
367         loadPageVerifyTitle2(html);
368     }
369 
370     /**
371      * @throws Exception on test failure
372      */
373     @Test
374     @Alerts(DEFAULT = {"[NaN, 0, 0, 1, 0, 0]", "true"},
375             FF = {"[NaN, 0, NaN, 1, NaN, 0]", "true"},
376             FF_ESR = {"[NaN, 0, NaN, 1, NaN, 0]", "true"})
377     @HtmlUnitNYI(FF = {"[NaN, 0, 0, 1, 0, 0]", "true"},
378             FF_ESR = {"[NaN, 0, 0, 1, 0, 0]", "true"})
379     public void flipX_NaN() throws Exception {
380         final String html = DOCTYPE_HTML
381                 + "<html>\n"
382                 + "<body>\n"
383                 + "<script>\n"
384                 + LOG_TITLE_FUNCTION
385                 + DUMP_2D_FUNCTION
386                 + "let m = new DOMMatrixReadOnly([NaN, 0, 0, 1, 0, 0]);\n"
387                 + "let flipped = m.flipX();\n"
388                 + "dump(flipped);\n"
389                 + "</script>\n"
390                 + "</body></html>";
391 
392         loadPageVerifyTitle2(html);
393     }
394 
395     /**
396      * @throws Exception on test failure
397      */
398     @Test
399     @Alerts(DEFAULT = {"[1, 0, 0, -Infinity, 0, 0]", "true"},
400             FF = {"[1, NaN, 0, -Infinity, 0, NaN]", "true"},
401             FF_ESR = {"[1, NaN, 0, -Infinity, 0, NaN]", "true"})
402     @HtmlUnitNYI(FF = {"[1, 0, 0, -Infinity, 0, 0]", "true"},
403             FF_ESR = {"[1, 0, 0, -Infinity, 0, 0]", "true"})
404     public void flipY_Infinity() throws Exception {
405         final String html = DOCTYPE_HTML
406                 + "<html>\n"
407                 + "<body>\n"
408                 + "<script>\n"
409                 + LOG_TITLE_FUNCTION
410                 + DUMP_2D_FUNCTION
411                 + "let m = new DOMMatrixReadOnly([1, 0, 0, Infinity, 0, 0]);\n"
412                 + "let flipped = m.flipY();\n"
413                 + "dump(flipped);\n"
414                 + "</script>\n"
415                 + "</body></html>";
416 
417         loadPageVerifyTitle2(html);
418     }
419 
420     /**
421      * @throws Exception on test failure
422      */
423     @Test
424     @Alerts({"true", "true",
425              "[-2, -3, 4, 5, 6, 7]",
426              "true",
427              "[2, 3, 4, 5, 6, 7]",
428              "true"})
429     public void flipX_6element2_general() throws Exception {
430         final String html = DOCTYPE_HTML
431                 + "<html>\n"
432                 + "<body>\n"
433                 + "<script>\n"
434                 + LOG_TITLE_FUNCTION
435                 + DUMP_2D_FUNCTION
436                 + "let m = new DOMMatrixReadOnly([2, 3, 4, 5, 6, 7]);\n"
437                 + "let flipped = m.flipX();\n"
438                 + "log(flipped instanceof DOMMatrixReadOnly);\n"
439                 + "log(flipped instanceof DOMMatrix);\n"
440                 + "dump(flipped);\n"
441                 + "dump(m);\n"
442                 + "</script>\n"
443                 + "</body></html>";
444 
445         loadPageVerifyTitle2(html);
446     }
447 
448     /**
449      * @throws Exception on test failure
450      */
451     @Test
452     @Alerts({"true", "true",
453              "[-16, -15, 12, 11, 4, 3]",
454              "1[-16, -15, -14, -13]",
455              "2[12, 11, 10, 9]",
456              "3[8, 7, 6, 5]",
457              "4[4, 3, 2, 1]",
458              "false",
459              "[16, 15, 12, 11, 4, 3]",
460              "1[16, 15, 14, 13]",
461              "2[12, 11, 10, 9]",
462              "3[8, 7, 6, 5]",
463              "4[4, 3, 2, 1]",
464              "false"})
465     public void flipX_16elements_general() throws Exception {
466         final String html = DOCTYPE_HTML
467                 + "<html>\n"
468                 + "<body>\n"
469                 + "<script>\n"
470                 + LOG_TITLE_FUNCTION
471                 + DUMP_FUNCTION
472                 + "let m = new DOMMatrixReadOnly([16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]);\n"
473                 + "let flipped = m.flipX();\n"
474                 + "log(flipped instanceof DOMMatrixReadOnly);\n"
475                 + "log(flipped instanceof DOMMatrix);\n"
476                 + "dump(flipped);\n"
477                 + "dump(m);\n"
478                 + "</script>\n"
479                 + "</body></html>";
480 
481         loadPageVerifyTitle2(html);
482     }
483 
484     /**
485      * @throws Exception on test failure
486      */
487     @Test
488     @Alerts({"true", "true",
489              "[2, 3, -4, -5, 6, 7]",
490              "1[2, 3, 0, 0]",
491              "2[-4, -5, 0, 0]",
492              "3[0, 0, 1, 0]",
493              "4[6, 7, 0, 1]",
494              "true",
495              "[2, 3, 4, 5, 6, 7]",
496              "1[2, 3, 0, 0]",
497              "2[4, 5, 0, 0]",
498              "3[0, 0, 1, 0]",
499              "4[6, 7, 0, 1]",
500              "true"})
501     public void flipY_6elements_general() throws Exception {
502         final String html = DOCTYPE_HTML
503                 + "<html>\n"
504                 + "<body>\n"
505                 + "<script>\n"
506                 + LOG_TITLE_FUNCTION
507                 + DUMP_FUNCTION
508                 + "let m = new DOMMatrixReadOnly([2, 3, 4, 5, 6, 7]);\n"
509                 + "let flipped = m.flipY();\n"
510                 + "log(flipped instanceof DOMMatrixReadOnly);\n"
511                 + "log(flipped instanceof DOMMatrix);\n"
512                 + "dump(flipped);\n"
513                 + "dump(m);\n"
514                 + "</script>\n"
515                 + "</body></html>";
516 
517         loadPageVerifyTitle2(html);
518     }
519 
520     /**
521      * @throws Exception on test failure
522      */
523     @Test
524     @Alerts({"true", "true",
525              "[16, 15, -12, -11, 4, 3]",
526              "1[16, 15, 14, 13]",
527              "2[-12, -11, -10, -9]",
528              "3[8, 7, 6, 5]",
529              "4[4, 3, 2, 1]",
530              "false",
531              "[16, 15, 12, 11, 4, 3]",
532              "1[16, 15, 14, 13]",
533              "2[12, 11, 10, 9]",
534              "3[8, 7, 6, 5]",
535              "4[4, 3, 2, 1]",
536              "false"})
537     public void flipY_16elements_general() throws Exception {
538         final String html = DOCTYPE_HTML
539                 + "<html>\n"
540                 + "<body>\n"
541                 + "<script>\n"
542                 + LOG_TITLE_FUNCTION
543                 + DUMP_FUNCTION
544                 + "let m = new DOMMatrixReadOnly([16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]);\n"
545                 + "let flipped = m.flipY();\n"
546                 + "log(flipped instanceof DOMMatrixReadOnly);\n"
547                 + "log(flipped instanceof DOMMatrix);\n"
548                 + "dump(flipped);\n"
549                 + "dump(m);\n"
550                 + "</script>\n"
551                 + "</body></html>";
552 
553         loadPageVerifyTitle2(html);
554     }
555 
556     /**
557      * @throws Exception on test failure
558      */
559     @Test
560     @Alerts({"[-16, -15, 12, 11, 4, 3]",
561              "1[-16, -15, -14, -13]",
562              "2[12, 11, 10, 9]",
563              "3[8, 7, 6, 5]",
564              "4[4, 3, 2, 1]",
565              "false"})
566     public void flipX_3D() throws Exception {
567         final String html = DOCTYPE_HTML
568                 + "<html>\n"
569                 + "<body>\n"
570                 + "<script>\n"
571                 + LOG_TITLE_FUNCTION
572                 + DUMP_FUNCTION
573                 + "let m = new DOMMatrixReadOnly([16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]);\n"
574                 + "let flipped = m.flipX();\n"
575                 + "dump(flipped);\n"
576                 + "</script>\n"
577                 + "</body></html>";
578 
579         loadPageVerifyTitle2(html);
580     }
581 
582     /**
583      * @throws Exception on test failure
584      */
585     @Test
586     @Alerts({"[16, 15, -12, -11, 4, 3]",
587              "1[16, 15, 14, 13]",
588              "2[-12, -11, -10, -9]",
589              "3[8, 7, 6, 5]",
590              "4[4, 3, 2, 1]",
591              "false"})
592     public void flipY_3D() throws Exception {
593         final String html = DOCTYPE_HTML
594                 + "<html>\n"
595                 + "<body>\n"
596                 + "<script>\n"
597                 + LOG_TITLE_FUNCTION
598                 + DUMP_FUNCTION
599                 + "let m = new DOMMatrixReadOnly([16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]);\n"
600                 + "let flipped = m.flipY();\n"
601                 + "dump(flipped);\n"
602                 + "</script>\n"
603                 + "</body></html>";
604 
605         loadPageVerifyTitle2(html);
606     }
607 
608     /**
609      * @throws Exception on test failure
610      */
611     @Test
612     @Alerts({"[1, 0, 0, 1, 0, 0]", "true"})
613     public void inverse_identity2D() throws Exception {
614         final String html = DOCTYPE_HTML
615                 + "<html><body><script>"
616                 + LOG_TITLE_FUNCTION
617                 + DUMP_2D_FUNCTION
618                 + "let m = new DOMMatrixReadOnly();"
619                 + "let inv = m.inverse();"
620                 + "dump(inv);"
621                 + "</script></body></html>";
622         loadPageVerifyTitle2(html);
623     }
624 
625     /**
626      * @throws Exception on test failure
627      */
628     @Test
629     @Alerts({"true", "true",
630              "[0.25, 0, 0, 0.2, -2.5, -2.6]",
631              "1[0.25, 0, 0, 0]",
632              "2[0, 0.2, 0, 0]",
633              "3[0, 0, 1, 0]",
634              "4[-2.5, -2.6, 0, 1]",
635              "true",
636              "[4, 0, 0, 5, 10, 13]",
637              "1[4, 0, 0, 0]",
638              "2[0, 5, 0, 0]",
639              "3[0, 0, 1, 0]",
640              "4[10, 13, 0, 1]",
641              "true"})
642     public void inverse_general2D() throws Exception {
643         final String html = DOCTYPE_HTML
644                 + "<html><body><script>"
645                 + LOG_TITLE_FUNCTION
646                 + DUMP_FUNCTION
647                 + "let m = new DOMMatrixReadOnly([4, 0, 0, 5, 10, 13]);"
648                 + "let inv = m.inverse();"
649                 + "log(inv instanceof DOMMatrixReadOnly);\n"
650                 + "log(inv instanceof DOMMatrix);\n"
651                 + "dump(inv);"
652                 + "dump(m);"
653                 + "</script></body></html>";
654         loadPageVerifyTitle2(html);
655     }
656 
657     /**
658      * @throws Exception on test failure
659      */
660     @Test
661     @Alerts({"[NaN, NaN, NaN, NaN, NaN, NaN]", "false"})
662     public void inverse_singular2D() throws Exception {
663         final String html = DOCTYPE_HTML
664                 + "<html><body><script>"
665                 + LOG_TITLE_FUNCTION
666                 + DUMP_2D_FUNCTION
667                 + "try {"
668                 + "  let m = new DOMMatrixReadOnly([0, 0, 0, 0, 0, 0]);"
669                 + "  let inv = m.inverse();"
670                 + "  dump(inv);"
671                 + "} catch(e) { logEx(e); }"
672                 + "</script></body></html>";
673         loadPageVerifyTitle2(html);
674     }
675 
676     /**
677      * @throws Exception on test failure
678      */
679     @Test
680     @Alerts({"[1, 0, 0, 1, 0, 0]",
681              "1[1, 0, 0, 0]",
682              "2[0, 1, 0, 0]",
683              "3[0, 0, 1, 0]",
684              "4[0, 0, 0, 1]",
685              "false"})
686     public void inverse_identity3D() throws Exception {
687         final String html = DOCTYPE_HTML
688                 + "<html><body><script>"
689                 + LOG_TITLE_FUNCTION
690                 + DUMP_FUNCTION
691                 + "let m = new DOMMatrixReadOnly([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);"
692                 + "let inv = m.inverse();"
693                 + "dump(inv);"
694                 + "</script></body></html>";
695         loadPageVerifyTitle2(html);
696     }
697 
698     /**
699      * @throws Exception on test failure
700      */
701     @Test
702     @Alerts({"[NaN, NaN, NaN, NaN, NaN, NaN]",
703              "1[NaN, NaN, NaN, NaN]",
704              "2[NaN, NaN, NaN, NaN]",
705              "3[NaN, NaN, NaN, NaN]",
706              "4[NaN, NaN, NaN, NaN]",
707              "false"})
708     public void inverse_singular3D() throws Exception {
709         final String html = DOCTYPE_HTML
710                 + "<html><body><script>"
711                 + LOG_TITLE_FUNCTION
712                 + DUMP_FUNCTION
713                 + "try {"
714                 + "  let m = new DOMMatrixReadOnly([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);"
715                 + "  let inv = m.inverse();"
716                 + "  dump(inv);"
717                 + "} catch(e) { logEx(e); }"
718                 + "</script></body></html>";
719         loadPageVerifyTitle2(html);
720     }
721 
722     /**
723      * @throws Exception on test failure
724      */
725     @Test
726     @Alerts({"true", "true",
727              "[-0.066, 0.115, 0.295, -0.016, 0, 0]",
728              "1[-0.066, 0.115, 0.115, -0.459]",
729              "2[0.295, -0.016, -0.516, 0.066]",
730              "3[0.148, -0.008, -0.008, 0.033]",
731              "4[0, 0, 0, 1]",
732              "false",
733              "[0.5, 0, 9, 2, 0, 0]",
734              "1[0.5, 0, 7, 0]",
735              "2[9, 2, 0, 4]",
736              "3[0, -2, 4, 0]",
737              "4[0, 0, 0, 1]",
738              "false"})
739     public void inverse_general3D() throws Exception {
740         final String html = DOCTYPE_HTML
741                 + "<html><body><script>"
742                 + LOG_TITLE_FUNCTION
743                 + DUMP_FUNCTION
744                 + "let m = new DOMMatrixReadOnly([0.5,0,7,0,9,2,0,4,0,-2,4,0,0,0,0,1]);"
745                 + "let inv = m.inverse();"
746                 + "log(inv instanceof DOMMatrixReadOnly);\n"
747                 + "log(inv instanceof DOMMatrix);\n"
748                 + "dump(inv);"
749                 + "dump(m);"
750                 + "</script></body></html>";
751         loadPageVerifyTitle2(html);
752     }
753 
754     /**
755      * @throws Exception on test failure
756      */
757     @Test
758     @Alerts({"[1, 0, 0, 1, 0, 0]",
759              "1[1, 0, 0, 0]",
760              "2[0, 1, 0, 0]",
761              "3[0, 0, 1, 0]",
762              "4[0, 0, 0, 1]",
763              "true"})
764     public void multiplyIdentity() throws Exception {
765         final String html = DOCTYPE_HTML
766                 + "<html>\n"
767                 + "<body>\n"
768                 + "<script>\n"
769                 + LOG_TITLE_FUNCTION
770                 + DUMP_FUNCTION
771                 + "let m1 = new DOMMatrixReadOnly();\n"
772                 + "let m2 = new DOMMatrixReadOnly();\n"
773                 + "let result = m1.multiply(m2);\n"
774                 + "dump(result);\n"
775                 + "</script>\n"
776                 + "</body></html>";
777 
778         loadPageVerifyTitle2(html);
779     }
780 
781     /**
782      * @throws Exception on test failure
783      */
784     @Test
785     @Alerts({"true", "true",
786              "[21, 32, 13, 20, 10, 14]",
787              "1[21, 32, 0, 0]",
788              "2[13, 20, 0, 0]",
789              "3[0, 0, 1, 0]",
790              "4[10, 14, 0, 1]",
791              "true"})
792     public void multiply2D() throws Exception {
793         final String html = DOCTYPE_HTML
794                 + "<html>\n"
795                 + "<body>\n"
796                 + "<script>\n"
797                 + LOG_TITLE_FUNCTION
798                 + DUMP_FUNCTION
799                 + "let m1 = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);\n"
800                 + "let m2 = new DOMMatrixReadOnly([6, 5, 4, 3, 2, 1]);\n"
801                 + "let result = m1.multiply(m2);\n"
802                 + "log(result instanceof DOMMatrixReadOnly);\n"
803                 + "log(result instanceof DOMMatrix);\n"
804                 + "dump(result);\n"
805                 + "</script>\n"
806                 + "</body></html>";
807 
808         loadPageVerifyTitle2(html);
809     }
810 
811     /**
812      * @throws Exception on test failure
813      */
814     @Test
815     @Alerts({"true", "true",
816              "[386, 444, 274, 316, 50, 60]",
817              "1[386, 444, 502, 560]",
818              "2[274, 316, 358, 400]",
819              "3[162, 188, 214, 240]",
820              "4[50, 60, 70, 80]",
821              "false"})
822     public void multiply3D() throws Exception {
823         final String html = DOCTYPE_HTML
824                 + "<html>\n"
825                 + "<body>\n"
826                 + "<script>\n"
827                 + LOG_TITLE_FUNCTION
828                 + DUMP_FUNCTION
829                 + "let m1 = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);\n"
830                 + "let m2 = new DOMMatrixReadOnly([16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]);\n"
831                 + "let result = m1.multiply(m2);\n"
832                 + "log(result instanceof DOMMatrixReadOnly);\n"
833                 + "log(result instanceof DOMMatrix);\n"
834                 + "dump(result);\n"
835                 + "</script>\n"
836                 + "</body></html>";
837 
838         loadPageVerifyTitle2(html);
839     }
840 
841     /**
842      * @throws Exception on test failure
843      */
844     @Test
845     @Alerts({"[-392, -90, -736, 116, -82, 16]",
846              "1[-392, -90, -173, 312]",
847              "2[-736, 116, 179, 16]",
848              "3[674, 90, 309, 48]",
849              "4[-82, 16, 27, 56]",
850              "false"})
851     public void multiply3D_2() throws Exception {
852         final String html = DOCTYPE_HTML
853                 + "<html>\n"
854                 + "<body>\n"
855                 + "<script>\n"
856                 + LOG_TITLE_FUNCTION
857                 + DUMP_FUNCTION
858                 + "let m1 = new DOMMatrixReadOnly([11, 2, 13, 4, -55, 1, -7, 8, 29, 0, 3.5, 12, 3, 9, 15, 0]);\n"
859                 + "let m2 = new DOMMatrixReadOnly([6, 15, 14, -13, 12, 11, -10, 9, 8, -7, 6, 9, 2, 3, 2, 1]);\n"
860                 + "let result = m1.multiply(m2);\n"
861                 + "dump(result);\n"
862                 + "</script>\n"
863                 + "</body></html>";
864 
865         loadPageVerifyTitle2(html);
866     }
867 
868     /**
869      * @throws Exception on test failure
870      */
871     @Test
872     @Alerts({"[1, 0, 0, 1, 5, 6]",
873              "1[1, 0, 0, 0]",
874              "2[0, 1, 0, 0]",
875              "3[0, 0, 1, 0]",
876              "4[5, 6, 0, 1]",
877              "true"})
878     public void multiplyTranslation() throws Exception {
879         final String html = DOCTYPE_HTML
880                 + "<html>\n"
881                 + "<body>\n"
882                 + "<script>\n"
883                 + LOG_TITLE_FUNCTION
884                 + DUMP_FUNCTION
885                 + "let m1 = new DOMMatrixReadOnly();\n"
886                 + "let m2 = new DOMMatrixReadOnly([1, 0, 0, 1, 5, 6]);\n"
887                 + "let result = m1.multiply(m2);\n"
888                 + "dump(result);\n"
889                 + "</script>\n"
890                 + "</body></html>";
891 
892         loadPageVerifyTitle2(html);
893     }
894 
895     /**
896      * @throws Exception on test failure
897      */
898     @Test
899     @Alerts({"[2, 0, 0, 2, 0, 0]",
900              "1[2, 0, 0, 0]",
901              "2[0, 2, 0, 0]",
902              "3[0, 0, 1, 0]",
903              "4[0, 0, 0, 1]",
904              "true"})
905     public void multiplyScale() throws Exception {
906         final String html = DOCTYPE_HTML
907                 + "<html>\n"
908                 + "<body>\n"
909                 + "<script>\n"
910                 + LOG_TITLE_FUNCTION
911                 + DUMP_FUNCTION
912                 + "let m1 = new DOMMatrixReadOnly([2, 0, 0, 2, 0, 0]);\n"
913                 + "let m2 = new DOMMatrixReadOnly();\n"
914                 + "let result = m1.multiply(m2);\n"
915                 + "dump(result);\n"
916                 + "</script>\n"
917                 + "</body></html>";
918 
919         loadPageVerifyTitle2(html);
920     }
921 
922     /**
923      * @throws Exception on test failure
924      */
925     @Test
926     @Alerts({"[0, 0, 0, 0, 0, 0]",
927              "1[0, 0, 0, 0]",
928              "2[0, 0, 0, 0]",
929              "3[0, 0, 1, 0]",
930              "4[0, 0, 0, 1]",
931              "true"})
932     public void multiplyZero() throws Exception {
933         final String html = DOCTYPE_HTML
934                 + "<html>\n"
935                 + "<body>\n"
936                 + "<script>\n"
937                 + LOG_TITLE_FUNCTION
938                 + DUMP_FUNCTION
939                 + "let m1 = new DOMMatrixReadOnly([0, 0, 0, 0, 0, 0]);\n"
940                 + "let m2 = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);\n"
941                 + "let result = m1.multiply(m2);\n"
942                 + "dump(result);\n"
943                 + "</script>\n"
944                 + "</body></html>";
945 
946         loadPageVerifyTitle2(html);
947     }
948 
949     /**
950      * @throws Exception on test failure
951      */
952     @Test
953     @Alerts({"[21, 32, 13, 20, 10, 14]",
954              "1[21, 32, 0, 0]",
955              "2[13, 20, 0, 0]",
956              "3[0, 0, 1, 0]",
957              "4[10, 14, 0, 1]",
958              "false"})
959     public void multiply2DWith3D() throws Exception {
960         final String html = DOCTYPE_HTML
961                 + "<html>\n"
962                 + "<body>\n"
963                 + "<script>\n"
964                 + LOG_TITLE_FUNCTION
965                 + DUMP_FUNCTION
966                 + "let m1 = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);\n"
967                 + "let m2 = new DOMMatrixReadOnly([6, 5, 0, 0, 4, 3, 0, 0, 0, 0, 1, 0, 2, 1, 0, 1]);\n"
968                 + "let result = m1.multiply(m2);\n"
969                 + "dump(result);\n"
970                 + "</script>\n"
971                 + "</body></html>";
972 
973         loadPageVerifyTitle2(html);
974     }
975 
976     /**
977      * @throws Exception on test failure
978      */
979     @Test
980     @Alerts({"[1, 0, 0, 1, 0, 0]",
981              "1[1, 0, 0, 0]",
982              "2[0, 1, 0, 0]",
983              "3[0, 0, 1, 0]",
984              "4[0, 0, 0, 1]",
985              "true"})
986     public void multiplyNullArgument() throws Exception {
987         final String html = DOCTYPE_HTML
988                 + "<html>\n"
989                 + "<body>\n"
990                 + "<script>\n"
991                 + LOG_TITLE_FUNCTION
992                 + DUMP_FUNCTION
993                 + "try {\n"
994                 + "  let m1 = new DOMMatrixReadOnly();\n"
995                 + "  let result = m1.multiply(null);\n"
996                 + "  dump(result);\n"
997                 + "} catch(e) { logEx(e); }\n"
998                 + "</script>\n"
999                 + "</body></html>";
1000 
1001         loadPageVerifyTitle2(html);
1002     }
1003 
1004     /**
1005      * @throws Exception on test failure
1006      */
1007     @Test
1008     @Alerts({"[1, 0, 0, 1, 0, 0]",
1009              "1[1, 0, 0, 0]",
1010              "2[0, 1, 0, 0]",
1011              "3[0, 0, 1, 0]",
1012              "4[0, 0, 0, 1]",
1013              "true"})
1014     public void multiplyUndefinedArgument() throws Exception {
1015         final String html = DOCTYPE_HTML
1016                 + "<html>\n"
1017                 + "<body>\n"
1018                 + "<script>\n"
1019                 + LOG_TITLE_FUNCTION
1020                 + DUMP_FUNCTION
1021                 + "try {\n"
1022                 + "  let m1 = new DOMMatrixReadOnly();\n"
1023                 + "  let result = m1.multiply(undefined);\n"
1024                 + "  dump(result);\n"
1025                 + "} catch(e) { logEx(e); }\n"
1026                 + "</script>\n"
1027                 + "</body></html>";
1028 
1029         loadPageVerifyTitle2(html);
1030     }
1031 
1032     /**
1033      * @throws Exception on test failure
1034      */
1035     @Test
1036     @Alerts("TypeError")
1037     public void multiplyStringArgument() throws Exception {
1038         final String html = DOCTYPE_HTML
1039                 + "<html>\n"
1040                 + "<body>\n"
1041                 + "<script>\n"
1042                 + LOG_TITLE_FUNCTION
1043                 + DUMP_FUNCTION
1044                 + "try {\n"
1045                 + "  let m1 = new DOMMatrixReadOnly();\n"
1046                 + "  let result = m1.multiply('invalid');\n"
1047                 + "  dump(result);\n"
1048                 + "} catch(e) { logEx(e); }\n"
1049                 + "</script>\n"
1050                 + "</body></html>";
1051 
1052         loadPageVerifyTitle2(html);
1053     }
1054 
1055     /**
1056      * @throws Exception on test failure
1057      */
1058     @Test
1059     @Alerts("TypeError")
1060     public void multiplyNumberArgument() throws Exception {
1061         final String html = DOCTYPE_HTML
1062                 + "<html>\n"
1063                 + "<body>\n"
1064                 + "<script>\n"
1065                 + LOG_TITLE_FUNCTION
1066                 + DUMP_FUNCTION
1067                 + "try {\n"
1068                 + "  let m1 = new DOMMatrixReadOnly();\n"
1069                 + "  let result = m1.multiply(42);\n"
1070                 + "  dump(result);\n"
1071                 + "} catch(e) { logEx(e); }\n"
1072                 + "</script>\n"
1073                 + "</body></html>";
1074 
1075         loadPageVerifyTitle2(html);
1076     }
1077 
1078     /**
1079      * @throws Exception on test failure
1080      */
1081     @Test
1082     @Alerts({"[1, 0, 0, 1, 0, 0]",
1083              "1[1, 0, 0, 0]",
1084              "2[0, 1, 0, 0]",
1085              "3[0, 0, 1, 0]",
1086              "4[0, 0, 0, 1]",
1087              "true"})
1088     public void multiplyNoArgument() throws Exception {
1089         final String html = DOCTYPE_HTML
1090                 + "<html>\n"
1091                 + "<body>\n"
1092                 + "<script>\n"
1093                 + LOG_TITLE_FUNCTION
1094                 + DUMP_FUNCTION
1095                 + "try {\n"
1096                 + "  let m1 = new DOMMatrixReadOnly();\n"
1097                 + "  let result = m1.multiply();\n"
1098                 + "  dump(result);\n"
1099                 + "} catch(e) { logEx(e); }\n"
1100                 + "</script>\n"
1101                 + "</body></html>";
1102 
1103         loadPageVerifyTitle2(html);
1104     }
1105 
1106     /**
1107      * @throws Exception on test failure
1108      */
1109     @Test
1110     @Alerts({"[NaN, 2, NaN, 4, NaN, 6]",
1111              "1[NaN, 2, 0, 0]",
1112              "2[NaN, 4, 0, 0]",
1113              "3[0, 0, 1, 0]",
1114              "4[NaN, 6, 0, 1]",
1115              "true"})
1116     public void multiplyWithNaN() throws Exception {
1117         final String html = DOCTYPE_HTML
1118                 + "<html>\n"
1119                 + "<body>\n"
1120                 + "<script>\n"
1121                 + LOG_TITLE_FUNCTION
1122                 + DUMP_FUNCTION
1123                 + "let m1 = new DOMMatrixReadOnly([NaN, 0, 0, 1, 0, 0]);\n"
1124                 + "let m2 = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);\n"
1125                 + "let result = m1.multiply(m2);\n"
1126                 + "dump(result);\n"
1127                 + "</script>\n"
1128                 + "</body></html>";
1129 
1130         loadPageVerifyTitle2(html);
1131     }
1132 
1133     /**
1134      * @throws Exception on test failure
1135      */
1136     @Test
1137     @Alerts({"[Infinity, 2, Infinity, 4, Infinity, 6]",
1138              "1[Infinity, 2, 0, 0]",
1139              "2[Infinity, 4, 0, 0]",
1140              "3[0, 0, 1, 0]",
1141              "4[Infinity, 6, 0, 1]",
1142              "true"})
1143     public void multiplyWithInfinity() throws Exception {
1144         final String html = DOCTYPE_HTML
1145                 + "<html>\n"
1146                 + "<body>\n"
1147                 + "<script>\n"
1148                 + LOG_TITLE_FUNCTION
1149                 + DUMP_FUNCTION
1150                 + "let m1 = new DOMMatrixReadOnly([Infinity, 0, 0, 1, 0, 0]);\n"
1151                 + "let m2 = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);\n"
1152                 + "let result = m1.multiply(m2);\n"
1153                 + "dump(result);\n"
1154                 + "</script>\n"
1155                 + "</body></html>";
1156 
1157         loadPageVerifyTitle2(html);
1158     }
1159 
1160     /**
1161      * @throws Exception on test failure
1162      */
1163     @Test
1164     @Alerts({"[1, 2, 3, 4, 5, 6]",
1165              "1[1, 2, 0, 0]",
1166              "2[3, 4, 0, 0]",
1167              "3[0, 0, 1, 0]",
1168              "4[5, 6, 0, 1]",
1169              "true"})
1170     public void multiplyAssociativity() throws Exception {
1171         final String html = DOCTYPE_HTML
1172                 + "<html>\n"
1173                 + "<body>\n"
1174                 + "<script>\n"
1175                 + LOG_TITLE_FUNCTION
1176                 + DUMP_FUNCTION
1177                 + "let m1 = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);\n"
1178                 + "let identity = new DOMMatrixReadOnly();\n"
1179                 + "let result = m1.multiply(identity);\n"
1180                 + "dump(result);\n"
1181                 + "</script>\n"
1182                 + "</body></html>";
1183 
1184         loadPageVerifyTitle2(html);
1185     }
1186 
1187     /**
1188      * @throws Exception on test failure
1189      */
1190     @Test
1191     @Alerts({"[1, 0, 0, 1, 0, 0]",
1192              "1[1, 0, 0, 0]",
1193              "2[0, 1, 0, 0]",
1194              "3[0, 0, 1, 0]",
1195              "4[0, 0, 0, 1]",
1196              "true"})
1197     public void rotate_identity_zero() throws Exception {
1198         final String html = DOCTYPE_HTML
1199                 + "<html>\n"
1200                 + "<body>\n"
1201                 + "<script>\n"
1202                 + LOG_TITLE_FUNCTION
1203                 + DUMP_FUNCTION
1204                 + "let m = new DOMMatrixReadOnly();\n"
1205                 + "let rotated = m.rotate(0);\n"
1206                 + "dump(rotated);\n"
1207                 + "</script>\n"
1208                 + "</body></html>";
1209 
1210         loadPageVerifyTitle2(html);
1211     }
1212 
1213     /**
1214      * @throws Exception on test failure
1215      */
1216     @Test
1217     @Alerts({"[0, 1, -1, 0, 0, 0]",
1218              "1[0, 1, 0, 0]",
1219              "2[-1, 0, 0, 0]",
1220              "3[0, 0, 1, 0]",
1221              "4[0, 0, 0, 1]",
1222              "true"})
1223     public void rotate_identity_90degrees() throws Exception {
1224         final String html = DOCTYPE_HTML
1225                 + "<html>\n"
1226                 + "<body>\n"
1227                 + "<script>\n"
1228                 + LOG_TITLE_FUNCTION
1229                 + DUMP_FUNCTION
1230                 + "let m = new DOMMatrixReadOnly();\n"
1231                 + "let rotated = m.rotate(90);\n"
1232                 + "dump(rotated);\n"
1233                 + "</script>\n"
1234                 + "</body></html>";
1235 
1236         loadPageVerifyTitle2(html);
1237     }
1238 
1239     /**
1240      * @throws Exception on test failure
1241      */
1242     @Test
1243     @Alerts({"[-1, 0, 0, -1, 0, 0]",
1244              "1[-1, 0, 0, 0]",
1245              "2[0, -1, 0, 0]",
1246              "3[0, 0, 1, 0]",
1247              "4[0, 0, 0, 1]",
1248              "true"})
1249     public void rotate_identity_180degrees() throws Exception {
1250         final String html = DOCTYPE_HTML
1251                 + "<html>\n"
1252                 + "<body>\n"
1253                 + "<script>\n"
1254                 + LOG_TITLE_FUNCTION
1255                 + DUMP_FUNCTION
1256                 + "let m = new DOMMatrixReadOnly();\n"
1257                 + "let rotated = m.rotate(180);\n"
1258                 + "dump(rotated);\n"
1259                 + "</script>\n"
1260                 + "</body></html>";
1261 
1262         loadPageVerifyTitle2(html);
1263     }
1264 
1265     /**
1266      * @throws Exception on test failure
1267      */
1268     @Test
1269     @Alerts({"[0, -1, 1, 0, 0, 0]",
1270              "1[0, -1, 0, 0]",
1271              "2[1, 0, 0, 0]",
1272              "3[0, 0, 1, 0]",
1273              "4[0, 0, 0, 1]",
1274              "true"})
1275     public void rotate_identity_270degrees() throws Exception {
1276         final String html = DOCTYPE_HTML
1277                 + "<html>\n"
1278                 + "<body>\n"
1279                 + "<script>\n"
1280                 + LOG_TITLE_FUNCTION
1281                 + DUMP_FUNCTION
1282                 + "let m = new DOMMatrixReadOnly();\n"
1283                 + "let rotated = m.rotate(270);\n"
1284                 + "dump(rotated);\n"
1285                 + "</script>\n"
1286                 + "</body></html>";
1287 
1288         loadPageVerifyTitle2(html);
1289     }
1290 
1291     /**
1292      * @throws Exception on test failure
1293      */
1294     @Test
1295     @Alerts({"[1, 0, 0, 1, 0, 0]",
1296              "1[1, 0, 0, 0]",
1297              "2[0, 1, 0, 0]",
1298              "3[0, 0, 1, 0]",
1299              "4[0, 0, 0, 1]",
1300              "true"})
1301     public void rotate_identity_360degrees() throws Exception {
1302         final String html = DOCTYPE_HTML
1303                 + "<html>\n"
1304                 + "<body>\n"
1305                 + "<script>\n"
1306                 + LOG_TITLE_FUNCTION
1307                 + DUMP_FUNCTION
1308                 + "let m = new DOMMatrixReadOnly();\n"
1309                 + "let rotated = m.rotate(360);\n"
1310                 + "dump(rotated);\n"
1311                 + "</script>\n"
1312                 + "</body></html>";
1313 
1314         loadPageVerifyTitle2(html);
1315     }
1316 
1317     /**
1318      * @throws Exception on test failure
1319      */
1320     @Test
1321     @Alerts({"[0.707, 0.707, -0.707, 0.707, 0, 0]",
1322              "1[0.707, 0.707, 0, 0]",
1323              "2[-0.707, 0.707, 0, 0]",
1324              "3[0, 0, 1, 0]",
1325              "4[0, 0, 0, 1]",
1326              "true"})
1327     public void rotate_identity_45degrees() throws Exception {
1328         final String html = DOCTYPE_HTML
1329                 + "<html>\n"
1330                 + "<body>\n"
1331                 + "<script>\n"
1332                 + LOG_TITLE_FUNCTION
1333                 + DUMP_FUNCTION
1334                 + "let m = new DOMMatrixReadOnly();\n"
1335                 + "let rotated = m.rotate(45);\n"
1336                 + "dump(rotated);\n"
1337                 + "</script>\n"
1338                 + "</body></html>";
1339 
1340         loadPageVerifyTitle2(html);
1341     }
1342 
1343     /**
1344      * @throws Exception on test failure
1345      */
1346     @Test
1347     @Alerts({"[0, 1, -1, 0, 0, 0]",
1348              "1[0, 1, 0, 0]",
1349              "2[-1, 0, 0, 0]",
1350              "3[0, 0, 1, 0]",
1351              "4[0, 0, 0, 1]",
1352              "true"})
1353     public void rotate_identity_negative_270degrees() throws Exception {
1354         final String html = DOCTYPE_HTML
1355                 + "<html>\n"
1356                 + "<body>\n"
1357                 + "<script>\n"
1358                 + LOG_TITLE_FUNCTION
1359                 + DUMP_FUNCTION
1360                 + "let m = new DOMMatrixReadOnly();\n"
1361                 + "let rotated = m.rotate(-270);\n"
1362                 + "dump(rotated);\n"
1363                 + "</script>\n"
1364                 + "</body></html>";
1365 
1366         loadPageVerifyTitle2(html);
1367     }
1368 
1369     /**
1370      * @throws Exception on test failure
1371      */
1372     @Test
1373     @Alerts({"true", "true",
1374              "[3, 4, -1, -2, 5, 6]",
1375              "1[3, 4, 0, 0]",
1376              "2[-1, -2, 0, 0]",
1377              "3[0, 0, 1, 0]",
1378              "4[5, 6, 0, 1]",
1379              "true",
1380              "[1, 2, 3, 4, 5, 6]",
1381              "1[1, 2, 0, 0]",
1382              "2[3, 4, 0, 0]",
1383              "3[0, 0, 1, 0]",
1384              "4[5, 6, 0, 1]",
1385              "true"})
1386     public void rotate_general_90degrees() throws Exception {
1387         final String html = DOCTYPE_HTML
1388                 + "<html>\n"
1389                 + "<body>\n"
1390                 + "<script>\n"
1391                 + LOG_TITLE_FUNCTION
1392                 + DUMP_FUNCTION
1393                 + "let m = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);\n"
1394                 + "let rotated = m.rotate(90);\n"
1395                 + "log(rotated instanceof DOMMatrixReadOnly);\n"
1396                 + "log(rotated instanceof DOMMatrix);\n"
1397                 + "dump(rotated);\n"
1398                 + "dump(m);\n"
1399                 + "</script>\n"
1400                 + "</body></html>";
1401 
1402         loadPageVerifyTitle2(html);
1403     }
1404 
1405     /**
1406      * @throws Exception on test failure
1407      */
1408     @Test
1409     @Alerts(DEFAULT = {"[NaN, NaN, NaN, NaN, 5, 6]",
1410                        "1[NaN, NaN, NaN, NaN]",
1411                        "2[NaN, NaN, NaN, NaN]",
1412                        "3[0, 0, 1, 0]",
1413                        "4[5, 6, 0, 1]",
1414                        "true"},
1415             FF = {"[NaN, NaN, NaN, NaN, 5, 6]",
1416                   "1[NaN, NaN, 0, 0]",
1417                   "2[NaN, NaN, 0, 0]",
1418                   "3[0, 0, 1, 0]",
1419                   "4[5, 6, 0, 1]",
1420                   "true"},
1421             FF_ESR = {"[NaN, NaN, NaN, NaN, 5, 6]",
1422                       "1[NaN, NaN, 0, 0]",
1423                       "2[NaN, NaN, 0, 0]",
1424                       "3[0, 0, 1, 0]",
1425                       "4[5, 6, 0, 1]",
1426                       "true"})
1427     @HtmlUnitNYI(
1428             CHROME = {"[NaN, NaN, NaN, NaN, 5, 6]",
1429                       "1[NaN, NaN, 0, 0]",
1430                       "2[NaN, NaN, 0, 0]",
1431                       "3[0, 0, 1, 0]",
1432                       "4[5, 6, 0, 1]",
1433                       "true"},
1434             EDGE = {"[NaN, NaN, NaN, NaN, 5, 6]",
1435                     "1[NaN, NaN, 0, 0]",
1436                     "2[NaN, NaN, 0, 0]",
1437                     "3[0, 0, 1, 0]",
1438                     "4[5, 6, 0, 1]",
1439                     "true"})
1440     public void rotate_with_NaN_angle() throws Exception {
1441         final String html = DOCTYPE_HTML
1442                 + "<html>\n"
1443                 + "<body>\n"
1444                 + "<script>\n"
1445                 + LOG_TITLE_FUNCTION
1446                 + DUMP_FUNCTION
1447                 + "let m = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);\n"
1448                 + "let rotated = m.rotate(NaN);\n"
1449                 + "dump(rotated);\n"
1450                 + "</script>\n"
1451                 + "</body></html>";
1452 
1453         loadPageVerifyTitle2(html);
1454     }
1455 
1456     /**
1457      * @throws Exception on test failure
1458      */
1459     @Test
1460     @Alerts(DEFAULT = {"[NaN, NaN, NaN, NaN, 5, 6]",
1461                        "1[NaN, NaN, NaN, NaN]",
1462                        "2[NaN, NaN, NaN, NaN]",
1463                        "3[0, 0, 1, 0]",
1464                        "4[5, 6, 0, 1]",
1465                        "true"},
1466             FF = {"[NaN, NaN, NaN, NaN, 5, 6]",
1467                   "1[NaN, NaN, 0, 0]",
1468                   "2[NaN, NaN, 0, 0]",
1469                   "3[0, 0, 1, 0]",
1470                   "4[5, 6, 0, 1]",
1471                   "true"},
1472             FF_ESR = {"[NaN, NaN, NaN, NaN, 5, 6]",
1473                       "1[NaN, NaN, 0, 0]",
1474                       "2[NaN, NaN, 0, 0]",
1475                       "3[0, 0, 1, 0]",
1476                       "4[5, 6, 0, 1]",
1477                       "true"})
1478     @HtmlUnitNYI(
1479             CHROME = {"[NaN, NaN, NaN, NaN, 5, 6]",
1480                       "1[NaN, NaN, 0, 0]",
1481                       "2[NaN, NaN, 0, 0]",
1482                       "3[0, 0, 1, 0]",
1483                       "4[5, 6, 0, 1]",
1484                       "true"},
1485             EDGE = {"[NaN, NaN, NaN, NaN, 5, 6]",
1486                     "1[NaN, NaN, 0, 0]",
1487                     "2[NaN, NaN, 0, 0]",
1488                     "3[0, 0, 1, 0]",
1489                     "4[5, 6, 0, 1]",
1490                     "true"})
1491     public void rotate_with_Infinity_angle() throws Exception {
1492         final String html = DOCTYPE_HTML
1493                 + "<html>\n"
1494                 + "<body>\n"
1495                 + "<script>\n"
1496                 + LOG_TITLE_FUNCTION
1497                 + DUMP_FUNCTION
1498                 + "let m = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);\n"
1499                 + "let rotated = m.rotate(Infinity);\n"
1500                 + "dump(rotated);\n"
1501                 + "</script>\n"
1502                 + "</body></html>";
1503 
1504         loadPageVerifyTitle2(html);
1505     }
1506 
1507     /**
1508      * @throws Exception on test failure
1509      */
1510     @Test
1511     @Alerts(DEFAULT = {"[NaN, 4.243, NaN, 1.414, 5, 6]",
1512                        "1[NaN, 4.243, 0, 0]",
1513                        "2[NaN, 1.414, 0, 0]",
1514                        "3[0, 0, 1, 0]",
1515                        "4[5, 6, 0, 1]",
1516                        "true"},
1517             FF = {"[NaN, 4.243, NaN, 1.414, NaN, 6]",
1518                   "1[NaN, 4.243, 0, 0]",
1519                   "2[NaN, 1.414, 0, 0]",
1520                   "3[0, 0, 1, 0]",
1521                   "4[NaN, 6, 0, 1]",
1522                   "true"},
1523             FF_ESR = {"[NaN, 4.243, NaN, 1.414, NaN, 6]",
1524                       "1[NaN, 4.243, 0, 0]",
1525                       "2[NaN, 1.414, 0, 0]",
1526                       "3[0, 0, 1, 0]",
1527                       "4[NaN, 6, 0, 1]",
1528                       "true"})
1529     @HtmlUnitNYI(
1530             FF = {"[NaN, 4.243, NaN, 1.414, 5, 6]",
1531                   "1[NaN, 4.243, 0, 0]",
1532                   "2[NaN, 1.414, 0, 0]",
1533                   "3[0, 0, 1, 0]",
1534                   "4[5, 6, 0, 1]",
1535                   "true"},
1536             FF_ESR = {"[NaN, 4.243, NaN, 1.414, 5, 6]",
1537                       "1[NaN, 4.243, 0, 0]",
1538                       "2[NaN, 1.414, 0, 0]",
1539                       "3[0, 0, 1, 0]",
1540                       "4[5, 6, 0, 1]",
1541                       "true"})
1542     public void rotate_matrix_with_NaN_values() throws Exception {
1543         final String html = DOCTYPE_HTML
1544                 + "<html>\n"
1545                 + "<body>\n"
1546                 + "<script>\n"
1547                 + LOG_TITLE_FUNCTION
1548                 + DUMP_FUNCTION
1549                 + "let m = new DOMMatrixReadOnly([NaN, 2, 3, 4, 5, 6]);\n"
1550                 + "let rotated = m.rotate(45);\n"
1551                 + "dump(rotated);\n"
1552                 + "</script>\n"
1553                 + "</body></html>";
1554 
1555         loadPageVerifyTitle2(html);
1556     }
1557 
1558     /**
1559      * @throws Exception on test failure
1560      */
1561     @Test
1562     @Alerts(DEFAULT = {"[Infinity, 4.243, -Infinity, 1.414, 5, 6]",
1563                        "1[Infinity, 4.243, 0, 0]",
1564                        "2[-Infinity, 1.414, 0, 0]",
1565                        "3[0, 0, 1, 0]",
1566                        "4[5, 6, 0, 1]",
1567                        "true"},
1568             FF = {"[Infinity, 4.243, -Infinity, 1.414, NaN, 6]",
1569                   "1[Infinity, 4.243, 0, 0]",
1570                   "2[-Infinity, 1.414, 0, 0]",
1571                   "3[0, 0, 1, 0]",
1572                   "4[NaN, 6, 0, 1]",
1573                   "true"},
1574             FF_ESR = {"[Infinity, 4.243, -Infinity, 1.414, NaN, 6]",
1575                       "1[Infinity, 4.243, 0, 0]",
1576                       "2[-Infinity, 1.414, 0, 0]",
1577                       "3[0, 0, 1, 0]",
1578                       "4[NaN, 6, 0, 1]",
1579                       "true"})
1580     @HtmlUnitNYI(
1581             FF = {"[Infinity, 4.243, -Infinity, 1.414, 5, 6]",
1582                   "1[Infinity, 4.243, 0, 0]",
1583                   "2[-Infinity, 1.414, 0, 0]",
1584                   "3[0, 0, 1, 0]",
1585                   "4[5, 6, 0, 1]",
1586                   "true"},
1587             FF_ESR = {"[Infinity, 4.243, -Infinity, 1.414, 5, 6]",
1588                       "1[Infinity, 4.243, 0, 0]",
1589                       "2[-Infinity, 1.414, 0, 0]",
1590                       "3[0, 0, 1, 0]",
1591                       "4[5, 6, 0, 1]",
1592                       "true"})
1593     public void rotate_matrix_with_Infinity_values() throws Exception {
1594         final String html = DOCTYPE_HTML
1595                 + "<html>\n"
1596                 + "<body>\n"
1597                 + "<script>\n"
1598                 + LOG_TITLE_FUNCTION
1599                 + DUMP_FUNCTION
1600                 + "let m = new DOMMatrixReadOnly([Infinity, 2, 3, 4, 5, 6]);\n"
1601                 + "let rotated = m.rotate(45);\n"
1602                 + "dump(rotated);\n"
1603                 + "</script>\n"
1604                 + "</body></html>";
1605 
1606         loadPageVerifyTitle2(html);
1607     }
1608 
1609     /**
1610      * @throws Exception on test failure
1611      */
1612     @Test
1613     @Alerts({"[16, 15, 12, 11, 4, 3]",
1614              "1[16, 15, 14, 13]",
1615              "2[12, 11, 10, 9]",
1616              "3[8, 7, 6, 5]",
1617              "4[4, 3, 2, 1]",
1618              "false"})
1619     public void rotate_3D_zero_degrees() throws Exception {
1620         final String html = DOCTYPE_HTML
1621                 + "<html>\n"
1622                 + "<body>\n"
1623                 + "<script>\n"
1624                 + LOG_TITLE_FUNCTION
1625                 + DUMP_FUNCTION
1626                 + "let m = new DOMMatrixReadOnly([16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]);\n"
1627                 + "let rotated = m.rotate(0);\n"
1628                 + "dump(rotated);\n"
1629                 + "</script>\n"
1630                 + "</body></html>";
1631 
1632         loadPageVerifyTitle2(html);
1633     }
1634 
1635     /**
1636      * @throws Exception on test failure
1637      */
1638     @Test
1639     @Alerts({"true", "true",
1640              "[12, 11, -16, -15, 4, 3]",
1641              "1[12, 11, 10, 9]",
1642              "2[-16, -15, -14, -13]",
1643              "3[8, 7, 6, 5]",
1644              "4[4, 3, 2, 1]",
1645              "false"})
1646     public void rotate_3D_90_degrees() throws Exception {
1647         final String html = DOCTYPE_HTML
1648                 + "<html>\n"
1649                 + "<body>\n"
1650                 + "<script>\n"
1651                 + LOG_TITLE_FUNCTION
1652                 + DUMP_FUNCTION
1653                 + "let m = new DOMMatrixReadOnly([16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]);\n"
1654                 + "let rotated = m.rotate(90);\n"
1655                 + "log(rotated instanceof DOMMatrixReadOnly);\n"
1656                 + "log(rotated instanceof DOMMatrix);\n"
1657                 + "dump(rotated);\n"
1658                 + "</script>\n"
1659                 + "</body></html>";
1660 
1661         loadPageVerifyTitle2(html);
1662     }
1663 
1664     /**
1665      * @throws Exception on test failure
1666      */
1667     @Test
1668     @Alerts({"[-16, -15, -12, -11, 4, 3]",
1669              "1[-16, -15, -14, -13]",
1670              "2[-12, -11, -10, -9]",
1671              "3[8, 7, 6, 5]",
1672              "4[4, 3, 2, 1]",
1673              "false"})
1674     public void rotate_3D_180_degrees() throws Exception {
1675         final String html = DOCTYPE_HTML
1676                 + "<html>\n"
1677                 + "<body>\n"
1678                 + "<script>\n"
1679                 + LOG_TITLE_FUNCTION
1680                 + DUMP_FUNCTION
1681                 + "let m = new DOMMatrixReadOnly([16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]);\n"
1682                 + "let rotated = m.rotate(180);\n"
1683                 + "dump(rotated);\n"
1684                 + "</script>\n"
1685                 + "</body></html>";
1686 
1687         loadPageVerifyTitle2(html);
1688     }
1689 
1690     /**
1691      * @throws Exception on test failure
1692      */
1693     @Test
1694     @Alerts({"[-12, -11, 16, 15, 4, 3]",
1695              "1[-12, -11, -10, -9]",
1696              "2[16, 15, 14, 13]",
1697              "3[8, 7, 6, 5]",
1698              "4[4, 3, 2, 1]",
1699              "false"})
1700     public void rotate_3D_270_degrees() throws Exception {
1701         final String html = DOCTYPE_HTML
1702                 + "<html>\n"
1703                 + "<body>\n"
1704                 + "<script>\n"
1705                 + LOG_TITLE_FUNCTION
1706                 + DUMP_FUNCTION
1707                 + "let m = new DOMMatrixReadOnly([16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]);\n"
1708                 + "let rotated = m.rotate(270);\n"
1709                 + "dump(rotated);\n"
1710                 + "</script>\n"
1711                 + "</body></html>";
1712 
1713         loadPageVerifyTitle2(html);
1714     }
1715 
1716     /**
1717      * @throws Exception on test failure
1718      */
1719     @Test
1720     @Alerts({"[19.799, 18.385, -2.828, -2.828, 4, 3]",
1721              "1[19.799, 18.385, 16.971, 15.556]",
1722              "2[-2.828, -2.828, -2.828, -2.828]",
1723              "3[8, 7, 6, 5]",
1724              "4[4, 3, 2, 1]",
1725              "false"})
1726     public void rotate_3D_45_degrees() throws Exception {
1727         final String html = DOCTYPE_HTML
1728                 + "<html>\n"
1729                 + "<body>\n"
1730                 + "<script>\n"
1731                 + LOG_TITLE_FUNCTION
1732                 + DUMP_FUNCTION
1733                 + "let m = new DOMMatrixReadOnly([16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]);\n"
1734                 + "let rotated = m.rotate(45);\n"
1735                 + "dump(rotated);\n"
1736                 + "</script>\n"
1737                 + "</body></html>";
1738 
1739         loadPageVerifyTitle2(html);
1740     }
1741 
1742     /**
1743      * @throws Exception on test failure
1744      */
1745     @Test
1746     @Alerts({"[1, 0, 0, 1, 0, 0]",
1747              "1[1, 0, 0, 0]",
1748              "2[0, 1, 0, 0]",
1749              "3[0, 0, 1, 0]",
1750              "4[0, 0, 0, 1]",
1751              "true"})
1752     public void rotate_no_argument() throws Exception {
1753         final String html = DOCTYPE_HTML
1754                 + "<html>\n"
1755                 + "<body>\n"
1756                 + "<script>\n"
1757                 + LOG_TITLE_FUNCTION
1758                 + DUMP_FUNCTION
1759                 + "let m = new DOMMatrixReadOnly();\n"
1760                 + "let rotated = m.rotate();\n"
1761                 + "dump(rotated);\n"
1762                 + "</script>\n"
1763                 + "</body></html>";
1764 
1765         loadPageVerifyTitle2(html);
1766     }
1767 
1768     /**
1769      * @throws Exception on test failure
1770      */
1771     @Test
1772     @Alerts({"[1, 0, 0, 1, 0, 0]",
1773              "1[1, 0, 0, 0]",
1774              "2[0, 1, 0, 0]",
1775              "3[0, 0, 1, 0]",
1776              "4[0, 0, 0, 1]",
1777              "true"})
1778     public void rotate_null_argument() throws Exception {
1779         final String html = DOCTYPE_HTML
1780                 + "<html>\n"
1781                 + "<body>\n"
1782                 + "<script>\n"
1783                 + LOG_TITLE_FUNCTION
1784                 + DUMP_FUNCTION
1785                 + "let m = new DOMMatrixReadOnly();\n"
1786                 + "let rotated = m.rotate(null);\n"
1787                 + "dump(rotated);\n"
1788                 + "</script>\n"
1789                 + "</body></html>";
1790 
1791         loadPageVerifyTitle2(html);
1792     }
1793 
1794     /**
1795      * @throws Exception on test failure
1796      */
1797     @Test
1798     @Alerts({"[1, 0, 0, 1, 0, 0]",
1799              "1[1, 0, 0, 0]",
1800              "2[0, 1, 0, 0]",
1801              "3[0, 0, 1, 0]",
1802              "4[0, 0, 0, 1]",
1803              "true"})
1804     public void rotateAxisAngle_identity_zero() throws Exception {
1805         final String html = DOCTYPE_HTML
1806                 + "<html><body><script>"
1807                 + LOG_TITLE_FUNCTION
1808                 + DUMP_FUNCTION
1809                 + "let m = new DOMMatrixReadOnly();"
1810                 + "let rotated = m.rotateAxisAngle(0, 0, 1, 0);"
1811                 + "dump(rotated);"
1812                 + "</script></body></html>";
1813         loadPageVerifyTitle2(html);
1814     }
1815 
1816     /**
1817      * @throws Exception on test failure
1818      */
1819     @Test
1820     @Alerts({"[1, 0, 0, 1, 0, 0]",
1821              "1[1, 0, 0, 0]",
1822              "2[0, 1, 0, 0]",
1823              "3[0, 0, 1, 0]",
1824              "4[0, 0, 0, 1]",
1825              "true"})
1826     public void rotateAxisAngle_identity_360() throws Exception {
1827         final String html = DOCTYPE_HTML
1828                 + "<html><body><script>"
1829                 + LOG_TITLE_FUNCTION
1830                 + DUMP_FUNCTION
1831                 + "let m = new DOMMatrixReadOnly();"
1832                 + "let rotated = m.rotateAxisAngle(0, 0, 1, 360);"
1833                 + "dump(rotated);"
1834                 + "</script></body></html>";
1835         loadPageVerifyTitle2(html);
1836     }
1837 
1838     /**
1839      * @throws Exception on test failure
1840      */
1841     @Test
1842     @Alerts(DEFAULT = {"[0, 1, -1, 0, 0, 0]",
1843                        "1[0, 1, 0, 0]",
1844                        "2[-1, 0, 0, 0]",
1845                        "3[0, 0, 1, 0]",
1846                        "4[0, 0, 0, 1]",
1847                        "true"},
1848             FF_ESR = {"[0, 1, -1, 0, 0, 0]",
1849                       "1[0, 1, 0, 0]",
1850                       "2[-1, 0, 0, 0]",
1851                       "3[0, 0, 1, 0]",
1852                       "4[0, 0, 0, 1]",
1853                       "false"})
1854     @HtmlUnitNYI(
1855             FF_ESR = {"[0, 1, -1, 0, 0, 0]",
1856                       "1[0, 1, 0, 0]",
1857                       "2[-1, 0, 0, 0]",
1858                       "3[0, 0, 1, 0]",
1859                       "4[0, 0, 0, 1]",
1860                       "true"})
1861     public void rotateAxisAngle_identity_90_z() throws Exception {
1862         final String html = DOCTYPE_HTML
1863                 + "<html><body><script>"
1864                 + LOG_TITLE_FUNCTION
1865                 + DUMP_FUNCTION
1866                 + "let m = new DOMMatrixReadOnly();"
1867                 + "let rotated = m.rotateAxisAngle(0, 0, 1, 90);"
1868                 + "dump(rotated);"
1869                 + "</script></body></html>";
1870         loadPageVerifyTitle2(html);
1871     }
1872 
1873     /**
1874      * @throws Exception on test failure
1875      */
1876     @Test
1877     @Alerts({"[1, 0, 0, 0, 0, 0]",
1878              "1[1, 0, 0, 0]",
1879              "2[0, 0, 1, 0]",
1880              "3[0, -1, 0, 0]",
1881              "4[0, 0, 0, 1]",
1882              "false"})
1883     public void rotateAxisAngle_identity_90_x() throws Exception {
1884         final String html = DOCTYPE_HTML
1885                 + "<html><body><script>"
1886                 + LOG_TITLE_FUNCTION
1887                 + DUMP_FUNCTION
1888                 + "let m = new DOMMatrixReadOnly();"
1889                 + "let rotated = m.rotateAxisAngle(1, 0, 0, 90);"
1890                 + "dump(rotated);"
1891                 + "</script></body></html>";
1892         loadPageVerifyTitle2(html);
1893     }
1894 
1895     /**
1896      * @throws Exception on test failure
1897      */
1898     @Test
1899     @Alerts({"[1, 0, 0, 0, 0, 0]",
1900              "1[1, 0, 0, 0]",
1901              "2[0, 0, -1, 0]",
1902              "3[0, 1, 0, 0]",
1903              "4[0, 0, 0, 1]",
1904              "false"})
1905     public void rotateAxisAngle_identity_270_x() throws Exception {
1906         final String html = DOCTYPE_HTML
1907                 + "<html><body><script>"
1908                 + LOG_TITLE_FUNCTION
1909                 + DUMP_FUNCTION
1910                 + "let m = new DOMMatrixReadOnly();"
1911                 + "let rotated = m.rotateAxisAngle(1, 0, 0, 270);"
1912                 + "dump(rotated);"
1913                 + "</script></body></html>";
1914         loadPageVerifyTitle2(html);
1915     }
1916 
1917     /**
1918      * @throws Exception on test failure
1919      */
1920     @Test
1921     @Alerts({"[7, 6, 5, 4, 3, 2]",
1922              "1[7, 6, 0, 0]",
1923              "2[5, 4, 0, 0]",
1924              "3[0, 0, 1, 0]",
1925              "4[3, 2, 0, 1]",
1926              "true"})
1927     public void rotateAxisAngle_6_zero() throws Exception {
1928         final String html = DOCTYPE_HTML
1929                 + "<html><body><script>"
1930                 + LOG_TITLE_FUNCTION
1931                 + DUMP_FUNCTION
1932                 + "let m = new DOMMatrixReadOnly([7, 6, 5, 4, 3, 2]);"
1933                 + "let rotated = m.rotateAxisAngle(0, 0, 1, 0);"
1934                 + "dump(rotated);"
1935                 + "</script></body></html>";
1936         loadPageVerifyTitle2(html);
1937     }
1938 
1939     /**
1940      * @throws Exception on test failure
1941      */
1942     @Test
1943     @Alerts({"[7, 6, 5, 4, 3, 2]",
1944              "1[7, 6, 0, 0]",
1945              "2[5, 4, 0, 0]",
1946              "3[0, 0, 1, 0]",
1947              "4[3, 2, 0, 1]",
1948              "true"})
1949     public void rotateAxisAngle_6_360() throws Exception {
1950         final String html = DOCTYPE_HTML
1951                 + "<html><body><script>"
1952                 + LOG_TITLE_FUNCTION
1953                 + DUMP_FUNCTION
1954                 + "let m = new DOMMatrixReadOnly([7, 6, 5, 4, 3, 2]);"
1955                 + "let rotated = m.rotateAxisAngle(0, 0, 1, 360);"
1956                 + "dump(rotated);"
1957                 + "</script></body></html>";
1958         loadPageVerifyTitle2(html);
1959     }
1960 
1961     /**
1962      * @throws Exception on test failure
1963      */
1964     @Test
1965     @Alerts(DEFAULT = {"[5, 4, -7, -6, 3, 2]",
1966                        "1[5, 4, 0, 0]",
1967                        "2[-7, -6, 0, 0]",
1968                        "3[0, 0, 1, 0]",
1969                        "4[3, 2, 0, 1]",
1970                        "true"},
1971             FF_ESR = {"[5, 4, -7, -6, 3, 2]",
1972                       "1[5, 4, 0, 0]",
1973                       "2[-7, -6, 0, 0]",
1974                       "3[0, 0, 1, 0]",
1975                       "4[3, 2, 0, 1]",
1976                       "false"})
1977     @HtmlUnitNYI(FF_ESR = {"[5, 4, -7, -6, 3, 2]",
1978                            "1[5, 4, 0, 0]",
1979                            "2[-7, -6, 0, 0]",
1980                            "3[0, 0, 1, 0]",
1981                            "4[3, 2, 0, 1]",
1982                            "true"})
1983     public void rotateAxisAngle_6_90_z() throws Exception {
1984         final String html = DOCTYPE_HTML
1985                 + "<html><body><script>"
1986                 + LOG_TITLE_FUNCTION
1987                 + DUMP_FUNCTION
1988                 + "let m = new DOMMatrixReadOnly([7, 6, 5, 4, 3, 2]);"
1989                 + "let rotated = m.rotateAxisAngle(0, 0, 1, 90);"
1990                 + "dump(rotated);"
1991                 + "</script></body></html>";
1992         loadPageVerifyTitle2(html);
1993     }
1994 
1995     /**
1996      * @throws Exception on test failure
1997      */
1998     @Test
1999     @Alerts({"true", "true",
2000              "[7, 6, 0, 0, 3, 2]",
2001              "1[7, 6, 0, 0]",
2002              "2[0, 0, 1, 0]",
2003              "3[-5, -4, 0, 0]",
2004              "4[3, 2, 0, 1]",
2005              "false"})
2006     public void rotateAxisAngle_6_90_x() throws Exception {
2007         final String html = DOCTYPE_HTML
2008                 + "<html><body><script>"
2009                 + LOG_TITLE_FUNCTION
2010                 + DUMP_FUNCTION
2011                 + "let m = new DOMMatrixReadOnly([7, 6, 5, 4, 3, 2]);"
2012                 + "let rotated = m.rotateAxisAngle(1, 0, 0, 90);"
2013                 + "log(rotated instanceof DOMMatrixReadOnly);\n"
2014                 + "log(rotated instanceof DOMMatrix);\n"
2015                 + "dump(rotated);"
2016                 + "</script></body></html>";
2017         loadPageVerifyTitle2(html);
2018     }
2019 
2020     /**
2021      * @throws Exception on test failure
2022      */
2023     @Test
2024     @Alerts({"[7, 6, 0, 0, 3, 2]",
2025              "1[7, 6, 0, 0]",
2026              "2[0, 0, -1, 0]",
2027              "3[5, 4, 0, 0]",
2028              "4[3, 2, 0, 1]",
2029              "false"})
2030     public void rotateAxisAngle_6_270_x() throws Exception {
2031         final String html = DOCTYPE_HTML
2032                 + "<html><body><script>"
2033                 + LOG_TITLE_FUNCTION
2034                 + DUMP_FUNCTION
2035                 + "let m = new DOMMatrixReadOnly([7, 6, 5, 4, 3, 2]);"
2036                 + "let rotated = m.rotateAxisAngle(1, 0, 0, 270);"
2037                 + "dump(rotated);"
2038                 + "</script></body></html>";
2039         loadPageVerifyTitle2(html);
2040     }
2041 
2042     /**
2043      * @throws Exception on test failure
2044      */
2045     @Test
2046     @Alerts({"[2, 3, 6, 7, 14, 15]",
2047              "1[2, 3, 4, 5]",
2048              "2[6, 7, 8, 9]",
2049              "3[10, 11, 12, 13]",
2050              "4[14, 15, 16, 17]",
2051              "false"})
2052     public void rotateAxisAngle_16_zero() throws Exception {
2053         final String html = DOCTYPE_HTML
2054                 + "<html><body><script>"
2055                 + LOG_TITLE_FUNCTION
2056                 + DUMP_FUNCTION
2057                 + "let m = new DOMMatrixReadOnly([2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]);"
2058                 + "let rotated = m.rotateAxisAngle(0, 0, 1, 0);"
2059                 + "dump(rotated);"
2060                 + "</script></body></html>";
2061         loadPageVerifyTitle2(html);
2062     }
2063 
2064     /**
2065      * @throws Exception on test failure
2066      */
2067     @Test
2068     @Alerts({"[2, 3, 6, 7, 14, 15]",
2069              "1[2, 3, 4, 5]",
2070              "2[6, 7, 8, 9]",
2071              "3[10, 11, 12, 13]",
2072              "4[14, 15, 16, 17]",
2073              "false"})
2074     public void rotateAxisAngle_16_360() throws Exception {
2075         final String html = DOCTYPE_HTML
2076                 + "<html><body><script>"
2077                 + LOG_TITLE_FUNCTION
2078                 + DUMP_FUNCTION
2079                 + "let m = new DOMMatrixReadOnly([2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]);"
2080                 + "let rotated = m.rotateAxisAngle(0, 0, 1, 360);"
2081                 + "dump(rotated);"
2082                 + "</script></body></html>";
2083         loadPageVerifyTitle2(html);
2084     }
2085 
2086     /**
2087      * @throws Exception on test failure
2088      */
2089     @Test
2090     @Alerts({"[6, 7, -2, -3, 14, 15]",
2091              "1[6, 7, 8, 9]",
2092              "2[-2, -3, -4, -5]",
2093              "3[10, 11, 12, 13]",
2094              "4[14, 15, 16, 17]",
2095              "false"})
2096     public void rotateAxisAngle_16_90_z() throws Exception {
2097         final String html = DOCTYPE_HTML
2098                 + "<html><body><script>"
2099                 + LOG_TITLE_FUNCTION
2100                 + DUMP_FUNCTION
2101                 + "let m = new DOMMatrixReadOnly([2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]);"
2102                 + "let rotated = m.rotateAxisAngle(0, 0, 1, 90);"
2103                 + "dump(rotated);"
2104                 + "</script></body></html>";
2105         loadPageVerifyTitle2(html);
2106     }
2107 
2108     /**
2109      * @throws Exception on test failure
2110      */
2111     @Test
2112     @Alerts({"true", "true",
2113              "[2, 3, 10, 11, 14, 15]",
2114              "1[2, 3, 4, 5]",
2115              "2[10, 11, 12, 13]",
2116              "3[-6, -7, -8, -9]",
2117              "4[14, 15, 16, 17]",
2118              "false"})
2119     public void rotateAxisAngle_16_90_x() throws Exception {
2120         final String html = DOCTYPE_HTML
2121                 + "<html><body><script>"
2122                 + LOG_TITLE_FUNCTION
2123                 + DUMP_FUNCTION
2124                 + "let m = new DOMMatrixReadOnly([2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]);"
2125                 + "let rotated = m.rotateAxisAngle(1, 0, 0, 90);"
2126                 + "log(rotated instanceof DOMMatrixReadOnly);\n"
2127                 + "log(rotated instanceof DOMMatrix);\n"
2128                 + "dump(rotated);"
2129                 + "</script></body></html>";
2130         loadPageVerifyTitle2(html);
2131     }
2132 
2133     /**
2134      * @throws Exception on test failure
2135      */
2136     @Test
2137     @Alerts({"[2, 3, -10, -11, 14, 15]",
2138              "1[2, 3, 4, 5]",
2139              "2[-10, -11, -12, -13]",
2140              "3[6, 7, 8, 9]",
2141              "4[14, 15, 16, 17]",
2142              "false"})
2143     public void rotateAxisAngle_16_270_x() throws Exception {
2144         final String html = DOCTYPE_HTML
2145                 + "<html><body><script>"
2146                 + LOG_TITLE_FUNCTION
2147                 + DUMP_FUNCTION
2148                 + "let m = new DOMMatrixReadOnly([2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]);"
2149                 + "let rotated = m.rotateAxisAngle(1, 0, 0, 270);"
2150                 + "dump(rotated);"
2151                 + "</script></body></html>";
2152         loadPageVerifyTitle2(html);
2153     }
2154 
2155     /**
2156      * @throws Exception on test failure
2157      */
2158     @Test
2159     @Alerts(DEFAULT = {"[1, 0, 0, 1, 0, 0]",
2160                        "1[1, 0, 0, 0]",
2161                        "2[0, 1, 0, 0]",
2162                        "3[0, 0, 1, 0]",
2163                        "4[0, 0, 0, 1]",
2164                        "true"},
2165             FF_ESR = {"[1, 0, 0, 1, 0, 0]",
2166                       "1[1, 0, 0, 0]",
2167                       "2[0, 1, 0, 0]",
2168                       "3[0, 0, 1, 0]",
2169                       "4[0, 0, 0, 1]",
2170                       "false"})
2171     @HtmlUnitNYI(FF_ESR = {"[1, 0, 0, 1, 0, 0]",
2172                            "1[1, 0, 0, 0]",
2173                            "2[0, 1, 0, 0]",
2174                            "3[0, 0, 1, 0]",
2175                            "4[0, 0, 0, 1]",
2176                            "true"})
2177     public void rotateAxisAngle_invalid_axis() throws Exception {
2178         final String html = DOCTYPE_HTML
2179                 + "<html><body><script>"
2180                 + LOG_TITLE_FUNCTION
2181                 + DUMP_FUNCTION
2182                 + "try {"
2183                 + "  let m = new DOMMatrixReadOnly();"
2184                 + "  let rotated = m.rotateAxisAngle(0, 0, 0, 90);"
2185                 + "  dump(rotated);"
2186                 + "} catch(e) { logEx(e); }"
2187                 + "</script></body></html>";
2188         loadPageVerifyTitle2(html);
2189     }
2190 
2191     /**
2192      * @throws Exception on test failure
2193      */
2194     @Test
2195     @Alerts(DEFAULT = {"[1, 0, 0, 1, 0, 0]",
2196                        "1[1, 0, 0, 0]",
2197                        "2[0, 1, 0, 0]",
2198                        "3[0, 0, 1, 0]",
2199                        "4[0, 0, 0, 1]",
2200                        "false"},
2201             FF = {"[1, 0, 0, 1, 0, 0]",
2202                   "1[1, 0, 0, 0]",
2203                   "2[0, 1, 0, 0]",
2204                   "3[0, 0, 1, 0]",
2205                   "4[0, 0, 0, 1]",
2206                   "true"},
2207             FF_ESR = {"[1, 0, 0, 1, 0, 0]",
2208                       "1[1, 0, 0, 0]",
2209                       "2[0, 1, 0, 0]",
2210                       "3[0, 0, 1, 0]",
2211                       "4[0, 0, 0, 1]",
2212                       "true"})
2213     @HtmlUnitNYI(
2214             FF = {"[1, 0, 0, 1, 0, 0]",
2215                   "1[1, 0, 0, 0]",
2216                   "2[0, 1, 0, 0]",
2217                   "3[0, 0, 1, 0]",
2218                   "4[0, 0, 0, 1]",
2219                   "false"},
2220             FF_ESR = {"[1, 0, 0, 1, 0, 0]",
2221                       "1[1, 0, 0, 0]",
2222                       "2[0, 1, 0, 0]",
2223                       "3[0, 0, 1, 0]",
2224                       "4[0, 0, 0, 1]",
2225                       "false"})
2226     public void rotateAxisAngle_missing_arguments() throws Exception {
2227         final String html = DOCTYPE_HTML
2228                 + "<html><body><script>"
2229                 + LOG_TITLE_FUNCTION
2230                 + DUMP_FUNCTION
2231                 + "try {"
2232                 + "  let m = new DOMMatrixReadOnly();"
2233                 + "  let rotated = m.rotateAxisAngle(1, 0, 0);"
2234                 + "  dump(rotated);"
2235                 + "} catch(e) { logEx(e); }"
2236                 + "</script></body></html>";
2237         loadPageVerifyTitle2(html);
2238     }
2239 
2240     /**
2241      * @throws Exception on test failure
2242      */
2243     @Test
2244     @Alerts(DEFAULT = {"[NaN, NaN, NaN, NaN, 0, 0]",
2245                        "1[NaN, NaN, NaN, NaN]",
2246                        "2[NaN, NaN, NaN, NaN]",
2247                        "3[0, 0, 1, 0]",
2248                        "4[0, 0, 0, 1]",
2249                        "true"},
2250             FF = {"[NaN, NaN, NaN, NaN, 0, 0]",
2251                   "1[NaN, NaN, 0, 0]",
2252                   "2[NaN, NaN, 0, 0]",
2253                   "3[0, 0, 1, 0]",
2254                   "4[0, 0, 0, 1]",
2255                   "true"},
2256             FF_ESR = {"[NaN, NaN, NaN, NaN, 0, 0]",
2257                       "1[NaN, NaN, NaN, NaN]",
2258                       "2[NaN, NaN, NaN, NaN]",
2259                       "3[NaN, NaN, NaN, NaN]",
2260                       "4[0, 0, 0, 1]",
2261                       "false"})
2262     @HtmlUnitNYI(
2263             CHROME = {"[NaN, NaN, NaN, NaN, 0, 0]",
2264                       "1[NaN, NaN, NaN, NaN]",
2265                       "2[NaN, NaN, NaN, NaN]",
2266                       "3[NaN, NaN, NaN, NaN]",
2267                       "4[0, 0, 0, 1]",
2268                       "true"},
2269             EDGE = {"[NaN, NaN, NaN, NaN, 0, 0]",
2270                     "1[NaN, NaN, NaN, NaN]",
2271                     "2[NaN, NaN, NaN, NaN]",
2272                     "3[NaN, NaN, NaN, NaN]",
2273                     "4[0, 0, 0, 1]",
2274                     "true"},
2275             FF = {"[NaN, NaN, NaN, NaN, 0, 0]",
2276                   "1[NaN, NaN, NaN, NaN]",
2277                   "2[NaN, NaN, NaN, NaN]",
2278                   "3[NaN, NaN, NaN, NaN]",
2279                   "4[0, 0, 0, 1]",
2280                   "true"},
2281             FF_ESR = {"[NaN, NaN, NaN, NaN, 0, 0]",
2282                       "1[NaN, NaN, NaN, NaN]",
2283                       "2[NaN, NaN, NaN, NaN]",
2284                       "3[NaN, NaN, NaN, NaN]",
2285                       "4[0, 0, 0, 1]",
2286                       "true"})
2287     public void rotateAxisAngle_NaN_angle() throws Exception {
2288         final String html = DOCTYPE_HTML
2289                 + "<html><body><script>"
2290                 + LOG_TITLE_FUNCTION
2291                 + DUMP_FUNCTION
2292                 + "let m = new DOMMatrixReadOnly();"
2293                 + "let rotated = m.rotateAxisAngle(0, 0, 1, NaN);"
2294                 + "dump(rotated);"
2295                 + "</script></body></html>";
2296         loadPageVerifyTitle2(html);
2297     }
2298 
2299     /**
2300      * @throws Exception on test failure
2301      */
2302     @Test
2303     @Alerts(DEFAULT = {"[NaN, NaN, NaN, NaN, 0, 0]",
2304                        "1[NaN, NaN, NaN, NaN]",
2305                        "2[NaN, NaN, NaN, NaN]",
2306                        "3[0, 0, 1, 0]",
2307                        "4[0, 0, 0, 1]",
2308                        "true"},
2309             FF = {"[NaN, NaN, NaN, NaN, 0, 0]",
2310                   "1[NaN, NaN, 0, 0]",
2311                   "2[NaN, NaN, 0, 0]",
2312                   "3[0, 0, 1, 0]",
2313                   "4[0, 0, 0, 1]",
2314                   "true"},
2315             FF_ESR = {"[NaN, NaN, NaN, NaN, 0, 0]",
2316                       "1[NaN, NaN, NaN, NaN]",
2317                       "2[NaN, NaN, NaN, NaN]",
2318                       "3[NaN, NaN, NaN, NaN]",
2319                       "4[0, 0, 0, 1]",
2320                       "false"})
2321     @HtmlUnitNYI(
2322             CHROME = {"[NaN, NaN, NaN, NaN, 0, 0]",
2323                       "1[NaN, NaN, NaN, NaN]",
2324                       "2[NaN, NaN, NaN, NaN]",
2325                       "3[NaN, NaN, NaN, NaN]",
2326                       "4[0, 0, 0, 1]",
2327                       "true"},
2328             EDGE = {"[NaN, NaN, NaN, NaN, 0, 0]",
2329                     "1[NaN, NaN, NaN, NaN]",
2330                     "2[NaN, NaN, NaN, NaN]",
2331                     "3[NaN, NaN, NaN, NaN]",
2332                     "4[0, 0, 0, 1]",
2333                     "true"},
2334             FF = {"[NaN, NaN, NaN, NaN, 0, 0]",
2335                   "1[NaN, NaN, NaN, NaN]",
2336                   "2[NaN, NaN, NaN, NaN]",
2337                   "3[NaN, NaN, NaN, NaN]",
2338                   "4[0, 0, 0, 1]",
2339                   "true"},
2340             FF_ESR = {"[NaN, NaN, NaN, NaN, 0, 0]",
2341                       "1[NaN, NaN, NaN, NaN]",
2342                       "2[NaN, NaN, NaN, NaN]",
2343                       "3[NaN, NaN, NaN, NaN]",
2344                       "4[0, 0, 0, 1]",
2345                       "true"})
2346     public void rotateAxisAngle_Infinity_angle() throws Exception {
2347         final String html = DOCTYPE_HTML
2348                 + "<html><body><script>"
2349                 + LOG_TITLE_FUNCTION
2350                 + DUMP_FUNCTION
2351                 + "let m = new DOMMatrixReadOnly();"
2352                 + "let rotated = m.rotateAxisAngle(0, 0, 1, Infinity);"
2353                 + "dump(rotated);"
2354                 + "</script></body></html>";
2355         loadPageVerifyTitle2(html);
2356     }
2357 
2358     /**
2359      * @throws Exception on test failure
2360      */
2361     @Test
2362     @Alerts("1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1")
2363     public void toFloat32Array_identity() throws Exception {
2364         final String html = DOCTYPE_HTML
2365                 + "<html>\n"
2366                 + "<body>\n"
2367                 + "<script>\n"
2368                 + LOG_TITLE_FUNCTION
2369                 + "let m = new DOMMatrixReadOnly();\n"
2370                 + "let array = m.toFloat32Array();\n"
2371                 + "log(array);\n"
2372                 + "</script>\n"
2373                 + "</body></html>";
2374 
2375         loadPageVerifyTitle2(html);
2376     }
2377 
2378     /**
2379      * @throws Exception on test failure
2380      */
2381     @Test
2382     @Alerts("1,2,0,0,3,4,0,0,0,0,1,0,5,6,0,1")
2383     public void toFloat32Array_customValues6() throws Exception {
2384         final String html = DOCTYPE_HTML
2385                 + "<html>\n"
2386                 + "<body>\n"
2387                 + "<script>\n"
2388                 + LOG_TITLE_FUNCTION
2389                 + "let m = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);\n"
2390                 + "let array = m.toFloat32Array();\n"
2391                 + "log(array);\n"
2392                 + "</script>\n"
2393                 + "</body></html>";
2394 
2395         loadPageVerifyTitle2(html);
2396     }
2397 
2398     /**
2399      * @throws Exception on test failure
2400      */
2401     @Test
2402     @Alerts("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16")
2403     public void toFloat32Array_customValues16() throws Exception {
2404         final String html = DOCTYPE_HTML
2405                 + "<html>\n"
2406                 + "<body>\n"
2407                 + "<script>\n"
2408                 + LOG_TITLE_FUNCTION
2409                 + "let m = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6,7 ,8, 9, 10, 11, 12, 13, 14, 15, 16]);\n"
2410                 + "let array = m.toFloat32Array();\n"
2411                 + "log(array);\n"
2412                 + "</script>\n"
2413                 + "</body></html>";
2414 
2415         loadPageVerifyTitle2(html);
2416     }
2417 
2418     /**
2419      * @throws Exception on test failure
2420      */
2421     @Test
2422     @Alerts("NaN,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1")
2423     public void toFloat32Array_withNaN() throws Exception {
2424         final String html = DOCTYPE_HTML
2425                 + "<html>\n"
2426                 + "<body>\n"
2427                 + "<script>\n"
2428                 + LOG_TITLE_FUNCTION
2429                 + "let m = new DOMMatrixReadOnly([NaN, 0, 0, 1, 0, 0]);\n"
2430                 + "let array = m.toFloat32Array();\n"
2431                 + "log(array);\n"
2432                 + "</script>\n"
2433                 + "</body></html>";
2434 
2435         loadPageVerifyTitle2(html);
2436     }
2437 
2438     /**
2439      * @throws Exception on test failure
2440      */
2441     @Test
2442     @Alerts("Infinity,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1")
2443     public void toFloat32Array_withInfinity() throws Exception {
2444         final String html = DOCTYPE_HTML
2445                 + "<html>\n"
2446                 + "<body>\n"
2447                 + "<script>\n"
2448                 + LOG_TITLE_FUNCTION
2449                 + "let m = new DOMMatrixReadOnly([Infinity, 0, 0, 1, 0, 0]);\n"
2450                 + "let array = m.toFloat32Array();\n"
2451                 + "log(array);\n"
2452                 + "</script>\n"
2453                 + "</body></html>";
2454 
2455         loadPageVerifyTitle2(html);
2456     }
2457 
2458     /**
2459      * @throws Exception on test failure
2460      */
2461     @Test
2462     @Alerts("1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1")
2463     public void toFloat64Array_identity() throws Exception {
2464         final String html = DOCTYPE_HTML
2465                 + "<html>\n"
2466                 + "<body>\n"
2467                 + "<script>\n"
2468                 + LOG_TITLE_FUNCTION
2469                 + "let m = new DOMMatrixReadOnly();\n"
2470                 + "let array = m.toFloat64Array();\n"
2471                 + "log(array);\n"
2472                 + "</script>\n"
2473                 + "</body></html>";
2474 
2475         loadPageVerifyTitle2(html);
2476     }
2477 
2478     /**
2479      * @throws Exception on test failure
2480      */
2481     @Test
2482     @Alerts("1,2,0,0,3,4,0,0,0,0,1,0,5,6,0,1")
2483     public void toFloat64Array_customValues6() throws Exception {
2484         final String html = DOCTYPE_HTML
2485                 + "<html>\n"
2486                 + "<body>\n"
2487                 + "<script>\n"
2488                 + LOG_TITLE_FUNCTION
2489                 + "let m = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);\n"
2490                 + "let array = m.toFloat64Array();\n"
2491                 + "log(array);\n"
2492                 + "</script>\n"
2493                 + "</body></html>";
2494 
2495         loadPageVerifyTitle2(html);
2496     }
2497 
2498     /**
2499      * @throws Exception on test failure
2500      */
2501     @Test
2502     @Alerts("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16")
2503     public void toFloat64Array_customValues16() throws Exception {
2504         final String html = DOCTYPE_HTML
2505                 + "<html>\n"
2506                 + "<body>\n"
2507                 + "<script>\n"
2508                 + LOG_TITLE_FUNCTION
2509                 + "let m = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ,13, 14, 15, 16]);\n"
2510                 + "let array = m.toFloat64Array();\n"
2511                 + "log(array);\n"
2512                 + "</script>\n"
2513                 + "</body></html>";
2514 
2515         loadPageVerifyTitle2(html);
2516     }
2517 
2518     /**
2519      * @throws Exception on test failure
2520      */
2521     @Test
2522     @Alerts("NaN,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1")
2523     public void toFloat64Array_withNaN() throws Exception {
2524         final String html = DOCTYPE_HTML
2525                 + "<html>\n"
2526                 + "<body>\n"
2527                 + "<script>\n"
2528                 + LOG_TITLE_FUNCTION
2529                 + "let m = new DOMMatrixReadOnly([NaN, 0, 0, 1, 0, 0]);\n"
2530                 + "let array = m.toFloat64Array();\n"
2531                 + "log(array);\n"
2532                 + "</script>\n"
2533                 + "</body></html>";
2534 
2535         loadPageVerifyTitle2(html);
2536     }
2537 
2538     /**
2539      * @throws Exception on test failure
2540      */
2541     @Test
2542     @Alerts("Infinity,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1")
2543     public void toFloat64Array_withInfinity() throws Exception {
2544         final String html = DOCTYPE_HTML
2545                 + "<html>\n"
2546                 + "<body>\n"
2547                 + "<script>\n"
2548                 + LOG_TITLE_FUNCTION
2549                 + "let m = new DOMMatrixReadOnly([Infinity, 0, 0, 1, 0, 0]);\n"
2550                 + "let array = m.toFloat64Array();\n"
2551                 + "log(array);\n"
2552                 + "</script>\n"
2553                 + "</body></html>";
2554 
2555         loadPageVerifyTitle2(html);
2556     }
2557 
2558     /**
2559      * @throws Exception on test failure
2560      */
2561     @Test
2562     @Alerts({"[1, 0, 0.577, 1, 0, 0]",
2563              "1[1, 0, 0, 0]",
2564              "2[0.577, 1, 0, 0]",
2565              "3[0, 0, 1, 0]",
2566              "4[0, 0, 0, 1]",
2567              "true"})
2568     public void skewX_30degrees() throws Exception {
2569         final String html = DOCTYPE_HTML
2570                 + "<html>\n"
2571                 + "<body>\n"
2572                 + "<script>\n"
2573                 + LOG_TITLE_FUNCTION
2574                 + DUMP_FUNCTION
2575                 + "let m = new DOMMatrixReadOnly();\n"
2576                 + "let skewed = m.skewX(30);\n"
2577                 + "dump(skewed);\n"
2578                 + "</script>\n"
2579                 + "</body></html>";
2580 
2581         loadPageVerifyTitle2(html);
2582     }
2583 
2584     /**
2585      * @throws Exception on test failure
2586      */
2587     @Test
2588     @Alerts({"[1, 0, 0, 1, 0, 0]",
2589              "1[1, 0, 0, 0]",
2590              "2[0, 1, 0, 0]",
2591              "3[0, 0, 1, 0]",
2592              "4[0, 0, 0, 1]",
2593              "true"})
2594     public void skewX_0degrees() throws Exception {
2595         final String html = DOCTYPE_HTML
2596                 + "<html>\n"
2597                 + "<body>\n"
2598                 + "<script>\n"
2599                 + LOG_TITLE_FUNCTION
2600                 + DUMP_FUNCTION
2601                 + "let m = new DOMMatrixReadOnly();\n"
2602                 + "let skewed = m.skewX(0);\n"
2603                 + "dump(skewed);\n"
2604                 + "</script>\n"
2605                 + "</body></html>";
2606 
2607         loadPageVerifyTitle2(html);
2608     }
2609 
2610     /**
2611      * @throws Exception on test failure
2612      */
2613     @Test
2614     @Alerts({"[1, 0, 0, 1, 0, 0]",
2615              "1[1, 0, 0, 0]",
2616              "2[0, 1, 0, 0]",
2617              "3[0, 0, 1, 0]",
2618              "4[0, 0, 0, 1]",
2619              "true"})
2620     public void skewX_noParam() throws Exception {
2621         final String html = DOCTYPE_HTML
2622                 + "<html>\n"
2623                 + "<body>\n"
2624                 + "<script>\n"
2625                 + LOG_TITLE_FUNCTION
2626                 + DUMP_FUNCTION
2627                 + "let m = new DOMMatrixReadOnly();\n"
2628                 + "let skewed = m.skewX();\n"
2629                 + "dump(skewed);\n"
2630                 + "</script>\n"
2631                 + "</body></html>";
2632 
2633         loadPageVerifyTitle2(html);
2634     }
2635 
2636     /**
2637      * @throws Exception on test failure
2638      */
2639     @Test
2640     @Alerts({"[1, 0.577, 0, 1, 0, 0]",
2641              "1[1, 0.577, 0, 0]",
2642              "2[0, 1, 0, 0]",
2643              "3[0, 0, 1, 0]",
2644              "4[0, 0, 0, 1]",
2645              "true"})
2646     public void skewY_30degrees() throws Exception {
2647         final String html = DOCTYPE_HTML
2648                 + "<html>\n"
2649                 + "<body>\n"
2650                 + "<script>\n"
2651                 + LOG_TITLE_FUNCTION
2652                 + DUMP_FUNCTION
2653                 + "let m = new DOMMatrixReadOnly();\n"
2654                 + "let skewed = m.skewY(30);\n"
2655                 + "dump(skewed);\n"
2656                 + "</script>\n"
2657                 + "</body></html>";
2658 
2659         loadPageVerifyTitle2(html);
2660     }
2661 
2662     /**
2663      * @throws Exception on test failure
2664      */
2665     @Test
2666     @Alerts({"[1, 0, 0, 1, 0, 0]",
2667              "1[1, 0, 0, 0]",
2668              "2[0, 1, 0, 0]",
2669              "3[0, 0, 1, 0]",
2670              "4[0, 0, 0, 1]",
2671              "true"})
2672     public void skewY_0degrees() throws Exception {
2673         final String html = DOCTYPE_HTML
2674                 + "<html>\n"
2675                 + "<body>\n"
2676                 + "<script>\n"
2677                 + LOG_TITLE_FUNCTION
2678                 + DUMP_FUNCTION
2679                 + "let m = new DOMMatrixReadOnly();\n"
2680                 + "let skewed = m.skewY(0);\n"
2681                 + "dump(skewed);\n"
2682                 + "</script>\n"
2683                 + "</body></html>";
2684 
2685         loadPageVerifyTitle2(html);
2686     }
2687 
2688     /**
2689      * @throws Exception on test failure
2690      */
2691     @Test
2692     @Alerts({"[1, 0, 0, 1, 0, 0]",
2693              "1[1, 0, 0, 0]",
2694              "2[0, 1, 0, 0]",
2695              "3[0, 0, 1, 0]",
2696              "4[0, 0, 0, 1]",
2697              "true"})
2698     public void skewY_noParam() throws Exception {
2699         final String html = DOCTYPE_HTML
2700                 + "<html>\n"
2701                 + "<body>\n"
2702                 + "<script>\n"
2703                 + LOG_TITLE_FUNCTION
2704                 + DUMP_FUNCTION
2705                 + "let m = new DOMMatrixReadOnly();\n"
2706                 + "let skewed = m.skewY();\n"
2707                 + "dump(skewed);\n"
2708                 + "</script>\n"
2709                 + "</body></html>";
2710 
2711         loadPageVerifyTitle2(html);
2712     }
2713 
2714     /**
2715      * @throws Exception on test failure
2716      */
2717     @Test
2718     @Alerts({"true", "true",
2719              "[1, 0, 0.9, 1, 5, 6]",
2720              "1[1, 0, 0, 0]",
2721              "2[0.9, 1, 0, 0]",
2722              "3[0, 0, 1, 0]",
2723              "4[5, 6, 0, 1]",
2724              "true"})
2725     public void skewX_6elements() throws Exception {
2726         final String html = DOCTYPE_HTML
2727                 + "<html>\n"
2728                 + "<body>\n"
2729                 + "<script>\n"
2730                 + LOG_TITLE_FUNCTION
2731                 + DUMP_FUNCTION
2732                 + "let m = new DOMMatrixReadOnly([1, 0, 0, 1, 5, 6]);\n"
2733                 + "let skewed = m.skewX(42);\n"
2734                 + "log(skewed instanceof DOMMatrixReadOnly);\n"
2735                 + "log(skewed instanceof DOMMatrix);\n"
2736                 + "dump(skewed);\n"
2737                 + "</script>\n"
2738                 + "</body></html>";
2739 
2740         loadPageVerifyTitle2(html);
2741     }
2742 
2743     /**
2744      * @throws Exception on test failure
2745      */
2746     @Test
2747     @Alerts({"true", "true",
2748              "[1, 0.9, 0, 1, 5, 6]",
2749              "1[1, 0.9, 0, 0]",
2750              "2[0, 1, 0, 0]",
2751              "3[0, 0, 1, 0]",
2752              "4[5, 6, 0, 1]",
2753              "true"})
2754     public void skewY_6elements() throws Exception {
2755         final String html = DOCTYPE_HTML
2756                 + "<html>\n"
2757                 + "<body>\n"
2758                 + "<script>\n"
2759                 + LOG_TITLE_FUNCTION
2760                 + DUMP_FUNCTION
2761                 + "let m = new DOMMatrixReadOnly([1, 0, 0, 1, 5, 6]);\n"
2762                 + "let skewed = m.skewY(42);\n"
2763                 + "log(skewed instanceof DOMMatrixReadOnly);\n"
2764                 + "log(skewed instanceof DOMMatrix);\n"
2765                 + "dump(skewed);\n"
2766                 + "</script>\n"
2767                 + "</body></html>";
2768 
2769         loadPageVerifyTitle2(html);
2770     }
2771 
2772     /**
2773      * @throws Exception on test failure
2774      */
2775     @Test
2776     @Alerts({"true", "true",
2777              "[1, 0, 5.9, 6, 13, 14]",
2778              "1[1, 0, 0, 1]",
2779              "2[5.9, 6, 7, 8.9]",
2780              "3[9, 10, 11, 12]",
2781              "4[13, 14, 15, 16]",
2782              "false"})
2783     public void skewX_16elements() throws Exception {
2784         final String html = DOCTYPE_HTML
2785                 + "<html>\n"
2786                 + "<body>\n"
2787                 + "<script>\n"
2788                 + LOG_TITLE_FUNCTION
2789                 + DUMP_FUNCTION
2790                 + "let m = new DOMMatrixReadOnly([1, 0, 0, 1, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);\n"
2791                 + "let skewed = m.skewX(42);\n"
2792                 + "log(skewed instanceof DOMMatrixReadOnly);\n"
2793                 + "log(skewed instanceof DOMMatrix);\n"
2794                 + "dump(skewed);\n"
2795                 + "</script>\n"
2796                 + "</body></html>";
2797 
2798         loadPageVerifyTitle2(html);
2799     }
2800 
2801     /**
2802      * @throws Exception on test failure
2803      */
2804     @Test
2805     @Alerts({"true", "true",
2806              "[5.502, 5.402, 5, 6, 13, 14]",
2807              "1[5.502, 5.402, 6.303, 8.203]",
2808              "2[5, 6, 7, 8]",
2809              "3[9, 10, 11, 12]",
2810              "4[13, 14, 15, 16]",
2811              "false"})
2812     public void skewY_16elements() throws Exception {
2813         final String html = DOCTYPE_HTML
2814                 + "<html>\n"
2815                 + "<body>\n"
2816                 + "<script>\n"
2817                 + LOG_TITLE_FUNCTION
2818                 + DUMP_FUNCTION
2819                 + "let m = new DOMMatrixReadOnly([1, 0, 0, 1, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);\n"
2820                 + "let skewed = m.skewY(42);\n"
2821                 + "log(skewed instanceof DOMMatrixReadOnly);\n"
2822                 + "log(skewed instanceof DOMMatrix);\n"
2823                 + "dump(skewed);\n"
2824                 + "</script>\n"
2825                 + "</body></html>";
2826 
2827         loadPageVerifyTitle2(html);
2828     }
2829 
2830     /**
2831      * @throws Exception on test failure
2832      */
2833     @Test
2834     @Alerts({"true", "true",
2835              "[1, 0, 5, 6, 123, 134]",
2836              "1[1, 0, 0, 1]",
2837              "2[5, 6, 7, 8]",
2838              "3[9, 10, 11, 12]",
2839              "4[123, 134, 155, 186]",
2840              "false"})
2841     public void translate_16elements_positiveValues() throws Exception {
2842         final String html = DOCTYPE_HTML
2843                 + "<html>\n"
2844                 + "<body>\n"
2845                 + "<script>\n"
2846                 + LOG_TITLE_FUNCTION
2847                 + DUMP_FUNCTION
2848                 + "let m = new DOMMatrixReadOnly([1, 0, 0, 1, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);\n"
2849                 + "let translated = m.translate(10, 20);\n"
2850                 + "log(translated instanceof DOMMatrixReadOnly);\n"
2851                 + "log(translated instanceof DOMMatrix);\n"
2852                 + "dump(translated);\n"
2853                 + "</script>\n"
2854                 + "</body></html>";
2855 
2856         loadPageVerifyTitle2(html);
2857     }
2858 
2859     /**
2860      * @throws Exception on test failure
2861      */
2862     @Test
2863     @Alerts({"true", "true",
2864              "[1, 0, 0, 1, 15, 26]",
2865              "1[1, 0, 0, 0]",
2866              "2[0, 1, 0, 0]",
2867              "3[0, 0, 1, 0]",
2868              "4[15, 26, 0, 1]",
2869              "true"})
2870     public void translate_6elements_positiveValues() throws Exception {
2871         final String html = DOCTYPE_HTML
2872                 + "<html>\n"
2873                 + "<body>\n"
2874                 + "<script>\n"
2875                 + LOG_TITLE_FUNCTION
2876                 + DUMP_FUNCTION
2877                 + "let m = new DOMMatrixReadOnly([1, 0, 0, 1, 5, 6]);\n"
2878                 + "let translated = m.translate(10, 20);\n"
2879                 + "log(translated instanceof DOMMatrixReadOnly);\n"
2880                 + "log(translated instanceof DOMMatrix);\n"
2881                 + "dump(translated);\n"
2882                 + "</script>\n"
2883                 + "</body></html>";
2884 
2885         loadPageVerifyTitle2(html);
2886     }
2887 
2888     /**
2889      * @throws Exception on test failure
2890      */
2891     @Test
2892     @Alerts({"[1, 0, 5, 6, -97, -106]",
2893              "1[1, 0, 0, 1]",
2894              "2[5, 6, 7, 8]",
2895              "3[9, 10, 11, 12]",
2896              "4[-97, -106, -125, -154]",
2897              "false"})
2898     public void translate_16elements_negativeValues() throws Exception {
2899         final String html = DOCTYPE_HTML
2900                 + "<html>\n"
2901                 + "<body>\n"
2902                 + "<script>\n"
2903                 + LOG_TITLE_FUNCTION
2904                 + DUMP_FUNCTION
2905                 + "let m = new DOMMatrixReadOnly([1, 0, 0, 1, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);\n"
2906                 + "let translated = m.translate(-10, -20);\n"
2907                 + "dump(translated);\n"
2908                 + "</script>\n"
2909                 + "</body></html>";
2910 
2911         loadPageVerifyTitle2(html);
2912     }
2913 
2914     /**
2915      * @throws Exception on test failure
2916      */
2917     @Test
2918     @Alerts({"[10, 11, 1, -5, -120, -3]",
2919              "1[10, 11, 0, 0]",
2920              "2[1, -5, 0, 0]",
2921              "3[0, 0, 1, 0]",
2922              "4[-120, -3, 0, 1]",
2923              "true"})
2924     public void translate_6elements_negativeValues() throws Exception {
2925         final String html = DOCTYPE_HTML
2926                 + "<html>\n"
2927                 + "<body>\n"
2928                 + "<script>\n"
2929                 + LOG_TITLE_FUNCTION
2930                 + DUMP_FUNCTION
2931                 + "let m = new DOMMatrixReadOnly([10, 11, 1, -5, 0, 7]);\n"
2932                 + "let translated = m.translate(-10, -20);\n"
2933                 + "dump(translated);\n"
2934                 + "</script>\n"
2935                 + "</body></html>";
2936 
2937         loadPageVerifyTitle2(html);
2938     }
2939 
2940     /**
2941      * @throws Exception on test failure
2942      */
2943     @Test
2944     @Alerts({"[1, 0, 0, 1, 0, 0]",
2945              "1[1, 0, 0, 0]",
2946              "2[0, 1, 0, 0]",
2947              "3[0, 0, 1, 0]",
2948              "4[0, 0, 0, 1]",
2949              "true"})
2950     public void translate_zeroValues() throws Exception {
2951         final String html = DOCTYPE_HTML
2952                 + "<html>\n"
2953                 + "<body>\n"
2954                 + "<script>\n"
2955                 + LOG_TITLE_FUNCTION
2956                 + DUMP_FUNCTION
2957                 + "let m = new DOMMatrixReadOnly();\n"
2958                 + "let translated = m.translate(0, 0);\n"
2959                 + "dump(translated);\n"
2960                 + "</script>\n"
2961                 + "</body></html>";
2962 
2963         loadPageVerifyTitle2(html);
2964     }
2965 
2966     /**
2967      * @throws Exception on test failure
2968      */
2969     @Test
2970     @Alerts({"[1, 0, 0, 1, NaN, NaN]",
2971              "1[1, 0, 0, 0]",
2972              "2[0, 1, 0, 0]",
2973              "3[0, 0, 1, 0]",
2974              "4[NaN, NaN, 0, 1]",
2975              "true"})
2976     @HtmlUnitNYI(
2977             CHROME = {"[1, 0, 0, 1, NaN, NaN]",
2978                       "1[1, 0, 0, 0]",
2979                       "2[0, 1, 0, 0]",
2980                       "3[0, 0, 1, 0]",
2981                       "4[NaN, NaN, NaN, NaN]",
2982                       "true"},
2983             EDGE = {"[1, 0, 0, 1, NaN, NaN]",
2984                     "1[1, 0, 0, 0]",
2985                     "2[0, 1, 0, 0]",
2986                     "3[0, 0, 1, 0]",
2987                     "4[NaN, NaN, NaN, NaN]",
2988                     "true"},
2989             FF = {"[1, 0, 0, 1, NaN, NaN]",
2990                   "1[1, 0, 0, 0]",
2991                   "2[0, 1, 0, 0]",
2992                   "3[0, 0, 1, 0]",
2993                   "4[NaN, NaN, NaN, NaN]",
2994                   "true"},
2995             FF_ESR = {"[1, 0, 0, 1, NaN, NaN]",
2996                       "1[1, 0, 0, 0]",
2997                       "2[0, 1, 0, 0]",
2998                       "3[0, 0, 1, 0]",
2999                       "4[NaN, NaN, NaN, NaN]",
3000                       "true"})
3001     public void translate_withNaN() throws Exception {
3002         final String html = DOCTYPE_HTML
3003                 + "<html>\n"
3004                 + "<body>\n"
3005                 + "<script>\n"
3006                 + LOG_TITLE_FUNCTION
3007                 + DUMP_FUNCTION
3008                 + "let m = new DOMMatrixReadOnly();\n"
3009                 + "let translated = m.translate(NaN, NaN);\n"
3010                 + "dump(translated);\n"
3011                 + "</script>\n"
3012                 + "</body></html>";
3013 
3014         loadPageVerifyTitle2(html);
3015     }
3016 
3017     /**
3018      * @throws Exception on test failure
3019      */
3020     @Test
3021     @Alerts(DEFAULT = {"[1, 0, 0, 1, Infinity, Infinity]",
3022                        "1[1, 0, 0, 0]",
3023                        "2[0, 1, 0, 0]",
3024                        "3[0, 0, 1, 0]",
3025                        "4[Infinity, Infinity, 0, 1]",
3026                        "true"},
3027             FF = {"[1, 0, 0, 1, NaN, NaN]",
3028                   "1[1, 0, 0, 0]",
3029                   "2[0, 1, 0, 0]",
3030                   "3[0, 0, 1, 0]",
3031                   "4[NaN, NaN, 0, 1]",
3032                   "true"},
3033             FF_ESR = {"[1, 0, 0, 1, NaN, NaN]",
3034                       "1[1, 0, 0, 0]",
3035                       "2[0, 1, 0, 0]",
3036                       "3[0, 0, 1, 0]",
3037                       "4[NaN, NaN, 0, 1]",
3038                       "true"})
3039     @HtmlUnitNYI(
3040             CHROME = {"[1, 0, 0, 1, NaN, NaN]",
3041                       "1[1, 0, 0, 0]",
3042                       "2[0, 1, 0, 0]",
3043                       "3[0, 0, 1, 0]",
3044                       "4[NaN, NaN, NaN, NaN]",
3045                       "true"},
3046             EDGE = {"[1, 0, 0, 1, NaN, NaN]",
3047                     "1[1, 0, 0, 0]",
3048                     "2[0, 1, 0, 0]",
3049                     "3[0, 0, 1, 0]",
3050                     "4[NaN, NaN, NaN, NaN]",
3051                     "true"},
3052             FF = {"[1, 0, 0, 1, NaN, NaN]",
3053                   "1[1, 0, 0, 0]",
3054                   "2[0, 1, 0, 0]",
3055                   "3[0, 0, 1, 0]",
3056                   "4[NaN, NaN, NaN, NaN]",
3057                   "true"},
3058             FF_ESR = {"[1, 0, 0, 1, NaN, NaN]",
3059                       "1[1, 0, 0, 0]",
3060                       "2[0, 1, 0, 0]",
3061                       "3[0, 0, 1, 0]",
3062                       "4[NaN, NaN, NaN, NaN]",
3063                       "true"})
3064     public void translate_withInfinity() throws Exception {
3065         final String html = DOCTYPE_HTML
3066                 + "<html>\n"
3067                 + "<body>\n"
3068                 + "<script>\n"
3069                 + LOG_TITLE_FUNCTION
3070                 + DUMP_FUNCTION
3071                 + "let m = new DOMMatrixReadOnly();\n"
3072                 + "let translated = m.translate(Infinity, Infinity);\n"
3073                 + "dump(translated);\n"
3074                 + "</script>\n"
3075                 + "</body></html>";
3076 
3077         loadPageVerifyTitle2(html);
3078     }
3079 
3080     /**
3081      * @throws Exception on test failure
3082      */
3083     @Test
3084     @Alerts({"[1, 0, 0, 1, 10, 0]",
3085              "1[1, 0, 0, 0]",
3086              "2[0, 1, 0, 0]",
3087              "3[0, 0, 1, 0]",
3088              "4[10, 0, 0, 1]",
3089              "true"})
3090     public void translate_onlyX() throws Exception {
3091         final String html = DOCTYPE_HTML
3092                 + "<html>\n"
3093                 + "<body>\n"
3094                 + "<script>\n"
3095                 + LOG_TITLE_FUNCTION
3096                 + DUMP_FUNCTION
3097                 + "let m = new DOMMatrixReadOnly();\n"
3098                 + "let translated = m.translate(10);\n"
3099                 + "dump(translated);\n"
3100                 + "</script>\n"
3101                 + "</body></html>";
3102 
3103         loadPageVerifyTitle2(html);
3104     }
3105 
3106     /**
3107      * @throws Exception on test failure
3108      */
3109     @Test
3110     @Alerts({"[1, 0, 0, 1, 10, 20]",
3111              "1[1, 0, 0, 0]",
3112              "2[0, 1, 0, 0]",
3113              "3[0, 0, 1, 0]",
3114              "4[10, 20, 30, 1]",
3115              "false"})
3116     public void translate_withZ() throws Exception {
3117         final String html = DOCTYPE_HTML
3118                 + "<html>\n"
3119                 + "<body>\n"
3120                 + "<script>\n"
3121                 + LOG_TITLE_FUNCTION
3122                 + DUMP_FUNCTION
3123                 + "let m = new DOMMatrixReadOnly();\n"
3124                 + "let translated = m.translate(10, 20, 30);\n"
3125                 + "dump(translated);\n"
3126                 + "</script>\n"
3127                 + "</body></html>";
3128 
3129         loadPageVerifyTitle2(html);
3130     }
3131 
3132     /**
3133      * @throws Exception on test failure
3134      */
3135     @Test
3136     @Alerts({"true",
3137              "false",
3138              "false",
3139              "false",
3140              "false",
3141              "false",
3142              "false",
3143              "false",
3144              "true",
3145              "true",
3146              "false",
3147              "true"})
3148     public void isIdentity() throws Exception {
3149         final String html = DOCTYPE_HTML
3150                 + "<html>\n"
3151                 + "<body>\n"
3152                 + "<script>\n"
3153                 + LOG_TITLE_FUNCTION
3154                 + "let m = new DOMMatrixReadOnly();\n"
3155                 + "log(m.isIdentity);\n"
3156 
3157                 + "m = new DOMMatrixReadOnly([0, 0, 0, 0, 0, 0]);"
3158                 + "log(m.isIdentity);\n"
3159 
3160                 + "m = new DOMMatrixReadOnly([1, 0, 0, 0, 0, 0]);"
3161                 + "log(m.isIdentity);\n"
3162                 + "m = new DOMMatrixReadOnly([0, 1, 0, 0, 0, 0]);"
3163                 + "log(m.isIdentity);\n"
3164                 + "m = new DOMMatrixReadOnly([0, 0, 1, 0, 0, 0]);"
3165                 + "log(m.isIdentity);\n"
3166                 + "m = new DOMMatrixReadOnly([0, 0, 0, 1, 0, 0]);"
3167                 + "log(m.isIdentity);\n"
3168                 + "m = new DOMMatrixReadOnly([0, 0, 0, 0, 1, 0]);"
3169                 + "log(m.isIdentity);\n"
3170                 + "m = new DOMMatrixReadOnly([0, 0, 0, 0, 0, 1]);"
3171                 + "log(m.isIdentity);\n"
3172 
3173                 + "m = new DOMMatrixReadOnly([1, 0, 0, 1, 0, 0]);"
3174                 + "log(m.isIdentity);\n"
3175                 + "m = new DOMMatrixReadOnly([1, -0, -0, 1, -0, -0]);"
3176                 + "log(m.isIdentity);\n"
3177 
3178                 + "m = new DOMMatrixReadOnly([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);\n"
3179                 + "log(m.isIdentity);\n"
3180                 + "m = new DOMMatrixReadOnly([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);\n"
3181                 + "log(m.isIdentity);\n"
3182 
3183                 + "</script>\n"
3184                 + "</body></html>";
3185 
3186         loadPageVerifyTitle2(html);
3187     }
3188 
3189     /**
3190      * @throws Exception on test failure
3191      */
3192     @Test
3193     @Alerts("matrix(1, 0, 0, 1, 20, 30)")
3194     public void toString2D() throws Exception {
3195         final String html = DOCTYPE_HTML
3196                 + "<html>\n"
3197                 + "<body>\n"
3198                 + "<script>\n"
3199                 + LOG_TITLE_FUNCTION
3200 
3201                 + "let m = new DOMMatrixReadOnly();\n"
3202                 + "m = m.translate(20, 30);"
3203                 + "log(m.toString());\n"
3204 
3205                 + "</script>\n"
3206                 + "</body></html>";
3207 
3208         loadPageVerifyTitle2(html);
3209     }
3210 
3211     /**
3212      * @throws Exception on test failure
3213      */
3214     @Test
3215     @Alerts("matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 30, 40, 50, 1)")
3216     public void toString3D() throws Exception {
3217         final String html = DOCTYPE_HTML
3218                 + "<html>\n"
3219                 + "<body>\n"
3220                 + "<script>\n"
3221                 + LOG_TITLE_FUNCTION
3222 
3223                 + "let m = new DOMMatrixReadOnly();\n"
3224                 + "m = m.translate(30, 40, 50);"
3225                 + "log(m.toString());\n"
3226 
3227                 + "</script>\n"
3228                 + "</body></html>";
3229 
3230         loadPageVerifyTitle2(html);
3231     }
3232 
3233     /**
3234      * @throws Exception on test failure
3235      */
3236     @Test
3237     @Alerts({"{\"a\":1,\"b\":0,\"c\":0,\"d\":1,\"e\":20,\"f\":30,"
3238                 + "\"m11\":1,\"m12\":0,\"m13\":0,\"m14\":0,"
3239                 + "\"m21\":0,\"m22\":1,\"m23\":0,\"m24\":0,"
3240                 + "\"m31\":0,\"m32\":0,\"m33\":1,\"m34\":0,"
3241                 + "\"m41\":20,\"m42\":30,\"m43\":0,\"m44\":1,"
3242                 + "\"is2D\":true,\"isIdentity\":false}",
3243              "{\"a\":1,\"b\":0,\"c\":0,\"d\":1,\"e\":20,\"f\":30,"
3244                 + "\"m11\":1,\"m12\":0,\"m13\":0,\"m14\":0,"
3245                 + "\"m21\":0,\"m22\":1,\"m23\":0,\"m24\":0,"
3246                 + "\"m31\":0,\"m32\":0,\"m33\":1,\"m34\":0,"
3247                 + "\"m41\":20,\"m42\":30,\"m43\":0,\"m44\":1,"
3248                 + "\"is2D\":true,\"isIdentity\":false}",
3249              "false"})
3250     public void toJSON2D() throws Exception {
3251         final String html = DOCTYPE_HTML
3252                 + "<html>\n"
3253                 + "<body>\n"
3254                 + "<script>\n"
3255                 + LOG_TITLE_FUNCTION_NORMALIZE
3256 
3257                 + "let m = new DOMMatrixReadOnly();\n"
3258                 + "m = m.translate(20, 30);"
3259                 + "log(JSON.stringify(m));\n"
3260                 + "log(JSON.stringify(m.toJSON()));\n"
3261                 + "log(m === m.toJSON());\n"
3262 
3263                 + "</script>\n"
3264                 + "</body></html>";
3265 
3266         loadPageVerifyTitle2(html);
3267     }
3268 
3269     /**
3270      * @throws Exception on test failure
3271      */
3272     @Test
3273     @Alerts({"{\"a\":1,\"b\":0,\"c\":0,\"d\":1,\"e\":30,\"f\":40,"
3274                 + "\"m11\":1,\"m12\":0,\"m13\":0,\"m14\":0,"
3275                 + "\"m21\":0,\"m22\":1,\"m23\":0,\"m24\":0,"
3276                 + "\"m31\":0,\"m32\":0,\"m33\":1,\"m34\":0,"
3277                 + "\"m41\":30,\"m42\":40,\"m43\":50,\"m44\":1,"
3278                 + "\"is2D\":false,\"isIdentity\":false}",
3279              "{\"a\":1,\"b\":0,\"c\":0,\"d\":1,\"e\":30,\"f\":40,"
3280                 + "\"m11\":1,\"m12\":0,\"m13\":0,\"m14\":0,"
3281                 + "\"m21\":0,\"m22\":1,\"m23\":0,\"m24\":0,"
3282                 + "\"m31\":0,\"m32\":0,\"m33\":1,\"m34\":0,"
3283                 + "\"m41\":30,\"m42\":40,\"m43\":50,\"m44\":1,"
3284                 + "\"is2D\":false,\"isIdentity\":false}",
3285              "false"})
3286     public void toJSON3D() throws Exception {
3287         final String html = DOCTYPE_HTML
3288                 + "<html>\n"
3289                 + "<body>\n"
3290                 + "<script>\n"
3291                 + LOG_TITLE_FUNCTION_NORMALIZE
3292 
3293                 + "let m = new DOMMatrixReadOnly();\n"
3294                 + "m = m.translate(30, 40, 50);"
3295                 + "log(JSON.stringify(m));\n"
3296                 + "log(JSON.stringify(m.toJSON()));\n"
3297                 + "log(m === m.toJSON());\n"
3298 
3299                 + "</script>\n"
3300                 + "</body></html>";
3301 
3302         loadPageVerifyTitle2(html);
3303     }
3304 }