mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
Update web-platform-tests to revision 9a4d479ed1347eb9184abc70d628a6da2297657a
This commit is contained in:
parent
b6cc0f60a9
commit
effeb278b6
120 changed files with 3731 additions and 298 deletions
|
@ -0,0 +1,98 @@
|
|||
<!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>
|
||||
<canvas id="webgl-canvas"></canvas>
|
||||
|
||||
<script>
|
||||
|
||||
let testName = "XRInputSources with a target ray mode of 'tracked-pointer' "
|
||||
+ "properly communicate their poses";
|
||||
|
||||
let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
|
||||
|
||||
let testFunction =
|
||||
(session, fakeDeviceController, t) => new Promise((resolve) => {
|
||||
let input_source = fakeDeviceController.simulateInputSourceConnection({
|
||||
handedness: "right",
|
||||
targetRayMode: "tracked-pointer",
|
||||
pointerOrigin: IDENTITY_TRANSFORM,
|
||||
profiles: []
|
||||
});
|
||||
|
||||
// Don't set a grip matrix yet
|
||||
|
||||
// Must have a reference space to get input poses. eye-level doesn't apply
|
||||
// any transforms to the given matrix.
|
||||
session.requestReferenceSpace('local').then( (referenceSpace) => {
|
||||
|
||||
function CheckInvalidGrip(time, xrFrame) {
|
||||
let source = session.inputSources[0];
|
||||
let grip_pose = xrFrame.getPose(source.gripSpace, referenceSpace);
|
||||
|
||||
t.step( () => {
|
||||
// The input pose should be null when no grip matrix is provided.
|
||||
assert_equals(source.targetRayMode, "tracked-pointer");
|
||||
assert_equals(grip_pose, null);
|
||||
});
|
||||
|
||||
input_source.setGripOrigin(VALID_GRIP_TRANSFORM);
|
||||
|
||||
session.requestAnimationFrame(CheckValidGrip);
|
||||
}
|
||||
|
||||
function CheckValidGrip(time, xrFrame) {
|
||||
let source = session.inputSources[0];
|
||||
|
||||
let grip_pose = xrFrame.getPose(source.gripSpace, referenceSpace);
|
||||
|
||||
let input_pose = xrFrame.getPose(source.targetRaySpace, referenceSpace);
|
||||
|
||||
t.step( () => {
|
||||
// When a grip matrix is present but no pointer offset is specified,
|
||||
// the grip and pointer matrices should be the same.
|
||||
assert_not_equals(grip_pose, null);
|
||||
assert_matrix_approx_equals(grip_pose.transform.matrix, VALID_GRIP,
|
||||
FLOAT_EPSILON, "Grip matrix is not equal to input.");
|
||||
assert_matrix_approx_equals(input_pose.transform.matrix,
|
||||
grip_pose.transform.matrix, FLOAT_EPSILON,
|
||||
"Grip matrix is not equal to target ray matrix.");
|
||||
});
|
||||
|
||||
input_source.setPointerOrigin(VALID_POINTER_TRANSFORM);
|
||||
|
||||
session.requestAnimationFrame(CheckValidGripAndPointer);
|
||||
}
|
||||
|
||||
function CheckValidGripAndPointer(time, xrFrame) {
|
||||
let source = session.inputSources[0];
|
||||
|
||||
let grip_pose = xrFrame.getPose(source.gripSpace, referenceSpace);
|
||||
let input_pose = xrFrame.getPose(source.targetRaySpace, referenceSpace);
|
||||
|
||||
t.step( () => {
|
||||
// When a grip matrix and pointer offset are specified,
|
||||
// pointer matrix should be grip matrix multiplied with the pointer
|
||||
// offset.
|
||||
assert_not_equals(grip_pose, null);
|
||||
assert_matrix_approx_equals(grip_pose.transform.matrix, VALID_GRIP,
|
||||
FLOAT_EPSILON, "Grip matrix is not equal to input valid grip.");
|
||||
assert_matrix_approx_equals(input_pose.transform.matrix,
|
||||
VALID_GRIP_WITH_POINTER_OFFSET, FLOAT_EPSILON,
|
||||
"Grip matrix not multipled properly.");
|
||||
});
|
||||
|
||||
resolve();
|
||||
}
|
||||
|
||||
// Can only request input poses in an xr frame.
|
||||
session.requestAnimationFrame(CheckInvalidGrip);
|
||||
});
|
||||
});
|
||||
|
||||
xr_session_promise_test(
|
||||
testName, testFunction, fakeDeviceInitParams, 'immersive-vr');
|
||||
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue