-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync 'css/geometry' tests from WPT upstream
https://bugs.webkit.org/show_bug.cgi?id=265211 rdar://problem/118893090 Reviewed by Tim Nguyen. Upstream commit: web-platform-tests/wpt@13d894d * LayoutTests/imported/w3c/web-platform-tests/css/geometry/DOMMatrix2DInit-validate-fixup-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/geometry/DOMMatrix2DInit-validate-fixup.html: * LayoutTests/imported/w3c/web-platform-tests/css/geometry/DOMRectList-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/geometry/DOMRectList.html: * LayoutTests/imported/w3c/web-platform-tests/css/geometry/idlharness-expected.txt: Removed. * LayoutTests/imported/w3c/web-platform-tests/css/geometry/idlharness.html: Removed. * LayoutTests/imported/w3c/web-platform-tests/css/geometry/idlharness.worker-expected.txt: Removed. * LayoutTests/imported/w3c/web-platform-tests/css/geometry/idlharness.worker.js: Removed. * LayoutTests/imported/w3c/web-platform-tests/css/geometry/support/dommatrix-test-util.js: (checkMatrix): * LayoutTests/imported/w3c/web-platform-tests/css/geometry/support/interfaces.js: Removed. * LayoutTests/imported/w3c/web-platform-tests/css/geometry/support/w3c-import.log: * LayoutTests/imported/w3c/web-platform-tests/css/geometry/w3c-import.log: * LayoutTests/imported/w3c/web-platform-tests/css/geometry/idlharness.any.worker.html: * LayoutTests/imported/w3c/web-platform-tests/css/geometry/idlharness.any.worker-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/geometry/idlharness.any.js: * LayoutTests/imported/w3c/web-platform-tests/css/geometry/idlharness.any.html: * LayoutTests/imported/w3c/web-platform-tests/css/geometry/idlharness.any-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/geometry/DOMMatrix-invert-preserves-2d.html: * LayoutTests/imported/w3c/web-platform-tests/css/geometry/DOMMatrix-invert-preserves-2d-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/geometry/DOMMatrix-invert-non-invertible.html: * LayoutTests/imported/w3c/web-platform-tests/css/geometry/DOMMatrix-invert-non-invertible-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/geometry/DOMMatrix-invert-invertible.html: * LayoutTests/imported/w3c/web-platform-tests/css/geometry/DOMMatrix-invert-invertible-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/geometry/idlharness.worker.html: Removed. Canonical link: https://commits.webkit.org/279043@main
- Loading branch information
Ahmad Saleem
committed
May 21, 2024
1 parent
63e956c
commit 71878cc
Showing
21 changed files
with
247 additions
and
189 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
...sts/imported/w3c/web-platform-tests/css/geometry/DOMMatrix-invert-invertible-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Test DOMMatrix.inverse()/invertSelf() for invertible matrices | ||
|
||
|
||
PASS identity | ||
PASS translate | ||
PASS translate3d | ||
PASS scale | ||
PASS scale3d | ||
PASS complex | ||
|
76 changes: 76 additions & 0 deletions
76
LayoutTests/imported/w3c/web-platform-tests/css/geometry/DOMMatrix-invert-invertible.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<!DOCTYPE html> | ||
<link rel="help" href="https://drafts.fxtf.org/geometry-1/#DOMMatrix"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="support/dommatrix-test-util.js"></script> | ||
<p>Test DOMMatrix.inverse()/invertSelf() for invertible matrices</p> | ||
<script> | ||
test(function() { | ||
var m = new DOMMatrix(); | ||
assert_true(m.isIdentity); | ||
var m1 = m.inverse(); | ||
assert_true(m1.isIdentity); | ||
// Use checkMatrix() instead of checkDOMMatrix() because checkMatrix() has | ||
// a default epsilon = Number.MIN_VALUE which can at least pass | ||
// assert_approx_equal(0, -0, epsilon). | ||
checkMatrix(m, m1); | ||
m.invertSelf(); | ||
checkMatrix(m, m1); | ||
}, "identity"); | ||
|
||
test(function() { | ||
var m = new DOMMatrix().translate(10, -20.5); | ||
var m1 = m.inverse(); | ||
checkMatrix(m1, new DOMMatrix().translate(-10, 20.5)); | ||
// Check with 'new DOMMatrix()' instead of identity() because the latter is | ||
// a 3d identity matrix. | ||
checkMatrix(m1.multiply(m), new DOMMatrix()); | ||
m.invertSelf(); | ||
checkMatrix(m, m1); | ||
}, "translate"); | ||
|
||
test(function() { | ||
var m = new DOMMatrix().translate(10, -20.5, 30.5); | ||
var m1 = m.inverse(); | ||
checkMatrix(m1, new DOMMatrix().translate(-10, 20.5, -30.5)); | ||
checkMatrix(m1.multiply(m), identity()); | ||
m.invertSelf(); | ||
checkMatrix(m, m1); | ||
}, "translate3d"); | ||
|
||
test(function() { | ||
var m = new DOMMatrix().scale(4, -0.5); | ||
var m1 = m.inverse(); | ||
checkMatrix(m1, new DOMMatrix().scale(0.25, -2.0)); | ||
checkMatrix(m1.multiply(m), new DOMMatrix()); | ||
m.invertSelf(); | ||
checkMatrix(m, m1); | ||
}, "scale"); | ||
|
||
test(function() { | ||
var m = new DOMMatrix().scale(4, -0.5, 2); | ||
var m1 = m.inverse(); | ||
checkMatrix(m1, new DOMMatrix().scale(0.25, -2.0, 0.5)); | ||
checkMatrix(m1.multiply(m), identity()); | ||
m.invertSelf(); | ||
checkMatrix(m, m1); | ||
}, "scale3d"); | ||
|
||
test(function() { | ||
var m = new DOMMatrix().rotateAxisAngle(0, 0, 1, -30) | ||
.scale(10, -0.5, 2.5) | ||
.rotateAxisAngle(0, 1, 0, 10) | ||
.translate(10, -20.5, 30.5) | ||
.rotateAxisAngle(1, 0, 0, 20); | ||
var expected = new DOMMatrix().rotateAxisAngle(1, 0, 0, -20) | ||
.translate(-10, 20.5, -30.5) | ||
.rotateAxisAngle(0, 1, 0, -10) | ||
.scale(0.1, -2.0, 0.4) | ||
.rotateAxisAngle(0, 0, 1, 30); | ||
var m1 = m.inverse(); | ||
var epsilon = 1e-6; | ||
checkMatrix(m1, expected, {epsilon}); | ||
m.invertSelf(); | ||
checkMatrix(m, expected, {epsilon}); | ||
}, "complex"); | ||
</script> |
6 changes: 6 additions & 0 deletions
6
...imported/w3c/web-platform-tests/css/geometry/DOMMatrix-invert-non-invertible-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Test DOMMatrix.inverse()/invertSelf() for non-invertible matrix | ||
|
||
|
||
PASS invertSelf() | ||
PASS inverse() | ||
|
50 changes: 50 additions & 0 deletions
50
...utTests/imported/w3c/web-platform-tests/css/geometry/DOMMatrix-invert-non-invertible.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!DOCTYPE html> | ||
<link rel="help" href="https://drafts.fxtf.org/geometry-1/#DOMMatrix"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<p>Test DOMMatrix.inverse()/invertSelf() for non-invertible matrix</p> | ||
<script> | ||
function checkResult(m) { | ||
assert_false(m.is2D, 'is2D'); | ||
assert_false(m.isIdentity, 'isIdentity'); | ||
assert_true(isNaN(m.m11), 'm11 isNaN'); | ||
assert_true(isNaN(m.m12), 'm12 isNaN'); | ||
assert_true(isNaN(m.m13), 'm13 isNaN'); | ||
assert_true(isNaN(m.m14), 'm14 isNaN'); | ||
assert_true(isNaN(m.m21), 'm21 isNaN'); | ||
assert_true(isNaN(m.m22), 'm22 isNaN'); | ||
assert_true(isNaN(m.m23), 'm23 isNaN'); | ||
assert_true(isNaN(m.m24), 'm24 isNaN'); | ||
assert_true(isNaN(m.m31), 'm31 isNaN'); | ||
assert_true(isNaN(m.m32), 'm32 isNaN'); | ||
assert_true(isNaN(m.m33), 'm33 isNaN'); | ||
assert_true(isNaN(m.m34), 'm34 isNaN'); | ||
assert_true(isNaN(m.m41), 'm41 isNaN'); | ||
assert_true(isNaN(m.m42), 'm42 isNaN'); | ||
assert_true(isNaN(m.m43), 'm43 isNaN'); | ||
assert_true(isNaN(m.m44), 'm44 isNaN'); | ||
|
||
var f32 = m.toFloat32Array(); | ||
assert_equals(f32.length, 16, 'toFloat32Array().length'); | ||
for (var i = 0; i < 16; i++) | ||
assert_true(isNaN(f32[i]), 'toFloat32Array()[' + i + '] isNaN'); | ||
|
||
var f64 = m.toFloat64Array(); | ||
assert_equals(f64.length, 16, 'toFloat64Array().length'); | ||
for (var i = 0; i < 16; i++) | ||
assert_true(isNaN(f64[i]), 'toFloat64()[' + i + '] isNaN'); | ||
} | ||
|
||
test(function() { | ||
var m = new DOMMatrix(); | ||
m.a = 0; | ||
m.invertSelf(); | ||
checkResult(m); | ||
},"invertSelf()"); | ||
|
||
test(function() { | ||
var m = new DOMMatrix(); | ||
m.a = 0; | ||
checkResult(m.inverse()); | ||
},"inverse()"); | ||
</script> |
4 changes: 4 additions & 0 deletions
4
...s/imported/w3c/web-platform-tests/css/geometry/DOMMatrix-invert-preserves-2d-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
PASS scale | ||
PASS rotate | ||
|
41 changes: 41 additions & 0 deletions
41
LayoutTests/imported/w3c/web-platform-tests/css/geometry/DOMMatrix-invert-preserves-2d.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!DOCTYPE html> | ||
<title>Test DOMMatrix.inverse()/invertSelf() keep is2D status</title> | ||
<link rel="help" href="https://drafts.fxtf.org/geometry-1/#DOMMatrix"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
function check2D(m) { | ||
assert_true(m.is2D); | ||
// assert_equals() distinguish 0 and -0, so use '== 0' instead. | ||
assert_true(m.m13 == 0); | ||
assert_true(m.m14 == 0); | ||
assert_true(m.m23 == 0); | ||
assert_true(m.m24 == 0); | ||
assert_true(m.m31 == 0); | ||
assert_true(m.m32 == 0); | ||
assert_equals(m.m33, 1); | ||
assert_true(m.m34 == 0); | ||
assert_true(m.m43 == 0); | ||
assert_equals(m.m44, 1); | ||
} | ||
|
||
test(function() { | ||
for (var s = 0.1; s < 20; s += 0.1) { | ||
m = new DOMMatrix().scale(s, s); | ||
check2D(m); | ||
check2D(m.inverse()); | ||
m.invertSelf(); | ||
check2D(m); | ||
} | ||
}, "scale"); | ||
|
||
test(function() { | ||
for (var r = 0; r < 180; r += 2) { | ||
m = new DOMMatrix().rotate(r); | ||
check2D(m); | ||
check2D(m.inverse()); | ||
m.invertSelf(); | ||
check2D(m); | ||
} | ||
}, "rotate"); | ||
</script> |
104 changes: 16 additions & 88 deletions
104
.../imported/w3c/web-platform-tests/css/geometry/DOMMatrix2DInit-validate-fixup-expected.txt
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
LayoutTests/imported/w3c/web-platform-tests/css/geometry/DOMRectList-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...ests/css/geometry/idlharness-expected.txt → .../css/geometry/idlharness.any-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
32 changes: 32 additions & 0 deletions
32
LayoutTests/imported/w3c/web-platform-tests/css/geometry/idlharness.any.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// META: script=/resources/WebIDLParser.js | ||
// META: script=/resources/idlharness.js | ||
|
||
// https://drafts.fxtf.org/geometry/#DOMPoint | ||
// https://drafts.fxtf.org/geometry/#DOMRect | ||
// https://drafts.fxtf.org/geometry/#DOMQuad | ||
// https://drafts.fxtf.org/geometry/#DOMMatrix | ||
|
||
"use strict"; | ||
|
||
idl_test( | ||
["geometry"], | ||
[], | ||
idlArray => { | ||
const domRectListList = []; | ||
if ("document" in self) { | ||
domRectListList.push(document.getElementById('log').getClientRects()); | ||
} | ||
idlArray.add_objects({ | ||
DOMPointReadOnly: ["new DOMPointReadOnly()"], | ||
DOMPoint: ["new DOMPoint()"], | ||
DOMRectReadOnly: ["new DOMRectReadOnly()"], | ||
DOMRect: ["new DOMRect()"], | ||
DOMRectList: domRectListList, | ||
DOMQuad: ["new DOMQuad()"], | ||
DOMMatrixReadOnly: ["new DOMMatrixReadOnly()", "DOMMatrixReadOnly.fromMatrix({is2D: false})"], | ||
DOMMatrix: ["new DOMMatrix()", "DOMMatrix.fromMatrix({is2D: false})"] | ||
}); | ||
idlArray.prevent_multiple_testing("DOMMatrixReadOnly"); | ||
idlArray.prevent_multiple_testing("DOMMatrix"); | ||
} | ||
); |
3 changes: 2 additions & 1 deletion
3
...s/geometry/idlharness.worker-expected.txt → ...ometry/idlharness.any.worker-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
LayoutTests/imported/w3c/web-platform-tests/css/geometry/idlharness.any.worker.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!-- This file is required for WebKit test infrastructure to run the templated test --> |
13 changes: 0 additions & 13 deletions
13
LayoutTests/imported/w3c/web-platform-tests/css/geometry/idlharness.html
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
LayoutTests/imported/w3c/web-platform-tests/css/geometry/idlharness.worker.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 0 additions & 31 deletions
31
LayoutTests/imported/w3c/web-platform-tests/css/geometry/support/interfaces.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.