tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

exif-chunk.html (1402B)


      1 <!DOCTYPE html>
      2 <title>PNG test: eXIf chunk</title>
      3 <link rel="help" href="https://w3c.github.io/PNG-spec/#eXIf">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/html/canvas/resources/canvas-tests.js"></script>
      7 <body>
      8 
      9 <h1>eXIf chunk</h1>
     10 <p class="desc">test pixel values of a rotated PNG</p>
     11 
     12 <p class="output">Actual output:</p>
     13 <canvas id="c" class="output" width="200" height="200"><p class="fallback">FAIL (fallback content)</p></canvas>
     14 
     15 <ul id="d"></ul>
     16 <script>
     17 var t = async_test("test pixel values of a rotated PNG");
     18 const img = new Image();
     19 img.onload = () => {
     20  _addTest(function(canvas, ctx) {
     21    ctx.drawImage(img, 0, 0);
     22 
     23    var pixel = ctx.getImageData(5, 5, 1, 1).data;
     24 
     25    // The image data stores a 100x100 red block above a 100x100 green block.
     26    // By rotating the image, we can put the green block on top.
     27    const pixel_expected = [0, 255, 0, 255];
     28    const epsilon = 2;
     29 
     30    _assertSame(pixel.length, pixel_expected.length, "pixel.length", "pixel_expected.length");
     31    assert_approx_equals(pixel[0], pixel_expected[0], epsilon);
     32    assert_approx_equals(pixel[1], pixel_expected[1], epsilon);
     33    assert_approx_equals(pixel[2], pixel_expected[2], epsilon);
     34    assert_approx_equals(pixel[3], pixel_expected[3], epsilon);
     35  });
     36 };
     37 img.src = "support/exif-orientation-bottom-right.png";
     38 </script>