mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 02:14:57 +00:00
21 lines
649 B
HTML
21 lines
649 B
HTML
<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
|
|
testPart(() => {
|
|
const canvas = document.createElement('canvas');
|
|
return canvas.toDataURL('image/jpeg').substring(5, 15);
|
|
});
|
|
});
|
|
</script>
|