diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/png/exif-chunk.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/png/exif-chunk.html')
-rw-r--r-- | testing/web-platform/tests/png/exif-chunk.html | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/testing/web-platform/tests/png/exif-chunk.html b/testing/web-platform/tests/png/exif-chunk.html new file mode 100644 index 0000000000..1cb0e2755e --- /dev/null +++ b/testing/web-platform/tests/png/exif-chunk.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<title>PNG test: eXIf chunk</title> +<link rel="help" href="https://w3c.github.io/PNG-spec/#eXIf"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<body> + +<h1>eXIf chunk</h1> +<p class="desc">test pixel values of a rotated PNG</p> + +<p class="output">Actual output:</p> +<canvas id="c" class="output" width="200" height="200"><p class="fallback">FAIL (fallback content)</p></canvas> + +<ul id="d"></ul> +<script> +var t = async_test("test pixel values of a rotated PNG"); +const img = new Image(); +img.onload = () => { + _addTest(function(canvas, ctx) { + ctx.drawImage(img, 0, 0); + + var pixel = ctx.getImageData(5, 5, 1, 1).data; + + // The image data stores a 100x100 red block above a 100x100 green block. + // By rotating the image, we can put the green block on top. + const pixel_expected = [0, 255, 0, 255]; + const epsilon = 2; + + _assertSame(pixel.length, pixel_expected.length, "pixel.length", "pixel_expected.length"); + assert_approx_equals(pixel[0], pixel_expected[0], epsilon); + assert_approx_equals(pixel[1], pixel_expected[1], epsilon); + assert_approx_equals(pixel[2], pixel_expected[2], epsilon); + assert_approx_equals(pixel[3], pixel_expected[3], epsilon); + }); +}; +img.src = "support/exif-orientation-bottom-right.png"; +</script> |