mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 01:47:36 +00:00
LibWeb: Add DOMQuad and text tests
This commit is contained in:
parent
e4270bc01d
commit
c88f14902b
11 changed files with 218 additions and 0 deletions
36
Tests/LibWeb/Text/input/geometry/domquad.html
Normal file
36
Tests/LibWeb/Text/input/geometry/domquad.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
<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>
|
Loading…
Add table
Add a link
Reference in a new issue