summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webxr/xrReferenceSpace_relationships.https.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /testing/web-platform/tests/webxr/xrReferenceSpace_relationships.https.html
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/webxr/xrReferenceSpace_relationships.https.html')
-rw-r--r--testing/web-platform/tests/webxr/xrReferenceSpace_relationships.https.html58
1 files changed, 58 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webxr/xrReferenceSpace_relationships.https.html b/testing/web-platform/tests/webxr/xrReferenceSpace_relationships.https.html
new file mode 100644
index 0000000000..5b680fb861
--- /dev/null
+++ b/testing/web-platform/tests/webxr/xrReferenceSpace_relationships.https.html
@@ -0,0 +1,58 @@
+
+<!DOCTYPE html>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src="resources/webxr_util.js"></script>
+<script src="resources/webxr_test_constants.js"></script>
+<script src="resources/webxr_test_asserts.js"></script>
+<script>
+let testName =
+ "Bounded space, viewer space, local and local-floor space have correct poses w.r.t. each other";
+// 1m above world origin.
+const VIEWER_ORIGIN_TRANSFORM = {
+ position: [0, 1, 0],
+ orientation: [0, 0, 0, 1],
+};
+// 0.25m above world origin.
+const FLOOR_ORIGIN_TRANSFORM = {
+ position: [0, 0.25, 0],
+ orientation: [0, 0, 0, 1],
+};
+const fakeDeviceInitParams = {
+ supportsImmersive: true,
+ supportedModes: ["inline", "immersive-vr"],
+ views: VALID_VIEWS,
+ viewerOrigin: VIEWER_ORIGIN_TRANSFORM,
+ floorOrigin: FLOOR_ORIGIN_TRANSFORM,
+ supportedFeatures: ALL_FEATURES
+};
+let testFunction = function(session, fakeDeviceController, t) {
+ return new Promise((resolve, reject) => {
+ Promise.all([
+ session.requestReferenceSpace('bounded-floor'),
+ session.requestReferenceSpace('local'),
+ session.requestReferenceSpace('local-floor'),
+ session.requestReferenceSpace('viewer')
+ ]).then(([boundedSpace, localSpace, localFloorSpace, viewerSpace]) => {
+ t.step(() => {
+ });
+ const onFrame = function(time, xrFrame) {
+ const localFloorPoseInLocalSpace = xrFrame.getPose(localFloorSpace, localSpace);
+ const viewerPoseInLocalFloorSpace = xrFrame.getPose(viewerSpace, localFloorSpace);
+ const boundedFloorPoseInLocalFloorSpace = xrFrame.getPose(boundedSpace, localFloorSpace);
+ t.step(() => {
+ // Local floor space is supposed to be 0.25m above local space (aka world space).
+ assert_equals(localFloorPoseInLocalSpace.transform.position.y, 0.25);
+ // Bounded floor space should be at the same height as local floor space.
+ assert_equals(boundedFloorPoseInLocalFloorSpace.transform.position.y, 0.0);
+ // Viewer space should be additional 0.75m above local-floor space.
+ assert_equals(viewerPoseInLocalFloorSpace.transform.position.y, 0.75);
+ });
+ resolve();
+ }
+ session.requestAnimationFrame(onFrame);
+ });
+ });
+};
+xr_session_promise_test(testName, testFunction, fakeDeviceInitParams, 'immersive-vr', { 'requiredFeatures': ['local-floor', 'bounded-floor'] });
+</script>