toBlob.null.html (1241B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>Canvas test: toBlob.null</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="/html/canvas/resources/canvas-tests.js"></script> 7 <link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css"> 8 <body class="show_output"> 9 10 <h1>toBlob.null</h1> 11 <p class="desc">toBlob with zero dimension returns a null Blob</p> 12 13 <p class="output">Actual output:</p> 14 <canvas id="c" class="output" width="100" height="0"><p class="fallback">FAIL (fallback content)</p></canvas> 15 16 <ul id="d"></ul> 17 <script> 18 async_test(function() { 19 on_event(window, "load", this.step_func(function() { 20 var toBlobCalled = false; 21 c.toBlob(this.step_func(function(blob) { 22 toBlobCalled = true; 23 _assertSame(blob, null, "blob", "null"); 24 c.width = 0; 25 c.height = 100; 26 c.toBlob(this.step_func_done(function(blob) { 27 _assertSame(blob, null, "blob", "null"); 28 }), 'image/jpeg'); 29 }), 'image/jpeg'); 30 assert_false(toBlobCalled, "toBlob callback shouldn't be called synchronously"); 31 })); 32 }, "toBlob with zero dimension returns a null Blob"); 33 </script>