| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!doctype html> |
| 2 <html> | 2 <meta charset="utf-8"> |
| 3 <head> | |
| 4 <title>Geometry Interfaces: DOMPoint</title> | 3 <title>Geometry Interfaces: DOMPoint</title> |
| 5 <script src="../../resources/js-test.js"></script> | 4 <link rel="help" href="https://drafts.fxtf.org/geometry/#DOMPoint"> |
| 6 </head> | 5 <script src="../../resources/testharness.js"></script> |
| 7 <body> | 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <script src="./resources/geometry-interfaces-test-helpers.js"></script> |
| 8 <script> | 8 <script> |
| 9 'use strict'; |
| 9 | 10 |
| 10 debug("# DOMPoint(2, 3)"); | 11 test(() => { |
| 11 var point = new DOMPoint(2, 3); | 12 var point = new DOMPoint(2, 3); |
| 12 shouldBe("point.x", "2"); | 13 assert_dom_point_equals(point, [2, 3, 0, 1]); |
| 13 shouldBe("point.y", "3"); | 14 }, 'DOMPoint constructor with x, y parameters'); |
| 14 shouldBe("point.z", "0"); | |
| 15 shouldBe("point.w", "1"); | |
| 16 debug(""); | |
| 17 | 15 |
| 18 debug("# DOMPoint(5, 7, 9)"); | 16 test(() => { |
| 19 point = new DOMPoint(5, 7, 9); | 17 var point = new DOMPoint(5, 7, 9); |
| 20 shouldBe("point.x", "5"); | 18 assert_dom_point_equals(point, [5, 7, 9, 1]); |
| 21 shouldBe("point.y", "7"); | 19 }, 'DOMPoint constructor with x, y, z parameters'); |
| 22 shouldBe("point.z", "9"); | |
| 23 shouldBe("point.w", "1"); | |
| 24 debug(""); | |
| 25 | 20 |
| 26 debug("# DOMPoint(8, 2, 1, 6)"); | 21 test(() => { |
| 27 point = new DOMPoint(5, 7, 9); | 22 var point = new DOMPoint(8, 2, 1, 6); |
| 28 point = new DOMPoint(8, 2, 1, 6); | 23 assert_dom_point_equals(point, [8, 2, 1, 6]); |
| 29 shouldBe("point.x", "8"); | 24 }, 'DOMPoint constructor with x, y, z, w parameters'); |
| 30 shouldBe("point.y", "2"); | |
| 31 shouldBe("point.z", "1"); | |
| 32 shouldBe("point.w", "6"); | |
| 33 debug(""); | |
| 34 | 25 |
| 35 debug("# DOMPoint({ x : 2 })"); | 26 test(() => { |
| 36 point = new DOMPoint({ x : 2 }); | 27 var point = new DOMPoint({x: 2}); |
| 37 shouldBe("point.x", "2"); | 28 assert_dom_point_equals(point, [2, 0, 0, 1]); |
| 38 shouldBe("point.y", "0"); | 29 }, 'DOMPoint constructor with x parameter'); |
| 39 shouldBe("point.z", "0"); | |
| 40 shouldBe("point.w", "1"); | |
| 41 debug(""); | |
| 42 | 30 |
| 43 debug("# DOMPoint({ y : 2 })"); | 31 test(() => { |
| 44 point = new DOMPoint({ y : 2 }); | 32 var point = new DOMPoint({y: 2}); |
| 45 shouldBe("point.x", "0"); | 33 assert_dom_point_equals(point, [0, 2, 0, 1]); |
| 46 shouldBe("point.y", "2"); | 34 }, 'DOMPoint constructor with y parameter'); |
| 47 shouldBe("point.z", "0"); | |
| 48 shouldBe("point.w", "1"); | |
| 49 debug(""); | |
| 50 | 35 |
| 51 debug("# DOMPoint({ z : 2 })"); | 36 test(() => { |
| 52 point = new DOMPoint({ z : 2 }); | 37 var point = new DOMPoint({z: 2}); |
| 53 shouldBe("point.x", "0"); | 38 assert_dom_point_equals(point, [0, 0, 2, 1]); |
| 54 shouldBe("point.y", "0"); | 39 }, 'DOMPoint constructor with z parameter'); |
| 55 shouldBe("point.z", "2"); | |
| 56 shouldBe("point.w", "1"); | |
| 57 debug(""); | |
| 58 | 40 |
| 59 debug("# DOMPoint({ w : 2 })"); | 41 test(() => { |
| 60 point = new DOMPoint({ w : 2 }); | 42 var point = new DOMPoint({w: 2}); |
| 61 shouldBe("point.x", "0"); | 43 assert_dom_point_equals(point, [0, 0, 0, 2]); |
| 62 shouldBe("point.y", "0"); | 44 }, 'DOMPoint constructor with w parameter'); |
| 63 shouldBe("point.z", "0"); | |
| 64 shouldBe("point.w", "2"); | |
| 65 debug(""); | |
| 66 | 45 |
| 67 debug("# DOMPoint({ x : 2, y : 3, z : 4, w : 5 })"); | 46 test(() => { |
| 68 point = new DOMPoint({ x : 2, y : 3, z : 4, w : 5 }); | 47 var point = new DOMPoint({x: 2, y: 3, z: 4, w: 5}); |
| 69 shouldBe("point.x", "2"); | 48 assert_dom_point_equals(point, [2, 3, 4, 5]); |
| 70 shouldBe("point.y", "3"); | 49 }, 'DOMPoint constructor with x, y, z, w parameters'); |
| 71 shouldBe("point.z", "4"); | |
| 72 shouldBe("point.w", "5"); | |
| 73 debug(""); | |
| 74 | 50 |
| 75 debug("# DOMPoint()"); | 51 test(() => { |
| 76 point = new DOMPoint(); | 52 var point = new DOMPoint(); |
| 77 shouldBe("point.x", "0"); | 53 assert_dom_point_equals(point, [0, 0, 0, 1]); |
| 78 shouldBe("point.y", "0"); | 54 }, 'DOMPoint constructor without parameter'); |
| 79 shouldBe("point.z", "0"); | |
| 80 shouldBe("point.w", "1"); | |
| 81 debug(""); | |
| 82 | 55 |
| 83 debug("# DOMPoint setter"); | 56 test(() => { |
| 84 point.x = 10; | 57 var point = new DOMPoint(); |
| 85 shouldBe("point.x", "10"); | 58 point.x = 10; |
| 86 point.y = 20; | 59 point.y = 20; |
| 87 shouldBe("point.y", "20"); | 60 point.z = 30; |
| 88 point.z = 30; | 61 point.w = 40; |
| 89 shouldBe("point.z", "30"); | 62 assert_dom_point_equals(point, [10, 20, 30, 40]); |
| 90 point.w = 40; | 63 }, 'DOMPoint setter'); |
| 91 shouldBe("point.w", "40"); | |
| 92 debug(""); | |
| 93 | |
| 94 debug("# DOMPointReadOnly(10, 20, 30, 40)"); | |
| 95 point = new DOMPointReadOnly(10, 20, 30, 40); | |
| 96 shouldBe("point.x", "10"); | |
| 97 shouldBe("point.y", "20"); | |
| 98 shouldBe("point.z", "30"); | |
| 99 shouldBe("point.w", "40"); | |
| 100 debug(""); | |
| 101 | |
| 102 debug("# DOMPointReadOnly readonly test"); | |
| 103 point.x = 100; | |
| 104 shouldBe("point.x", "10"); | |
| 105 point.y = 100; | |
| 106 shouldBe("point.y", "20"); | |
| 107 point.z = 100; | |
| 108 shouldBe("point.z", "30"); | |
| 109 point.w = 100; | |
| 110 shouldBe("point.w", "40"); | |
| 111 | 64 |
| 112 </script> | 65 </script> |
| 113 </body> | |
| 114 </html> | |
| OLD | NEW |