mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:47:35 +00:00
LibWeb: Add DOMPoint matrixTransform and DOMMatrix transformPoint
This commit is contained in:
parent
38bc8836d6
commit
b4ae719664
9 changed files with 106 additions and 2 deletions
6
Tests/LibWeb/Text/expected/geometry/dompoint.txt
Normal file
6
Tests/LibWeb/Text/expected/geometry/dompoint.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
1. {"x":10,"y":20,"z":0,"w":1}
|
||||
2. {"x":1,"y":2,"z":3,"w":4}
|
||||
3. {"a":10,"b":20,"c":30,"d":40,"e":50,"f":60,"m11":10,"m12":20,"m13":0,"m14":0,"m21":30,"m22":40,"m23":0,"m24":0,"m31":0,"m32":0,"m33":1,"m34":0,"m41":50,"m42":60,"m43":0,"m44":1,"is2D":true,"isIdentity":false}
|
||||
4. {"x":750,"y":1060,"z":0,"w":1}
|
||||
5. {"x":750,"y":1060,"z":0,"w":1}
|
||||
6. {"x":750,"y":1060,"z":0,"w":1}
|
37
Tests/LibWeb/Text/input/geometry/dompoint.html
Normal file
37
Tests/LibWeb/Text/input/geometry/dompoint.html
Normal file
|
@ -0,0 +1,37 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
let testCounter = 1;
|
||||
function testPart(part) {
|
||||
println(`${testCounter++}. ${JSON.stringify(part())}`);
|
||||
}
|
||||
|
||||
// 1. Creating a DOMPoint
|
||||
testPart(() => new DOMPoint(10, 20));
|
||||
|
||||
// 2. Creating DOMPoint with fromPoint
|
||||
testPart(() => DOMPoint.fromPoint({ x: 1, y: 2, z: 3, w: 4 }));
|
||||
|
||||
// 3. Creating a DOMMatrix
|
||||
testPart(() => new DOMMatrix([10, 20, 30, 40, 50, 60]));
|
||||
|
||||
// 4. Transforming a DOMPoint using a DOMMatrix
|
||||
testPart(function () {
|
||||
const matrix = new DOMMatrix([10, 20, 30, 40, 50, 60]);
|
||||
const point = new DOMPoint(10, 20);
|
||||
return point.matrixTransform(matrix);
|
||||
});
|
||||
|
||||
// 5. Transforming a point using a DOMMatrix
|
||||
testPart(function () {
|
||||
const matrix = new DOMMatrix([10, 20, 30, 40, 50, 60]);
|
||||
return matrix.transformPoint(new DOMPoint(10, 20));
|
||||
});
|
||||
|
||||
// 6. Transforming a point using a DOMMatrix
|
||||
testPart(function () {
|
||||
const matrix = new DOMMatrix([10, 20, 30, 40, 50, 60]);
|
||||
return matrix.transformPoint({x: 10, y: 20});
|
||||
});
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue