1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-23 21:55:08 +00:00
serenity/Tests/LibWeb/Text/input/geometry/domquad.html
2023-08-23 12:11:21 +01:00

36 lines
1.1 KiB
HTML

<script src="../include.js"></script>
<script>
test(() => {
let testCounter = 1;
function testPart(part) {
println(`${testCounter++}. ${JSON.stringify(part())}`);
}
// 1. Creating a DOMQuad
testPart(() => new DOMQuad(
new DOMPoint(0, 0),
new DOMPoint(100, 0),
new DOMPoint(100, 100),
new DOMPoint(0, 100)
));
// 2. Creating DOMQuad with fromRect
testPart(() => DOMQuad.fromRect({ x: 0, y: 0, width: 100, height: 100 }));
// 3. Creating DOMQuad with fromQuad
testPart(() => DOMQuad.fromQuad({
p1: { x: 0, y: 0, z: 0, w: 1 },
p2: { x: 100, y: 0, z: 0, w: 1 },
p3: { x: 100, y: 100, z: 0, w: 1 },
p4: { x: 0, y: 100, z: 0, w: 1 }
}));
// 4. Getting the bounds of a DOMQuad
testPart(() => new DOMQuad(
new DOMPoint(0, 0),
new DOMPoint(100, 0),
new DOMPoint(100, 100),
new DOMPoint(0, 100)
).getBounds());
});
</script>