summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webxr/xrFrame_getViewerPose_getPose.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/xrFrame_getViewerPose_getPose.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/xrFrame_getViewerPose_getPose.https.html')
-rw-r--r--testing/web-platform/tests/webxr/xrFrame_getViewerPose_getPose.https.html62
1 files changed, 62 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webxr/xrFrame_getViewerPose_getPose.https.html b/testing/web-platform/tests/webxr/xrFrame_getViewerPose_getPose.https.html
new file mode 100644
index 0000000000..05cbf78523
--- /dev/null
+++ b/testing/web-platform/tests/webxr/xrFrame_getViewerPose_getPose.https.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<body>
+ <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 = "XRFrame getViewerPose(refSpace) matches getPose(viewer, refSpace).";
+
+ // Used for viewer origin, the actual values should not matter for the test.
+ const poseTransform = {
+ position: [1, 2, 3],
+ orientation: [0.5, 0.5, 0.5, 0.5] // 120 degrees around [1, 1, 1] axis
+ };
+
+ // Use the same device as tracked immersive device, but modify the viewer origin.
+ const deviceInitParams = Object.assign({}, TRACKED_IMMERSIVE_DEVICE, {viewerOrigin: poseTransform});
+
+ // Used when creating a reference space that is offset from local space.
+ // Actual values should not matter for the test.
+ const offsetSpaceTransform = new XRRigidTransform(
+ { x: 1.00, y: -1.50, z: 10.00, w: 1.0 },
+ { x: 0.27, y: 0.00, z: 0.27, w: 0.92}, // 45 degrees around [1, 0, 1] axis
+ );
+
+ const testFunction = function(session, fakeDeviceController, t) {
+ return Promise.all([
+ session.requestReferenceSpace('local'),
+ session.requestReferenceSpace('viewer'),
+ ]).then(([referenceSpace, viewerRefSpace]) => new Promise((resolve, reject) => {
+ const offsetRefSpace = referenceSpace.getOffsetReferenceSpace(offsetSpaceTransform);
+
+ function onFrame(time, frame){
+ t.step(() => {
+ const pose1 = frame.getViewerPose(referenceSpace);
+ const pose2 = frame.getPose(viewerRefSpace, referenceSpace);
+ assert_not_equals(pose1, null);
+ assert_not_equals(pose2, null);
+ assert_matrix_approx_equals(pose1.transform.matrix, pose2.transform.matrix);
+
+ const pose3 = frame.getViewerPose(offsetRefSpace);
+ const pose4 = frame.getPose(viewerRefSpace, offsetRefSpace);
+ assert_not_equals(pose3, null);
+ assert_not_equals(pose4, null);
+ assert_matrix_approx_equals(pose3.transform.matrix, pose4.transform.matrix);
+ });
+
+ resolve();
+ }
+
+ session.requestAnimationFrame(onFrame);
+ }));
+ };
+
+ xr_session_promise_test(testName, testFunction,
+ deviceInitParams, 'immersive-vr');
+
+ </script>
+</body>