mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:47:35 +00:00
LibWeb: Create canvas bitmap when not existing in toDataURL and toBlob
This commit is contained in:
parent
d24e07579f
commit
5e7a82a853
5 changed files with 34 additions and 3 deletions
22
Tests/LibWeb/Text/input/canvas/export.html
Normal file
22
Tests/LibWeb/Text/input/canvas/export.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
let testCounter = 1;
|
||||
function testPart(part) {
|
||||
println(`${testCounter++}. ${JSON.stringify(part())}`);
|
||||
}
|
||||
|
||||
// 1. Export a canvas to PNG data URL
|
||||
testPart(() => {
|
||||
const canvas = document.createElement('canvas');
|
||||
return canvas.toDataURL('image/png').substring(5, 14);
|
||||
});
|
||||
|
||||
// 2. Export a canvas to JPEG data URL
|
||||
// FIXME: This fails on macOS: https://github.com/SerenityOS/serenity/issues/21108
|
||||
// testPart(() => {
|
||||
// const canvas = document.createElement('canvas');
|
||||
// return canvas.toDataURL('image/jpeg').substring(5, 15);
|
||||
// });
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue