mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 19:33:18 +00:00
Bug 1331925 - Add mochitest. r=smaug
This commit is contained in:
parent
8da5275969
commit
d427770671
@ -251,6 +251,7 @@ tags = imagebitmap
|
||||
[test_mozGetAsFile.html]
|
||||
[test_strokeText_throw.html]
|
||||
[test_toBlob.html]
|
||||
[test_toBlob_zero_dimension.html]
|
||||
[test_toDataURL_alpha.html]
|
||||
[test_toDataURL_lowercase_ascii.html]
|
||||
[test_toDataURL_parameters.html]
|
||||
|
40
dom/canvas/test/test_toBlob_zero_dimension.html
Normal file
40
dom/canvas/test/test_toBlob_zero_dimension.html
Normal file
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: toBlob</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="0"></canvas>
|
||||
<script>
|
||||
|
||||
function testblob(blob) {
|
||||
is(blob, null, "Null blob expected");
|
||||
}
|
||||
|
||||
function test1(canvas)
|
||||
{
|
||||
canvas.toBlob(function(blob) {
|
||||
testblob(blob);
|
||||
test2(canvas);
|
||||
}, "image/png");
|
||||
}
|
||||
|
||||
function test2(canvas)
|
||||
{
|
||||
canvas.width = 0;
|
||||
canvas.height = 100;
|
||||
canvas.toBlob(function(blob) {
|
||||
testblob(blob);
|
||||
SimpleTest.finish();
|
||||
}, "image/png");
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
test1(canvas);
|
||||
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user