Skip to content

Commit

Permalink
Bug 1628931 [wpt PR 22836] - Add interfaces/hit-test.idl and test, a=…
Browse files Browse the repository at this point in the history
…testonly

Automatic update from web-platform-tests
Add interfaces/hit-test.idl and test (#22836)

Due to the difficulty in testing webxr until test-only APIs are
supported in WPT (see
web-platform-tests/wpt#16455 (comment)),
the added test only tests the XRSession interface additions for now.

Closes web-platform-tests/wpt#22155
--

wpt-commits: 8a9e492c5bbfafeeb074902ab39910348a20776a
wpt-pr: 22836

UltraBlame original commit: 98cd0a5fb4a5952175d709aee6a2593c33f35ab9
  • Loading branch information
marco-c committed May 3, 2020
1 parent 0c73ee8 commit e341b4b
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
29 changes: 29 additions & 0 deletions testing/web-platform/tests/hit-test/idlharness.https.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!doctype html>
<title>WebXR hit-test IDL tests</title>
<link rel="help" href="https://immersive-web.github.io/hit-test/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>

<script>
'use strict';

idl_test(
['hit-test'],
['webxr', 'geometry', 'dom'],
async idl_array => {
idl_array.add_objects({
// TODO: XRHitTestSource
// TODO: XRTransientInputHitTestSource
// TODO: XRHitTestResult
// TODO: XRTransientInputHitTestResult
XRSession: ['xrSession'],
// TODO: XRFrame
XRRay: ['new XRRay()'],
});

self.xrSession = await navigator.xr.requestSession("inline");
}
);
</script>
62 changes: 62 additions & 0 deletions testing/web-platform/tests/interfaces/hit-test.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// GENERATED CONTENT - DO NOT EDIT
// Content was automatically extracted by Reffy into reffy-reports
// (https://github.com/tidoust/reffy-reports)
// Source: WebXR Hit Test Module (https://immersive-web.github.io/hit-test/)

enum XRHitTestTrackableType {
"point",
"plane",
"mesh"
};

dictionary XRHitTestOptionsInit {
required XRSpace space;
FrozenArray<XRHitTestTrackableType> entityTypes;
XRRay offsetRay;
};

dictionary XRTransientInputHitTestOptionsInit {
required DOMString profile;
FrozenArray<XRHitTestTrackableType> entityTypes;
XRRay offsetRay;
};

[SecureContext, Exposed=Window]
interface XRHitTestSource {
void cancel();
};

[SecureContext, Exposed=Window]
interface XRTransientInputHitTestSource {
void cancel();
};

[SecureContext, Exposed=Window]
interface XRHitTestResult {
XRPose? getPose(XRSpace baseSpace);
};

[SecureContext, Exposed=Window]
interface XRTransientInputHitTestResult {
[SameObject] readonly attribute XRInputSource inputSource;
readonly attribute FrozenArray<XRHitTestResult> results;
};

partial interface XRSession {
Promise<XRHitTestSource> requestHitTestSource(XRHitTestOptionsInit options);
Promise<XRTransientInputHitTestSource> requestHitTestSourceForTransientInput(XRTransientInputHitTestOptionsInit options);
};

partial interface XRFrame {
FrozenArray<XRHitTestResult> getHitTestResults(XRHitTestSource hitTestSource);
FrozenArray<XRTransientInputHitTestResult> getHitTestResultsForTransientInput(XRTransientInputHitTestSource hitTestSource);
};

[SecureContext, Exposed=Window,
Constructor(optional DOMPointInit origin, optional DOMPointInit direction),
Constructor(XRRigidTransform transform)]
interface XRRay {
[SameObject] readonly attribute DOMPointReadOnly origin;
[SameObject] readonly attribute DOMPointReadOnly direction;
[SameObject] readonly attribute Float32Array matrix;
};

0 comments on commit e341b4b

Please sign in to comment.