Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/embedded-content/the-canvas-element/toBlob.png.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Canvas test: toBlob.png</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<canvas id="c"></canvas>
<script>
async_test(function() {
on_event(window, "load", this.step_func(function() {
var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');
canvas.toBlob(this.step_func_done(function(data) {
assert_equals(data.type, "image/png");
}), 'image/png');
}));
}, "toBlob with image/png returns a PNG Blob");
</script>