mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-13 20:14:57 -10:00
Automatic update from web-platform-tests Replace some "assert_throws(new FooError(), stuff)" calls with assert_throws_js. (#21354) This diff was generated by running: find . -type f -print0 | xargs -0 perl -pi -e 'BEGIN { $/ = undef; } s/assert_throws\(([ \n]*)new ([A-Za-z]*Error) *\(\) *(, *.)/assert_throws_js(\1\2\3/gs' and then: 1) Manually adjusting fullscreen/rendering/fullscreen-pseudo-class-support.html to test for the right sort of exceptions ("SyntaxError" DOMException, not a JS SyntaxError). 2) Manually adjusting performance-timeline/po-observe-type.any.js to test for the right sort of exceptions ("SyntaxError" DOMException, not a JS SyntaxError). 3) Manually adjusting performance-timeline/po-observe.any.js to test for the right sort of exceptions ("SyntaxError" DOMException, not a JS SyntaxError). 4) Manually adjusting user-timing/mark_exceptions.html to test for the right sort of exceptions ("SyntaxError" DOMException, not a JS SyntaxError). 5) Manually adjusting user-timing/measure_syntax_err.any.js to test for the right sort of exceptions ("SyntaxError" DOMException, not a JS SyntaxError). 6) Manually adjusting domxpath/lexical-structure.html to test for a "SyntaxError" DOMException, since that's what all browsers throw and there is no clear spec for this. 7) Manually adjusting workers/constructors/Worker/Worker-constructor.html to test for the right sort of exceptions ("SyntaxError" DOMException, not a JS SyntaxError). 8) Backing out the changes to resources/idlharness.js because some tests pass objects from a different window to it, and we end up with the wrong TypeError constructor in those cases. This does affect indentation poorly in cases when the first arg was on the same line as the assert_throws, there was a newline after the ',' after the first arg, and the following args were lined up with the first arg. Fixing that, especially when there are multiple lines after the first arg, is not trivial with a regexp. Co-authored-by: Boris Zbarsky <[email protected]> Co-authored-by: Stephen McGruer <[email protected]> -- wpt-commits: 2c5c3c4c27d27a419c1fdba3e9879c2d22037074 wpt-pr: 21354
178 lines
8.7 KiB
HTML
178 lines
8.7 KiB
HTML
<!DOCTYPE html>
|
|
<html><head>
|
|
<title>Geometry Interfaces: DOMPoint and DOMPointReadOnly interface tests</title>
|
|
<link href="mailto:[email protected]" rel="author" title="Hwanseung Lee">
|
|
<link href="https://drafts.fxtf.org/geometry-1/#DOMPoint" rel="help">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
</head>
|
|
<body>
|
|
<p>Test DOMPoint and DOMPointReadOnly interfaces</p>
|
|
<div id="log"></div>
|
|
<script>
|
|
function getMatrixTransform(matrix, point) {
|
|
var x = point.x * matrix.m11 + point.y * matrix.m21 + point.z * matrix.m31 + point.w * matrix.m41;
|
|
var y = point.x * matrix.m12 + point.y * matrix.m22 + point.z * matrix.m32 + point.w * matrix.m42;
|
|
var w = point.x * matrix.m13 + point.y * matrix.m23 + point.z * matrix.m33 + point.w * matrix.m43;
|
|
var z = point.x * matrix.m14 + point.y * matrix.m24 + point.z * matrix.m34 + point.w * matrix.m44;
|
|
return new DOMPoint(x, y, w, z)
|
|
}
|
|
|
|
test(function() {
|
|
checkDOMPoint(new DOMPoint(), {x:0, y:0, z:0, w:1});
|
|
},'test DOMPoint Constructor no args');
|
|
test(function() {
|
|
checkDOMPoint(new DOMPoint(1), {x:1, y:0, z:0, w:1});
|
|
},'test DOMPoint Constructor one args');
|
|
test(function() {
|
|
checkDOMPoint(new DOMPoint(1, 2), {x:1, y:2, z:0, w:1});
|
|
},'test DOMPoint Constructor two args');
|
|
test(function() {
|
|
checkDOMPoint(new DOMPoint(1, 2, 3), {x:1, y:2, z:3, w:1});
|
|
},'test DOMPoint Constructor three args');
|
|
test(function() {
|
|
checkDOMPoint(new DOMPoint(1, 2, 3, 4), {x:1, y:2, z:3, w:4});
|
|
},'test DOMPoint Constructor four args');
|
|
test(function() {
|
|
checkDOMPoint(new DOMPoint(1, 2, 3, 4, 5), {x:1, y:2, z:3, w:4});
|
|
},'test DOMPoint Constructor more then four args');
|
|
test(function() {
|
|
checkDOMPoint(new DOMPoint(1, undefined), {x:1, y:0, z:0, w:1});
|
|
},'test DOMPoint Constructor with undefined');
|
|
test(function() {
|
|
checkDOMPoint(new DOMPoint("a", "b"), {x:NaN, y:NaN, z:0, w:1});
|
|
},'test DOMPoint Constructor with string');
|
|
test(function() {
|
|
checkDOMPoint(new DOMPoint({}), {x:NaN, y:0, z:0, w:1});
|
|
},'test DOMPoint Constructor with empty object');
|
|
test(function() {
|
|
checkDOMPoint(DOMPoint.fromPoint({}), {x:0, y:0, z:0, w:1});
|
|
},'test DOMPoint fromPoint with empty object');
|
|
test(function() {
|
|
checkDOMPoint(DOMPoint.fromPoint({x:1}), {x:1, y:0, z:0, w:1});
|
|
},'test DOMPoint fromPoint with x');
|
|
test(function() {
|
|
checkDOMPoint(DOMPoint.fromPoint({x:1, y:2}), {x:1, y:2, z:0, w:1});
|
|
},'test DOMPoint fromPoint with x, y');
|
|
test(function() {
|
|
checkDOMPoint(DOMPoint.fromPoint({x:1, y:2, z:3}), {x:1, y:2, z:3, w:1});
|
|
},'test DOMPoint fromPoint with x, y, z');
|
|
test(function() {
|
|
checkDOMPoint(DOMPoint.fromPoint({x:1, y:2, z:3, w:4}), {x:1, y:2, z:3, w:4});
|
|
},'test DOMPoint fromPoint with x, y, z, w');
|
|
test(function() {
|
|
checkDOMPoint(DOMPoint.fromPoint({x:1, y:2, z:3, w:4, v:5}), {x:1, y:2, z:3, w:4});
|
|
},'test DOMPoint fromPoint with x, y, z, w, v');
|
|
test(function() {
|
|
checkDOMPoint(DOMPoint.fromPoint({x:1, z:3}), {x:1, y:0, z:3, w:1});
|
|
},'test DOMPoint fromPoint with x, z');
|
|
test(function() {
|
|
checkDOMPoint(DOMPoint.fromPoint({x:1, y: undefined, z:3}), {x:1, y:0, z:3, w:1});
|
|
},'test DOMPoint fromPoint with undefined value');
|
|
test(function() {
|
|
var point = new DOMPoint(5, 4);
|
|
var matrix = new DOMMatrix([2, 0, 0, 2, 10, 10]);
|
|
var result = point.matrixTransform(matrix);
|
|
var expected = getMatrixTransform(matrix, point);
|
|
checkDOMPoint(result, expected);
|
|
},'test DOMPoint matrixTransform');
|
|
test(function() {
|
|
var point = new DOMPoint(42, 84);
|
|
assert_throws_js(TypeError, function() {
|
|
point.matrixTransform({ is2D: true, m33: 1.0000001 });
|
|
});
|
|
},'test DOMPoint matrixTransform with inconsistent input');
|
|
test(function() {
|
|
var p = new DOMPoint(0, 0, 0, 1);
|
|
p.x = undefined;
|
|
p.y = undefined;
|
|
p.z = undefined;
|
|
p.w = undefined;
|
|
checkDOMPoint(p, {x:NaN, y:NaN, z:NaN, w:NaN});
|
|
},'test DOMPoint Attributes undefined');
|
|
test(function() {
|
|
var p = new DOMPoint(0, 0, 0, 1);
|
|
p.x = NaN;
|
|
p.y = Number.POSITIVE_INFINITY;
|
|
p.z = Number.NEGATIVE_INFINITY;
|
|
p.w = Infinity;
|
|
checkDOMPoint(p, {x:NaN, y:Infinity, z:-Infinity, w:Infinity});
|
|
},'test DOMPoint Attributes NaN Infinity');
|
|
test(function() {
|
|
checkDOMPoint(new DOMPointReadOnly(), {x:0, y:0, z:0, w:1});
|
|
},'test DOMPointReadOnly Constructor no args');
|
|
test(function() {
|
|
checkDOMPoint(new DOMPointReadOnly(1), {x:1, y:0, z:0, w:1});
|
|
},'test DOMPointReadOnly Constructor one args');
|
|
test(function() {
|
|
checkDOMPoint(new DOMPointReadOnly(1, 2), {x:1, y:2, z:0, w:1});
|
|
},'test DOMPointReadOnly Constructor two args');
|
|
test(function() {
|
|
checkDOMPoint(new DOMPointReadOnly(1, 2, 3), {x:1, y:2, z:3, w:1});
|
|
},'test DOMPointReadOnly Constructor three args');
|
|
test(function() {
|
|
checkDOMPoint(new DOMPointReadOnly(1, 2, 3, 4), {x:1, y:2, z:3, w:4});
|
|
},'test DOMPointReadOnly Constructor four args');
|
|
test(function() {
|
|
checkDOMPoint(new DOMPointReadOnly(1, 2, 3, 4, 5), {x:1, y:2, z:3, w:4});
|
|
},'test DOMPointReadOnly Constructor more then four args');
|
|
test(function() {
|
|
checkDOMPoint(new DOMPointReadOnly(1, undefined), {x:1, y:0, z:0, w:1});
|
|
},'test DOMPointReadOnly Constructor with undefined');
|
|
test(function() {
|
|
checkDOMPoint(new DOMPointReadOnly("a", "b"), {x:NaN, y:NaN, z:0, w:1});
|
|
},'test DOMPointReadOnly Constructor with string');
|
|
test(function() {
|
|
checkDOMPoint(new DOMPointReadOnly({}), {x:NaN, y:0, z:0, w:1});
|
|
},'test DOMPointReadOnly Constructor with object');
|
|
test(function() {
|
|
checkDOMPoint(DOMPointReadOnly.fromPoint({}), {x:0, y:0, z:0, w:1});
|
|
},'test DOMPointReadOnly fromPoint with empty object');
|
|
test(function() {
|
|
checkDOMPoint(DOMPointReadOnly.fromPoint({x:1}), {x:1, y:0, z:0, w:1});
|
|
},'test DOMPointReadOnly fromPoint with x');
|
|
test(function() {
|
|
checkDOMPoint(DOMPointReadOnly.fromPoint({x:1, y:2}), {x:1, y:2, z:0, w:1});
|
|
},'test DOMPointReadOnly fromPoint with x, y');
|
|
test(function() {
|
|
checkDOMPoint(DOMPointReadOnly.fromPoint({x:1, y:2, z:3}), {x:1, y:2, z:3, w:1});
|
|
},'test DOMPointReadOnly fromPoint with x, y, z');
|
|
test(function() {
|
|
checkDOMPoint(DOMPointReadOnly.fromPoint({x:1, y:2, z:3, w:4}), {x:1, y:2, z:3, w:4});
|
|
},'test DOMPointReadOnly fromPoint with x, y, z, w');
|
|
test(function() {
|
|
checkDOMPoint(DOMPointReadOnly.fromPoint({x:1, y:2, z:3, w:4, v:5}), {x:1, y:2, z:3, w:4});
|
|
},'test DOMPointReadOnly fromPoint with x, y, z, w, v');
|
|
test(function() {
|
|
checkDOMPoint(DOMPointReadOnly.fromPoint({x:1, z:3}), {x:1, y:0, z:3, w:1});
|
|
},'test DOMPointReadOnly fromPoint with x, z');
|
|
test(function() {
|
|
checkDOMPoint(DOMPointReadOnly.fromPoint({x:1, y: undefined, z:3}), {x:1, y:0, z:3, w:1});
|
|
},'test DOMPointReadOnly fromPoint with undefined value');
|
|
test(function() {
|
|
var point = new DOMPointReadOnly(5, 4);
|
|
var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6]);
|
|
var result = point.matrixTransform(matrix);
|
|
var expected = getMatrixTransform(matrix, point);
|
|
checkDOMPoint(result, expected);
|
|
},'test DOMPointReadOnly matrixTransform');
|
|
test(function() {
|
|
var p = new DOMPointReadOnly(0, 0, 0, 1);
|
|
p.x = undefined;
|
|
p.y = undefined;
|
|
p.z = undefined;
|
|
p.w = undefined;
|
|
checkDOMPoint(p, {x:0, y:0, z:0, w:1});
|
|
},'test DOMPointReadOnly Attributes undefined');
|
|
|
|
function checkDOMPoint(p, exp) {
|
|
assert_equals(p.x, exp.x, "x is not matched");
|
|
assert_equals(p.y, exp.y, "y is not matched");
|
|
assert_equals(p.z, exp.z, "z is not matched");
|
|
assert_equals(p.w, exp.w, "w is not matched");
|
|
}
|
|
</script>
|
|
|
|
|
|
</body></html>
|