Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> | 2 <meta charset="utf-8"> |
| 3 | 3 |
| 4 <title>Geometry Interfaces: DOMRect</title> | 4 <title>Geometry Interfaces: DOMRect</title> |
| 5 <link rel="help" href="https://drafts.fxtf.org/geometry/#domrect"> | 5 <link rel="help" href="https://drafts.fxtf.org/geometry/#domrect"> |
| 6 <script src="../../resources/testharness.js"></script> | 6 <script src="../../resources/testharness.js"></script> |
| 7 <script src="../../resources/testharnessreport.js"></script> | 7 <script src="../../resources/testharnessreport.js"></script> |
| 8 <script src="./resources/geometry-interfaces-test-helpers.js"></script> | 8 <script src="./resources/geometry-interfaces-test-helpers.js"></script> |
| 9 <script> | 9 <script> |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 assert_dom_rect_equals(rect, [30, 20, 80, 50, 20, 110, 70, 30]); | 50 assert_dom_rect_equals(rect, [30, 20, 80, 50, 20, 110, 70, 30]); |
| 51 rect.y = -10; | 51 rect.y = -10; |
| 52 assert_dom_rect_equals(rect, [30, -10, 80, 50, -10, 110, 40, 30]); | 52 assert_dom_rect_equals(rect, [30, -10, 80, 50, -10, 110, 40, 30]); |
| 53 rect.width = 20; | 53 rect.width = 20; |
| 54 assert_dom_rect_equals(rect, [30, -10, 20, 50, -10, 50, 40, 30]); | 54 assert_dom_rect_equals(rect, [30, -10, 20, 50, -10, 50, 40, 30]); |
| 55 rect.height = 40; | 55 rect.height = 40; |
| 56 assert_dom_rect_equals(rect, [30, -10, 20, 40, -10, 50, 30, 30]); | 56 assert_dom_rect_equals(rect, [30, -10, 20, 40, -10, 50, 30, 30]); |
| 57 }, 'DOMRect setter'); | 57 }, 'DOMRect setter'); |
| 58 | 58 |
| 59 test(() => { | 59 test(() => { |
| 60 var rect = DOMRect.fromRect({x: 10, y: 20, width: 80, height: 50}); | |
| 61 assert_dom_rect_equals(rect, [10, 20, 80, 50, 20, 90, 70, 10]); | |
| 62 }, 'DOMRect.fromRect({x: 10, y: 20, width: 80, height: 50}) should create a DOMR ect'); | |
| 63 | |
| 64 test(() => { | |
| 65 var rect = DOMRect.fromRect(); | |
| 66 assert_dom_rect_equals(rect, [0, 0, 0, 0, 0, 0, 0, 0]); | |
| 67 }, 'DOMRect.fromRect({x: 0, y: 0, width: 0, height: 0}) should create a DOMRect' ); | |
| 68 | |
| 69 test(() => { | |
| 70 var rect1 = DOMRect.fromRect(); | |
| 71 var rect2 = DOMRect.fromRect(); | |
| 72 assert_false(rect1 == rect2); | |
| 73 assert_true(rect1.x == rect2.x); | |
| 74 assert_true(rect1.y == rect2.y); | |
| 75 assert_true(rect1.width == rect2.width); | |
| 76 assert_true(rect1.height == rect2.height); | |
| 77 }, 'DOMRect.fromRect() should create a new DOMRect'); | |
| 78 | |
| 79 test(() => { | |
| 60 var rect = new DOMRectReadOnly(); | 80 var rect = new DOMRectReadOnly(); |
| 61 assert_dom_rect_equals(rect, [0, 0, 0, 0, 0, 0, 0, 0]); | 81 assert_dom_rect_equals(rect, [0, 0, 0, 0, 0, 0, 0, 0]); |
| 62 }, 'DOMRectReadOnly constructor without parameter'); | 82 }, 'DOMRectReadOnly constructor without parameter'); |
| 63 | 83 |
| 64 test(() => { | 84 test(() => { |
| 65 var rect = new DOMRectReadOnly(10); | 85 var rect = new DOMRectReadOnly(10); |
| 66 assert_dom_rect_equals(rect, [10, 0, 0, 0, 0, 10, 0, 10]); | 86 assert_dom_rect_equals(rect, [10, 0, 0, 0, 0, 10, 0, 10]); |
| 67 }, 'DOMRectReadOnly constructor with x parameter'); | 87 }, 'DOMRectReadOnly constructor with x parameter'); |
| 68 | 88 |
| 69 test(() => { | 89 test(() => { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 87 assert_readonly(rect, 'y'); | 107 assert_readonly(rect, 'y'); |
| 88 assert_readonly(rect, 'width'); | 108 assert_readonly(rect, 'width'); |
| 89 assert_readonly(rect, 'height'); | 109 assert_readonly(rect, 'height'); |
| 90 }, 'DOMRectReadOnly readonly test'); | 110 }, 'DOMRectReadOnly readonly test'); |
| 91 | 111 |
| 92 test(() => { | 112 test(() => { |
| 93 var rect = new DOMRectReadOnly(10, 20, 80, 50); | 113 var rect = new DOMRectReadOnly(10, 20, 80, 50); |
| 94 assert_object_equals(rect.toJSON(), {x: 10, y: 20, width: 80, height: 50, top: 20, right: 90, bottom: 70, left: 10}); | 114 assert_object_equals(rect.toJSON(), {x: 10, y: 20, width: 80, height: 50, top: 20, right: 90, bottom: 70, left: 10}); |
| 95 }, 'DOMRectReadOnly toJSON'); | 115 }, 'DOMRectReadOnly toJSON'); |
| 96 | 116 |
| 117 test(() => { | |
| 118 var rect = DOMRectReadOnly.fromRect({x: 10, y: 20, width: 80, height: 50}); | |
| 119 assert_dom_rect_equals(rect, [10, 20, 80, 50, 20, 90, 70, 10]); | |
|
zino
2017/01/11 18:43:35
How can we know which this is DOMRect or DOMRectRe
Byoungkwon Ko
2017/01/12 17:24:17
I added one more test function to check whether it
zino
2017/01/12 19:05:25
Sorry for the confused explanation.
DOMRect is DO
| |
| 120 }, 'DOMRectReadOnly.fromRect({x: 10, y: 20, width: 80, height: 50}) should creat e a DOMRectReadOnly'); | |
| 121 | |
| 122 test(() => { | |
| 123 var rect = DOMRectReadOnly.fromRect(); | |
| 124 assert_dom_rect_equals(rect, [0, 0, 0, 0, 0, 0, 0, 0]); | |
| 125 }, 'DOMRectReadOnly.fromRect({x: 0, y: 0, width: 0, height: 0}) should create a DOMRectReadOnly'); | |
| 126 | |
| 127 test(() => { | |
| 128 var rect1 = DOMRectReadOnly.fromRect(); | |
| 129 var rect2 = DOMRectReadOnly.fromRect(); | |
| 130 assert_false(rect1 == rect2); | |
| 131 assert_true(rect1.x == rect2.x); | |
| 132 assert_true(rect1.y == rect2.y); | |
| 133 assert_true(rect1.width == rect2.width); | |
| 134 assert_true(rect1.height == rect2.height); | |
| 135 }, 'DOMRectReadOnly.fromRect() should create a new DOMRectReadOnly'); | |
| 136 | |
| 97 </script> | 137 </script> |
| OLD | NEW |