mirror of
https://github.com/servo/servo.git
synced 2025-07-03 21:43:41 +01:00
Add description strings to xrRigidTransform_constructor
This commit is contained in:
parent
1098454bc4
commit
d26b73dd3d
2 changed files with 23 additions and 22 deletions
|
@ -688053,7 +688053,7 @@
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"webxr/xrRigidTransform_constructor.https.html": [
|
"webxr/xrRigidTransform_constructor.https.html": [
|
||||||
"ad25a7f67ab30126fc9706b525cd02ac6ba36a3e",
|
"15a7f2b5771a78dba2036ec46933e826c9a54355",
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"webxr/xrRigidTransform_inverse.https.html": [
|
"webxr/xrRigidTransform_inverse.https.html": [
|
||||||
|
|
|
@ -41,22 +41,22 @@ let testFunction =
|
||||||
(point.w * point.w));
|
(point.w * point.w));
|
||||||
};
|
};
|
||||||
|
|
||||||
let checkDOMPoint = function(point, x, y, z, w) {
|
let checkDOMPoint = function(point, x, y, z, w, desc) {
|
||||||
t.step(() => {
|
t.step(() => {
|
||||||
assert_approx_equals(point.x, x, FLOAT_EPSILON);
|
assert_approx_equals(point.x, x, FLOAT_EPSILON, `${desc}: x value`);
|
||||||
assert_approx_equals(point.y, y, FLOAT_EPSILON);
|
assert_approx_equals(point.y, y, FLOAT_EPSILON, `${desc}: y value`);
|
||||||
assert_approx_equals(point.z, z, FLOAT_EPSILON);
|
assert_approx_equals(point.z, z, FLOAT_EPSILON, `${desc}: z value`);
|
||||||
assert_approx_equals(point.w, w, FLOAT_EPSILON);
|
assert_approx_equals(point.w, w, FLOAT_EPSILON, `${desc}: w value`);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
let checkTransform = function(transformObj) {
|
let checkTransform = function(transformObj, desc) {
|
||||||
t.step(() => {
|
t.step(() => {
|
||||||
assert_not_equals(transformObj, null);
|
assert_not_equals(transformObj, null, `${desc}: exists`);
|
||||||
assert_not_equals(transformObj.position, null);
|
assert_not_equals(transformObj.position, null, `${desc}: position exists`);
|
||||||
assert_not_equals(transformObj.orientation, null);
|
assert_not_equals(transformObj.orientation, null, `${desc}: orientation exists`);
|
||||||
assert_not_equals(transformObj.matrix, null);
|
assert_not_equals(transformObj.matrix, null, `${desc}: matrix exists`);
|
||||||
assert_equals(transformObj.matrix.length, 16);
|
assert_equals(transformObj.matrix.length, 16, `${desc}: matrix of correct length`);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -65,35 +65,36 @@ let testFunction =
|
||||||
let transform = new XRRigidTransform(
|
let transform = new XRRigidTransform(
|
||||||
createDOMPoint([1.0, 2.0, 3.0]),
|
createDOMPoint([1.0, 2.0, 3.0]),
|
||||||
createDOMPoint([1.1, 2.1, 3.1, 1.0]));
|
createDOMPoint([1.1, 2.1, 3.1, 1.0]));
|
||||||
checkTransform(transform);
|
checkTransform(transform, "Arbitrary transform");
|
||||||
checkDOMPoint(transform.position, 1.0, 2.0, 3.0, 1.0);
|
checkDOMPoint(transform.position, 1.0, 2.0, 3.0, 1.0, "Arbitrary transform position");
|
||||||
assert_approx_equals(quaternionLength(transform.orientation), 1.0, FLOAT_EPSILON);
|
assert_approx_equals(quaternionLength(transform.orientation), 1.0, FLOAT_EPSILON,
|
||||||
|
"Arbitrary transform is normalized");
|
||||||
|
|
||||||
// test creating identity transform
|
// test creating identity transform
|
||||||
let identity = new XRRigidTransform();
|
let identity = new XRRigidTransform();
|
||||||
checkTransform(identity);
|
checkTransform(identity, "Identity transform");
|
||||||
checkDOMPoint(identity.position, 0.0, 0.0, 0.0, 1.0);
|
checkDOMPoint(identity.position, 0.0, 0.0, 0.0, 1.0, "Identity transform position");
|
||||||
checkDOMPoint(identity.orientation, 0.0, 0.0, 0.0, 1.0);
|
checkDOMPoint(identity.orientation, 0.0, 0.0, 0.0, 1.0, "Identity transform orientation");
|
||||||
|
|
||||||
// create transform with only position specified
|
// create transform with only position specified
|
||||||
transform = new XRRigidTransform(createDOMPoint([1.0, 2.0, 3.0]));
|
transform = new XRRigidTransform(createDOMPoint([1.0, 2.0, 3.0]));
|
||||||
checkTransform(transform);
|
checkTransform(transform, "Position-only");
|
||||||
|
|
||||||
// create transform with only orientation specified
|
// create transform with only orientation specified
|
||||||
transform = new XRRigidTransform(undefined, createDOMPoint([1.1, 2.1, 3.1, 1.0]));
|
transform = new XRRigidTransform(undefined, createDOMPoint([1.1, 2.1, 3.1, 1.0]));
|
||||||
checkTransform(transform);
|
checkTransform(transform, "orientation-only");
|
||||||
|
|
||||||
// create transform with DOMPointReadOnly
|
// create transform with DOMPointReadOnly
|
||||||
transform = new XRRigidTransform(
|
transform = new XRRigidTransform(
|
||||||
createDOMPointReadOnly([1.0, 2.0, 3.0]),
|
createDOMPointReadOnly([1.0, 2.0, 3.0]),
|
||||||
createDOMPointReadOnly([1.1, 2.1, 3.1, 1.0]));
|
createDOMPointReadOnly([1.1, 2.1, 3.1, 1.0]));
|
||||||
checkTransform(transform);
|
checkTransform(transform, "Created with DOMPointReadOnly");
|
||||||
|
|
||||||
// create transform with dictionary
|
// create transform with dictionary
|
||||||
transform = new XRRigidTransform(
|
transform = new XRRigidTransform(
|
||||||
coordDict([1.0, 2.0, 3.0]),
|
coordDict([1.0, 2.0, 3.0]),
|
||||||
coordDict([1.1, 2.1, 3.1, 1.0]));
|
coordDict([1.1, 2.1, 3.1, 1.0]));
|
||||||
checkTransform(transform);
|
checkTransform(transform, "Created with dict");
|
||||||
|
|
||||||
assert_throws(new TypeError(), () => new XRRigidTransform(
|
assert_throws(new TypeError(), () => new XRRigidTransform(
|
||||||
coordDict([1.0, 2.0, 3.0, 0.5]),
|
coordDict([1.0, 2.0, 3.0, 0.5]),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue