Skip to content

Commit 42907cf

Browse files
committed
[geometry-1] Add DOMPoint test for Editor’s Draft
https://drafts.fxtf.org/geometry/#dompointreadonly https://drafts.fxtf.org/geometry/#dompoint Build from revision b3c6e089f8847971525e0e77bcb36c3351b328bf
1 parent 37727aa commit 42907cf

14 files changed

+555
-10
lines changed

geometry-1_dev/html/DOMPoint-002.htm

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
<!DOCTYPE html>
2+
<html><head>
3+
<title>Geometry Interfaces: DOMPoint and DOMPointReadOnly interface tests</title>
4+
<link href="mailto:hs1217.lee@samsung.com" rel="author" title="Hwanseung Lee">
5+
<link href="https://drafts.fxtf.org/geometry-1/#DOMPoint" rel="help">
6+
<script src="/resources/testharness.js"></script>
7+
<script src="/resources/testharnessreport.js"></script>
8+
</head>
9+
<body>
10+
<p>Test DOMPoint and DOMPointReadOnly interfaces</p>
11+
<div id="log"></div>
12+
<script>
13+
function getMatrixTransform(matrix, point) {
14+
var x = point.x * matrix.m11 + point.y * matrix.m21 + point.z * matrix.m31 + point.w * matrix.m41;
15+
var y = point.x * matrix.m12 + point.y * matrix.m22 + point.z * matrix.m32 + point.w * matrix.m42;
16+
var w = point.x * matrix.m13 + point.y * matrix.m23 + point.z * matrix.m33 + point.w * matrix.m43;
17+
var z = point.x * matrix.m14 + point.y * matrix.m24 + point.z * matrix.m34 + point.w * matrix.m44;
18+
return new DOMPoint(x, y, w, z)
19+
}
20+
21+
test(function() {
22+
checkDOMPoint(new DOMPoint(), {x:0, y:0, z:0, w:1});
23+
},'test DOMPoint Constructor no args');
24+
test(function() {
25+
checkDOMPoint(new DOMPoint(1), {x:1, y:0, z:0, w:1});
26+
},'test DOMPoint Constructor one args');
27+
test(function() {
28+
checkDOMPoint(new DOMPoint(1, 2), {x:1, y:2, z:0, w:1});
29+
},'test DOMPoint Constructor two args');
30+
test(function() {
31+
checkDOMPoint(new DOMPoint(1, 2, 3), {x:1, y:2, z:3, w:1});
32+
},'test DOMPoint Constructor three args');
33+
test(function() {
34+
checkDOMPoint(new DOMPoint(1, 2, 3, 4), {x:1, y:2, z:3, w:4});
35+
},'test DOMPoint Constructor four args');
36+
test(function() {
37+
checkDOMPoint(new DOMPoint(1, 2, 3, 4, 5), {x:1, y:2, z:3, w:4});
38+
},'test DOMPoint Constructor more then four args');
39+
test(function() {
40+
checkDOMPoint(new DOMPoint(1, undefined), {x:1, y:0, z:0, w:1});
41+
},'test DOMPoint Constructor with undefined');
42+
test(function() {
43+
checkDOMPoint(new DOMPoint("a", "b"), {x:NaN, y:NaN, z:0, w:1});
44+
},'test DOMPoint Constructor with string');
45+
test(function() {
46+
checkDOMPoint(new DOMPoint({}), {x:NaN, y:0, z:0, w:1});
47+
},'test DOMPoint Constructor with empty object');
48+
test(function() {
49+
checkDOMPoint(DOMPoint.fromPoint({}), {x:0, y:0, z:0, w:1});
50+
},'test DOMPoint fromPoint with empty object');
51+
test(function() {
52+
checkDOMPoint(DOMPoint.fromPoint({x:1}), {x:1, y:0, z:0, w:1});
53+
},'test DOMPoint fromPoint with x');
54+
test(function() {
55+
checkDOMPoint(DOMPoint.fromPoint({x:1, y:2}), {x:1, y:2, z:0, w:1});
56+
},'test DOMPoint fromPoint with x, y');
57+
test(function() {
58+
checkDOMPoint(DOMPoint.fromPoint({x:1, y:2, z:3}), {x:1, y:2, z:3, w:1});
59+
},'test DOMPoint fromPoint with x, y, z');
60+
test(function() {
61+
checkDOMPoint(DOMPoint.fromPoint({x:1, y:2, z:3, w:4}), {x:1, y:2, z:3, w:4});
62+
},'test DOMPoint fromPoint with x, y, z, w');
63+
test(function() {
64+
checkDOMPoint(DOMPoint.fromPoint({x:1, y:2, z:3, w:4, v:5}), {x:1, y:2, z:3, w:4});
65+
},'test DOMPoint fromPoint with x, y, z, w, v');
66+
test(function() {
67+
checkDOMPoint(DOMPoint.fromPoint({x:1, z:3}), {x:1, y:0, z:3, w:1});
68+
},'test DOMPoint fromPoint with x, z');
69+
test(function() {
70+
checkDOMPoint(DOMPoint.fromPoint({x:1, y: undefined, z:3}), {x:1, y:0, z:3, w:1});
71+
},'test DOMPoint fromPoint with undefined value');
72+
test(function() {
73+
var point = new DOMPoint(5, 4);
74+
var matrix = new DOMMatrix([2, 0, 0, 2, 10, 10]);
75+
var result = point.matrixTransform(matrix);
76+
var expected = getMatrixTransform(matrix, point);
77+
checkDOMPoint(result, expected);
78+
},'test DOMPoint matrixTransform');
79+
test(function() {
80+
var p = new DOMPoint(0, 0, 0, 1);
81+
p.x = undefined;
82+
p.y = undefined;
83+
p.z = undefined;
84+
p.w = undefined;
85+
checkDOMPoint(p, {x:NaN, y:NaN, z:NaN, w:NaN});
86+
},'test DOMPoint Attributes undefined');
87+
test(function() {
88+
var p = new DOMPoint(0, 0, 0, 1);
89+
p.x = NaN;
90+
p.y = Number.POSITIVE_INFINITY;
91+
p.z = Number.NEGATIVE_INFINITY;
92+
p.w = Infinity;
93+
checkDOMPoint(p, {x:NaN, y:Infinity, z:-Infinity, w:Infinity});
94+
},'test DOMPoint Attributes NaN Infinity');
95+
test(function() {
96+
checkDOMPoint(new DOMPointReadOnly(), {x:0, y:0, z:0, w:1});
97+
},'test DOMPointReadOnly Constructor no args');
98+
test(function() {
99+
checkDOMPoint(new DOMPointReadOnly(1), {x:1, y:0, z:0, w:1});
100+
},'test DOMPointReadOnly Constructor one args');
101+
test(function() {
102+
checkDOMPoint(new DOMPointReadOnly(1, 2), {x:1, y:2, z:0, w:1});
103+
},'test DOMPointReadOnly Constructor two args');
104+
test(function() {
105+
checkDOMPoint(new DOMPointReadOnly(1, 2, 3), {x:1, y:2, z:3, w:1});
106+
},'test DOMPointReadOnly Constructor three args');
107+
test(function() {
108+
checkDOMPoint(new DOMPointReadOnly(1, 2, 3, 4), {x:1, y:2, z:3, w:4});
109+
},'test DOMPointReadOnly Constructor four args');
110+
test(function() {
111+
checkDOMPoint(new DOMPointReadOnly(1, 2, 3, 4, 5), {x:1, y:2, z:3, w:4});
112+
},'test DOMPointReadOnly Constructor more then four args');
113+
test(function() {
114+
checkDOMPoint(new DOMPointReadOnly(1, undefined), {x:1, y:0, z:0, w:1});
115+
},'test DOMPointReadOnly Constructor with undefined');
116+
test(function() {
117+
checkDOMPoint(new DOMPointReadOnly("a", "b"), {x:NaN, y:NaN, z:0, w:1});
118+
},'test DOMPointReadOnly Constructor with string');
119+
test(function() {
120+
checkDOMPoint(new DOMPointReadOnly({}), {x:NaN, y:0, z:0, w:1});
121+
},'test DOMPointReadOnly Constructor with object');
122+
test(function() {
123+
checkDOMPoint(DOMPointReadOnly.fromPoint({}), {x:0, y:0, z:0, w:1});
124+
},'test DOMPointReadOnly fromPoint with empty object');
125+
test(function() {
126+
checkDOMPoint(DOMPointReadOnly.fromPoint({x:1}), {x:1, y:0, z:0, w:1});
127+
},'test DOMPointReadOnly fromPoint with x');
128+
test(function() {
129+
checkDOMPoint(DOMPointReadOnly.fromPoint({x:1, y:2}), {x:1, y:2, z:0, w:1});
130+
},'test DOMPointReadOnly fromPoint with x, y');
131+
test(function() {
132+
checkDOMPoint(DOMPointReadOnly.fromPoint({x:1, y:2, z:3}), {x:1, y:2, z:3, w:1});
133+
},'test DOMPointReadOnly fromPoint with x, y, z');
134+
test(function() {
135+
checkDOMPoint(DOMPointReadOnly.fromPoint({x:1, y:2, z:3, w:4}), {x:1, y:2, z:3, w:4});
136+
},'test DOMPointReadOnly fromPoint with x, y, z, w');
137+
test(function() {
138+
checkDOMPoint(DOMPointReadOnly.fromPoint({x:1, y:2, z:3, w:4, v:5}), {x:1, y:2, z:3, w:4});
139+
},'test DOMPointReadOnly fromPoint with x, y, z, w, v');
140+
test(function() {
141+
checkDOMPoint(DOMPointReadOnly.fromPoint({x:1, z:3}), {x:1, y:0, z:3, w:1});
142+
},'test DOMPointReadOnly fromPoint with x, z');
143+
test(function() {
144+
checkDOMPoint(DOMPointReadOnly.fromPoint({x:1, y: undefined, z:3}), {x:1, y:0, z:3, w:1});
145+
},'test DOMPointReadOnly fromPoint with undefined value');
146+
test(function() {
147+
var point = new DOMPointReadOnly(5, 4);
148+
var matrix = new DOMMatrix([2, 0, 0, 2, 10, 10]);
149+
var result = point.matrixTransform(matrix);
150+
var expected = getMatrixTransform(matrix, point);
151+
checkDOMPoint(result, expected);
152+
},'test DOMPointReadOnly matrixTransform');
153+
test(function() {
154+
var p = new DOMPointReadOnly(0, 0, 0, 1);
155+
p.x = undefined;
156+
p.y = undefined;
157+
p.z = undefined;
158+
p.w = undefined;
159+
checkDOMPoint(p, {x:0, y:0, z:0, w:1});
160+
},'test DOMPointReadOnly Attributes undefined');
161+
162+
function checkDOMPoint(p, exp) {
163+
assert_equals(p.x, exp.x, "x is not matched");
164+
assert_equals(p.y, exp.y, "y is not matched");
165+
assert_equals(p.z, exp.z, "z is not matched");
166+
assert_equals(p.w, exp.w, "w is not matched");
167+
}
168+
</script>
169+
170+
171+
172+
</body></html>

geometry-1_dev/html/chapter-2.htm

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<body>
1414

1515
<h1>Geometry Interfaces Module Level 1 CR Test Suite</h1>
16-
<h2>The DOMPoint interfaces (1 tests)</h2>
16+
<h2>The DOMPoint interfaces (2 tests)</h2>
1717
<table width="100%">
1818
<col id="test-column">
1919
<col id="refs-column">
@@ -31,7 +31,7 @@ <h2>The DOMPoint interfaces (1 tests)</h2>
3131
<tr><th colspan="4" scope="rowgroup">
3232
<a href="#s2">+</a>
3333
<a href="https://www.w3.org/TR/geometry-1/#DOMPoint">2 The DOMPoint interfaces</a></th></tr>
34-
<!-- 1 tests -->
34+
<!-- 2 tests -->
3535
<tr id="dompoint-001-2" class="script">
3636
<td>
3737
<a href="DOMPoint-001.htm">dompoint-001</a></td>
@@ -40,6 +40,14 @@ <h2>The DOMPoint interfaces (1 tests)</h2>
4040
<td>Geometry Interfaces: DOMPoint and DOMPointReadOnly interface tests
4141
</td>
4242
</tr>
43+
<tr id="dompoint-002-2" class="primary script">
44+
<td><strong>
45+
<a href="DOMPoint-002.htm">dompoint-002</a></strong></td>
46+
<td></td>
47+
<td><abbr class="script" title="Executes tests in script">Script</abbr></td>
48+
<td>Geometry Interfaces: DOMPoint and DOMPointReadOnly interface tests
49+
</td>
50+
</tr>
4351
</tbody>
4452
<tbody id="s2.#dictdef-dompointinit">
4553
<!-- 1 tests -->

geometry-1_dev/html/toc.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ <h1>Geometry Interfaces Module Level 1 CR Test Suite By Chapter</h1>
2727
<tbody id="s2">
2828
<tr><th><a href="chapter-2.htm">Chapter 2 -
2929
The DOMPoint interfaces</a></th>
30-
<td>(1 Tests)</td></tr>
30+
<td>(2 Tests)</td></tr>
3131
</tbody>
3232
<tbody id="s3">
3333
<tr><th><a href="chapter-3.htm">Chapter 3 -

geometry-1_dev/implementation-report-TEMPLATE.data

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ html/dommatrix-003.htm f4ef80f813ef6a7cab1098191d5d86a33d1cc333 ?
1111
xhtml1/dommatrix-003.xht f4ef80f813ef6a7cab1098191d5d86a33d1cc333 ?
1212
html/dompoint-001.htm 665e2664c436ff50a27f1ab0532d656205e7f441 ?
1313
xhtml1/dompoint-001.xht 665e2664c436ff50a27f1ab0532d656205e7f441 ?
14+
html/dompoint-002.htm 96c21b5284447f87cdf23ea42e15d1be7867d57b ?
15+
xhtml1/dompoint-002.xht 96c21b5284447f87cdf23ea42e15d1be7867d57b ?
1416
html/domquad-001.htm 608cb7264f7f7f64838baf911bf9e470cf89444c ?
1517
xhtml1/domquad-001.xht 608cb7264f7f7f64838baf911bf9e470cf89444c ?
1618
html/domrect-001.htm 2683301224ae44225ab87152ac19e1cd866f59ae ?

geometry-1_dev/index.htm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ <h2>Acknowledgements</h2>
132132
<p>Many thanks to the following for their contributions:</p>
133133
<ul>
134134
<li>Dirk Schulze</li>
135+
<li>Hwanseung Lee</li>
135136
<li>Peter Hall</li>
136137
</ul>
137138

geometry-1_dev/index.xht

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
<p>Many thanks to the following for their contributions:</p>
133133
<ul>
134134
<li>Dirk Schulze</li>
135+
<li>Hwanseung Lee</li>
135136
<li>Peter Hall</li>
136137
</ul>
137138

geometry-1_dev/testinfo.data

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ DOMMatrix-001 Geometry Interfaces: DOMMatrix and DOMMatrixReadOnly constructors
33
DOMMatrix-002 Geometry Interfaces: DOMMatrixReadOnly methods do not mutate the object script https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly e81471f95a3fd70cdbcb552fef472322aa39af55 `Peter Hall`<mailto:peter.hall@algomi.com>
44
DOMMatrix-003 Geometry Interfaces: Test DOMMatrix non-mutating methods script https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly f4ef80f813ef6a7cab1098191d5d86a33d1cc333 `Peter Hall`<mailto:peter.hall@algomi.com>
55
DOMPoint-001 Geometry Interfaces: DOMPoint and DOMPointReadOnly interface tests script http://www.w3.org/TR/geometry-1/#DOMPoint,http://www.w3.org/TR/geometry-1/#dictdef-dompointinit,http://www.w3.org/TR/geometry-1/#dom-dompoint-dompoint,http://www.w3.org/TR/geometry-1/#dom-dompointreadonly-dompoint-x,http://www.w3.org/TR/geometry-1/#dom-dompointreadonly-dompoint-y,http://www.w3.org/TR/geometry-1/#dom-dompointreadonly-dompoint-z,http://www.w3.org/TR/geometry-1/#dom-dompointreadonly-dompoint-w 665e2664c436ff50a27f1ab0532d656205e7f441 `Dirk Schulze`<mailto:dschulze@adobe.com>
6+
DOMPoint-002 Geometry Interfaces: DOMPoint and DOMPointReadOnly interface tests script https://drafts.fxtf.org/geometry-1/#DOMPoint 96c21b5284447f87cdf23ea42e15d1be7867d57b `Hwanseung Lee`<mailto:hs1217.lee@samsung.com>
67
DOMQuad-001 Geometry Interfaces: DOMQuad interface tests script http://www.w3.org/TR/geometry-1/#DOMQuad,http://www.w3.org/TR/geometry-1/#dom-domquad-domquad,http://www.w3.org/TR/geometry-1/#dom-domquad-p1,http://www.w3.org/TR/geometry-1/#dom-domquad-p2,http://www.w3.org/TR/geometry-1/#dom-domquad-p3,http://www.w3.org/TR/geometry-1/#dom-domquad-p4,http://www.w3.org/TR/geometry-1/#dom-domquad-bounds 608cb7264f7f7f64838baf911bf9e470cf89444c `Dirk Schulze`<mailto:dschulze@adobe.com>
78
DOMRect-001 Geometry Interfaces: DOMRect and DOMRectReadOnly interface tests script http://www.w3.org/TR/geometry-1/#DOMRect,http://www.w3.org/TR/geometry-1/#dom-domrect,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly,http://www.w3.org/TR/geometry-1/#dom-domrect-domrect,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-x,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-y,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-width,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-height,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-top,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-left,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-right,http://www.w3.org/TR/geometry-1/#dom-domrectreadonly-domrect-bottom 2683301224ae44225ab87152ac19e1cd866f59ae `Dirk Schulze`<mailto:dschulze@adobe.com>

0 commit comments

Comments
 (0)