Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 09d92b2

Browse files
Manishearthmoz-wptsync-bot
authored andcommitted
Bug 1629229 [wpt PR 22868] - Implement hit testing API, a=testonly
Automatic update from web-platform-tests Update xrRay_constructor test to not throw See immersive-web/hit-test#83, this test is currently impossible to pass for a browser implementing the current WebIDL specification. -- Update XRRay semantics Implements changes from immersive-web/hit-test#85 -- Fix world generation to have vertices member -- wpt-commits: 7513c92e130e043def925bda97e9fb9d8fd0b48f, 0fce2e94f0feb04966868a0b5795d76ea1db3906, 08c95d8ca3466c37df307cb775502a916e22b814 wpt-pr: 22868
1 parent 31f329b commit 09d92b2

File tree

2 files changed

+24
-26
lines changed

2 files changed

+24
-26
lines changed

testing/web-platform/tests/webxr/hit-test/xrRay_constructor.https.html

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,25 +91,23 @@
9191
{
9292
// Check that we throw exception on direction too close to 0,0,0:
9393
let originDict = {x : 10.0, y : 10.0, z : 10.0, w : 1.0};
94-
let directionDict = {x : 0.0, y : 0.0, z : 0.0, w : 0.0};
94+
let directionDict = {x : 1.0, y : 0.0, z : 0.0, w : 0.0};
9595

96-
try {
97-
let xrRay = new XRRay(
96+
assert_throws_js(TypeError, () => new XRRay(
9897
DOMPoint.fromPoint(originDict),
99-
DOMPoint.fromPoint(directionDict));
100-
101-
assert(false, "origin-custom-direction-zero:exception not thrown");
102-
}
103-
catch(e)
104-
{
105-
if(e instanceof DOMException) {
106-
assert_equals(e.name, "InvalidStateError", "origin-custom-direction-zero:incorrect DOM exception thrown");
107-
} else {
108-
assert(false, "origin-custom-direction-zero:other exception thrown: " + e);
109-
}
110-
}
111-
}
98+
DOMPoint.fromPoint({x : 0.0, y : 0.0, z : 0.0, w : 0.0})
99+
), "Constructor should throw for zero direction");
100+
101+
assert_throws_js(TypeError, () => new XRRay(
102+
DOMPoint.fromPoint(originDict),
103+
DOMPoint.fromPoint({x : 1.0, y : 0.0, z : 0.0, w : 0.5})
104+
), "Constructor should throw for nonzero direction w coordinate");
112105

106+
assert_throws_js(TypeError, () => new XRRay(
107+
DOMPoint.fromPoint({x : 10.0, y : 10.0, z : 10.0, w : 0.5}),
108+
DOMPoint.fromPoint(directionDict)
109+
), "Constructor should throw for non-1 origin w coordinate");
110+
}
113111
//
114112
// Constructor 2 - from rigid transform.
115113
//

testing/web-platform/tests/webxr/resources/webxr_test_constants_fake_world.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,26 @@ function createFakeWorld(
2929
// Faces:
3030
const FRONT_WALL_AND_FLOOR_FACES = [
3131
// Front wall:
32-
[BOTTOM_LEFT_FRONT, BOTTOM_RIGHT_FRONT, TOP_RIGHT_FRONT],
33-
[BOTTOM_LEFT_FRONT, TOP_RIGHT_FRONT, TOP_LEFT_FRONT],
32+
{ vertices: [BOTTOM_LEFT_FRONT, BOTTOM_RIGHT_FRONT, TOP_RIGHT_FRONT] },
33+
{ vertices: [BOTTOM_LEFT_FRONT, TOP_RIGHT_FRONT, TOP_LEFT_FRONT] },
3434
// Floor:
35-
[BOTTOM_LEFT_FRONT, BOTTOM_RIGHT_FRONT, BOTTOM_RIGHT_BACK],
36-
[BOTTOM_LEFT_FRONT, BOTTOM_LEFT_BACK, BOTTOM_RIGHT_BACK],
35+
{ vertices: [BOTTOM_LEFT_FRONT, BOTTOM_RIGHT_FRONT, BOTTOM_RIGHT_BACK] },
36+
{ vertices: [BOTTOM_LEFT_FRONT, BOTTOM_LEFT_BACK, BOTTOM_RIGHT_BACK] },
3737
];
3838

3939
const CEILING_FACES = [
4040
// Ceiling:
41-
[TOP_LEFT_FRONT, TOP_RIGHT_FRONT, TOP_RIGHT_BACK],
42-
[TOP_LEFT_FRONT, TOP_LEFT_BACK, TOP_RIGHT_BACK],
41+
{ vertices: [TOP_LEFT_FRONT, TOP_RIGHT_FRONT, TOP_RIGHT_BACK] },
42+
{ vertices: [TOP_LEFT_FRONT, TOP_LEFT_BACK, TOP_RIGHT_BACK] },
4343
];
4444

4545
const SIDE_WALLS_FACES = [
4646
// Left:
47-
[BOTTOM_LEFT_FRONT, TOP_LEFT_FRONT, TOP_LEFT_BACK],
48-
[BOTTOM_LEFT_FRONT, BOTTOM_LEFT_BACK, TOP_LEFT_BACK],
47+
{ vertices: [BOTTOM_LEFT_FRONT, TOP_LEFT_FRONT, TOP_LEFT_BACK] },
48+
{ vertices: [BOTTOM_LEFT_FRONT, BOTTOM_LEFT_BACK, TOP_LEFT_BACK] },
4949
// Right:
50-
[BOTTOM_RIGHT_FRONT, TOP_RIGHT_FRONT, TOP_RIGHT_BACK],
51-
[BOTTOM_RIGHT_FRONT, BOTTOM_RIGHT_BACK, TOP_RIGHT_BACK],
50+
{ vertices: [BOTTOM_RIGHT_FRONT, TOP_RIGHT_FRONT, TOP_RIGHT_BACK] },
51+
{ vertices: [BOTTOM_RIGHT_FRONT, BOTTOM_RIGHT_BACK, TOP_RIGHT_BACK] },
5252
];
5353

5454
// Regions:

0 commit comments

Comments
 (0)