diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/content-dpr/image-with-dpr-header.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/content-dpr/image-with-dpr-header.html')
-rw-r--r-- | testing/web-platform/tests/content-dpr/image-with-dpr-header.html | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/testing/web-platform/tests/content-dpr/image-with-dpr-header.html b/testing/web-platform/tests/content-dpr/image-with-dpr-header.html new file mode 100644 index 0000000000..bfa1509d46 --- /dev/null +++ b/testing/web-platform/tests/content-dpr/image-with-dpr-header.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<body> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<img id="int_dpr" src="resources/dpr.py?name=square.png&mimeType=image/png&dpr=4.0"> +<img id="fractional_dpr" src="resources/dpr.py?name=square.png&mimeType=image/png&dpr=2.5"> +<img id="smaller_than_one" src="resources/dpr.py?name=square.png&mimeType=image/png&dpr=0.5"> +<img id="srcset" srcset="resources/square.png 4x"> +<img id="invalid" src="resources/dpr.py?name=square.png&mimeType=image/png&dpr=xx"> +<img id="invalid_negative" src="resources/dpr.py?name=square.png&mimeType=image/png&dpr=-2"> +<img id="invalid_zero" src="resources/dpr.py?name=square.png&mimeType=image/png&dpr=0"> +<img id="header_and_srcset_invalid" srcset="resources/dpr.py?name=square.png&mimeType=image/png&dpr=xx 4x"> +<img id="header_and_srcset_valid" srcset="resources/dpr.py?name=square.png&mimeType=image/png&dpr=4.0 2x"> +<img id="explicit_width" src="resources/dpr.py?name=square.png&mimeType=image/png&dpr=4.0" width="100" height="100"> +<img id="double_dpr" src="resources/dpr.py?name=square.png&mimeType=image/png&dpr=4.0&double=4.0"> +<img id="double_dpr_different_values" src="resources/dpr.py?name=square.png&mimeType=image/png&dpr=4.0&double=2.5"> + +<script> + let run_test = () => { + test(() => { + assert_equals(document.getElementById("int_dpr").naturalWidth, 25, "Integer Content-DPR header value") + assert_equals(document.getElementById("fractional_dpr").naturalWidth, 40, "Fractional Content-DPR header value") + assert_equals(document.getElementById("smaller_than_one").naturalWidth, 200, "Smaller than one Content-DPR header value") + assert_equals(document.getElementById("srcset").naturalWidth, 25, "srcset") + assert_equals(document.getElementById("invalid").naturalWidth, 100, "Invalid Content-DPR header value") + assert_equals(document.getElementById("invalid_negative").naturalWidth, 100, "Negative Content-DPR header value") + assert_equals(document.getElementById("invalid_zero").naturalWidth, 100, "Zero Content-DPR header value") + assert_equals(document.getElementById("header_and_srcset_invalid").naturalWidth, 25, "Invalid Content-DPR header value with valid srcset") + assert_equals(document.getElementById("header_and_srcset_valid").naturalWidth, 25, "Value Content-DPR header value and srcset") + assert_equals(document.getElementById("explicit_width").naturalWidth, 25, "Explicit width attribute") + assert_equals(document.getElementById("double_dpr").naturalWidth, 25, "Double Content-DPR header") + assert_equals(document.getElementById("double_dpr_different_values").naturalWidth, 40, "Double Content-DPR header different values") + + }, "Test the image dimensions of different DPR sizes"); + } + window.addEventListener("load", run_test); +</script> + +</body> +</html> |