Bug 1935611 - Fix libyuv/libpng link failed for loongarch64. r=glandium,tnikkel,ng
[gecko.git] / dom / canvas / test / test_drawImageIncomplete.html
blob50253d96550fbd018374d0c12fd86b0a8fff0c7b
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=517056
5 -->
6 <head>
7 <title>Test for Bug 517056</title>
8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
10 </head>
11 <body>
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=517056">Mozilla Bug 517056</a>
13 <p id="display">
14 <canvas id="c" width="1" height="1"></canvas>
15 </p>
16 <div id="content" style="display: none">
18 </div>
19 <pre id="test">
20 <script type="application/javascript">
22 /** Test for Bug 517056 **/
23 var ctx = $("c").getContext('2d');
24 ctx.fillStyle = "black";
25 ctx.fillRect(0, 0, 1, 1);
26 var data = ctx.getImageData(0, 0, 1, 1).data;
27 is(data[0], 0, "Red channel of black should be 0");
28 is(data[1], 0, "Green channel of black should be 0");
29 is(data[2], 0, "Blue channel of black should be 0")
30 is(data[3], 255, "Alpha channel of black should be opaque");
31 var img = new Image();
32 // Force a new URI every time, so that we don't run into stupid caching issues.
33 img.src = "image_green-1x1.png?" + (new Date + 0) + Math.random();
34 // This shouldn't throw
35 ctx.drawImage(img, 0, 0);
36 var data = ctx.getImageData(0, 0, 1, 1).data;
37 is(data[0], 0, "Red channel of black should be 0 and image should have been ignored");
38 is(data[1], 0, "Green channel of black should be 0 and image should have been ignored");
39 is(data[2], 0, "Blue channel of black should be 0 and image should have been ignored")
40 is(data[3], 255, "Alpha channel of black should be opaque and image should have been ignored");
42 SimpleTest.waitForExplicitFinish();
43 img.onload = function() {
44 ctx.drawImage(img, 0, 0);
45 var loadData = ctx.getImageData(0, 0, 1, 1).data;
46 is(loadData[0], 0, "Red channel of green should be 0");
47 is(loadData[1], 255, "Green channel of green should be 255");
48 is(loadData[2], 0, "Blue channel of green should be 0")
49 is(loadData[3], 255, "Alpha channel of green should be opaque");
51 SimpleTest.finish();
56 </script>
57 </pre>
58 </body>
59 </html>