Bug 1935611 - Fix libyuv/libpng link failed for loongarch64. r=glandium,tnikkel,ng
[gecko.git] / dom / canvas / test / test_bug902651.html
blob2491138012a6ea2458fbf0edc8af65636f3173f4
1 <!DOCTYPE HTML>
2 <title>Canvas test: canvas demotion</title>
3 <script src="/tests/SimpleTest/SimpleTest.js"></script>
4 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
5 <body>
6 <canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
7 <script>
9 SimpleTest.waitForExplicitFinish();
10 SimpleTest.requestFlakyTimeout("untriaged");
11 addLoadEvent(function () {
13 var canvas = document.getElementById('c');
14 var ctx = canvas.getContext('2d');
16 ctx.fillStyle = 'rgb(50, 50, 50)';
17 ctx.fillRect(0, 0, 100, 50);
18 ctx.translate(25, 25);
20 SpecialPowers.wrap(ctx).demote();
22 setTimeout(function() {
23 ctx.fillStyle = 'rgb(127, 127, 127)';
24 ctx.fillRect(0, 0, 10, 10);
26 var pixels = ctx.getImageData(0, 0, 1, 1);
28 ok(pixels.data[0] === 50, "pixels.data[0] expected 50, got " + pixels.data[0]);
29 ok(pixels.data[1] === 50, "pixels.data[1] expected 50, got " + pixels.data[1]);
30 ok(pixels.data[2] === 50, "pixels.data[2] expected 50, got " + pixels.data[2]);
32 pixels = ctx.getImageData(25, 25, 1, 1);
34 ok(pixels.data[0] === 127, "pixels.data[0] expected 127, got " + pixels.data[0]);
35 ok(pixels.data[1] === 127, "pixels.data[1] expected 127, got " + pixels.data[1]);
36 ok(pixels.data[2] === 127, "pixels.data[2] expected 127, got " + pixels.data[2]);
38 SimpleTest.finish();
39 }, 50);
42 });
43 </script>