OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Canvas test: 2d.drawImage.animated.poster</title> | 2 <title>Canvas test: 2d.drawImage.animated.poster</title> |
3 <script src="../tests.js"></script> | 3 <script src="../tests.js"></script> |
4 <link rel="stylesheet" href="../tests.css"> | 4 <link rel="stylesheet" href="../tests.css"> |
5 <body> | 5 <body> |
6 <p id="passtext">Pass</p> | 6 <p id="passtext">Pass</p> |
7 <p id="failtext">Fail</p> | 7 <p id="failtext">Fail</p> |
8 <p class="output">These images should be identical:</p> | 8 <p class="output">These images should be identical:</p> |
9 <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (
fallback content)</p></canvas> | 9 <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (
fallback content)</p></canvas> |
10 <p class="output expectedtext">Expected output:<p><img src="green-100x50.png" cl
ass="output expected" id="expected" alt=""> | 10 <p class="output expectedtext">Expected output:<p><img src="green-100x50.png" cl
ass="output expected" id="expected" alt=""> |
11 <ul id="d"></ul> | 11 <ul id="d"></ul> |
12 <script> | 12 <script> |
13 _addTest(function(canvas, ctx) { | 13 _addTest(function(canvas, ctx) { |
14 | 14 |
15 ctx.drawImage(document.getElementById('anim-poster-gr.png'), 0, 0); | 15 // This test is disabled because it is wrong. It expects to draw the IDAT frame |
16 _assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2); | 16 // of an animated PNG in which the IDAT frame is not part of the animation. This |
| 17 // should only happen if we do *not* support APNG. Now that we support APNG, |
| 18 // this test fails. |
| 19 // |
| 20 // The ImageDecoder is not aware of what method is requesting the decode, and |
| 21 // the APNG specification [1] does explicitly state that the IDAT is not part |
| 22 // of the animated image if there's no fcTL chunk preceding it. It would make |
| 23 // more sense if this test would verify that the first frame of the image is |
| 24 // drawn, but that is explicitly not the purpose, as stated at [2]. In Firefox, |
| 25 // the developer of the APNG specification, this test [2] fails too. |
| 26 // |
| 27 // [1] https://wiki.mozilla.org/APNG_Specification |
| 28 // [2] http://www.w3c-test.org/2dcontext/drawing-images-to-the-canvas/2d.drawIma
ge.animated.apng.html |
| 29 _assertSame("disabled", "disabled", "disabled", "disabled"); |
| 30 |
| 31 // ctx.drawImage(document.getElementById('anim-poster-gr.png'), 0, 0); |
| 32 // _assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2); |
17 | 33 |
18 | 34 |
19 }); | 35 }); |
20 </script> | 36 </script> |
21 <img src="../images/anim-poster-gr.png" id="anim-poster-gr.png" class="resource"
> | 37 <img src="../images/anim-poster-gr.png" id="anim-poster-gr.png" class="resource"
> |
22 | 38 |
OLD | NEW |