1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:27:43 +00:00

LibWeb: Add DOMMatrix string constructor and set matrix value

This commit is contained in:
Bastiaan van der Plaat 2024-01-06 18:05:21 +01:00 committed by Andreas Kling
parent 903d3c92c8
commit be7538961b
15 changed files with 336 additions and 120 deletions

View file

@ -0,0 +1,32 @@
<script src="../include.js"></script>
<script>
test(() => {
let testCounter = 1;
function testPart(part) {
try {
println(`${testCounter}. ${JSON.stringify(part())}`);
} catch (e) {
println(`${testCounter}. Exception: ${e.name}`);
}
testCounter++;
}
// 1. DOMMatrix set matrix value empty
testPart(() => new DOMMatrix().setMatrixValue(''));
// 2. DOMMatrix set matrix value
testPart(() => new DOMMatrix().setMatrixValue('translate(10px, 10px)'));
// 3. DOMMatrix set matrix value
testPart(() => new DOMMatrix().setMatrixValue('rotate(10deg) translate(10px, 10px)'));
// 4. DOMMatrix set matrix value
testPart(() => new DOMMatrix().setMatrixValue('scale(0.2) rotate(10deg)'));
// 5. DOMMatrix set matrix value wrong
testPart(() => new DOMMatrix().setMatrixValue('scale(2deg)'));
// 6. DOMMatrix set matrix value wrong
testPart(() => new DOMMatrix().setMatrixValue('translate(40%)'));
});
</script>