Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / misc / canvas-pattern-from-incremental-image.html
blob4023f85cf55a8a2e1690cc99394a72bd1c94c37e
1 Tests that incomplete (not fully loaded/decoded) images cannot be used to create a CanvasPattern.<br/><br/>
2 <script>
3 if (window.testRunner)
4 testRunner.dumpAsText();
6 var canvas = document.createElement("canvas");
7 var ctx = canvas.getContext('2d');
8 ctx.fillRect(0,0,150,150);
9 var img = new Image();
10 img.src = 'resources/image-slow.pl';
11 var ptrn
12 try {
13 ptrn = ctx.createPattern(img, 'repeat');
14 if (!img.complete)
15 document.write("PASS - image is not complete");
16 else
17 document.write("FAIL - image is complete");
18 document.write("<br/>");
19 if (!ptrn)
20 document.write("PASS - createPattern() failed for incomplete image");
21 else
22 document.write("FAIL - createPattern() succeeded for incomplete image");
23 } catch (e) {
24 document.write("FAIL - caught exception: " + e);
26 </script>