OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
2 <html> | |
3 <head> | |
4 <script src = "../../resources/testharness.js"></script> | |
5 <script src= "../../resources/testharnessreport.js"></script> | |
6 <p>Test whether we can create object url from canvas.toBlob and put it in image< /p> | |
7 <script type = 'text/javascript'> | |
8 var newImg; | |
9 | |
10 function tryTestToBlob() | |
11 { | |
12 test(function() { | |
13 var canvas = document.createElement("canvas"); | |
14 var ctx = canvas.getContext("2d"); | |
15 ctx.fillStyle = "#FF0000"; | |
16 ctx.fillRect(0, 0, 150, 75); | |
17 | |
18 canvas.toBlob(function(blob) { | |
Justin Novosad
2015/08/20 20:38:42
This needs to be written as an asynchronous test.
| |
19 newImg = document.createElement("img"); | |
20 url = URL.createObjectURL(blob); | |
21 newImg.src = url; | |
22 document.body.appendChild(newImg); | |
23 assert_equals(newImg.src.substring(0, 9), "blob:null", | |
24 "The img is created as blob:null"); | |
25 }); | |
26 }, "toBlob function running successfully"); | |
27 } | |
28 </script> | |
29 </head> | |
30 <body onload="tryTestToBlob()"> | |
31 </body> | |
32 </html> | |
OLD | NEW |