mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
a9713881d1
--HG-- extra : rebase_source : 1a7a635dc5a7da047967d8feb57d637e83027618
36 lines
1.3 KiB
HTML
36 lines
1.3 KiB
HTML
<!DOCTYPE HTML>
|
|
<title>Canvas test: mozGetAsFile</title>
|
|
<script src="/MochiKit/MochiKit.js"></script>
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
|
<body>
|
|
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
|
<script>
|
|
SimpleTest.waitForExplicitFinish();
|
|
MochiKit.DOM.addLoadEvent(function () {
|
|
|
|
var canvas = document.getElementById('c');
|
|
var ctx = canvas.getContext('2d');
|
|
|
|
ctx.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
|
|
|
var pngfile = canvas.mozGetAsFile("foo.png");
|
|
is(pngfile.type, "image/png", "Default type for mozGetAsFile should be PNG");
|
|
is(pngfile.getAsDataURL(), canvas.toDataURL(),
|
|
"<canvas>.mozGetAsFile().getAsDataURL() should equal <canvas>.toDataURL()");
|
|
is(pngfile.name, "foo.png", "File name should be what we passed in");
|
|
|
|
var jpegfile = canvas.mozGetAsFile("bar.jpg", "image/jpeg");
|
|
is(jpegfile.type, "image/jpeg",
|
|
"When a valid type is specified that should be returned");
|
|
is(jpegfile.getAsDataURL(), canvas.toDataURL("image/jpeg"),
|
|
"<canvas>.mozGetAsFile().getAsDataURL() should equal <canvas>.toDataURL()");
|
|
is(jpegfile.name, "bar.jpg", "File name should be what we passed in");
|
|
|
|
SimpleTest.finish();
|
|
|
|
});
|
|
</script>
|
|
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
|
|