mirror of
https://github.com/RGBCube/serenity
synced 2025-05-23 20:35:07 +00:00
37 lines
1.2 KiB
HTML
37 lines
1.2 KiB
HTML
<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>
|