Bug 1616411 - Part 7: Tests. r=tnikkel

Differential Revision: https://phabricator.services.mozilla.com/D70277

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Cameron McCormack 2020-04-16 00:34:46 +00:00
parent 687f8da347
commit 1c996b2686
34 changed files with 187 additions and 95 deletions

View File

@ -44,7 +44,7 @@ skip-if(Android) == 649134-2.html 649134-2-ref.html
# (Fuzzy necessary due to pixel-wise comparison of different JPEGs.
# The vast majority of the fuzziness comes from Linux and WinXP.)
pref(layout.css.image-orientation.initial-from-image,true) fuzzy(0-2,0-830) == bug917595-iframe-1.html bug917595-1-ref.html
fuzzy(0-3,0-640) fuzzy-if(skiaContent,0-3,0-7544) fuzzy-if(webrender&&!geckoview,2-3,3092-7544) == bug917595-exif-rotated.jpg bug917595-pixel-rotated.jpg # bug 1060869
fuzzy(0-3,0-640) fuzzy-if(skiaContent,0-3,0-7544) fuzzy-if(webrender&&!geckoview,2-3,52-7544) == bug917595-exif-rotated.jpg bug917595-pixel-rotated.jpg # bug 1060869
# Test support for SVG-as-image in <picture> elements.
== bug1106522-1.html bug1106522-ref.html

View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html class="reftest-wait">
<head>
<script>
function snapshot() {
document.documentElement.removeAttribute('class');
}
</script>
</head>
<!-- NOTE: Using setTimeout to wait for high-quality downscaled version of
image to be ready, because there's nothing better we can do. If we fix
Bug 1006883, we can do away with this setTimeout.
For now, the setTimeout is just here to increase the likelihood that we
actually test the high-quality downscaled version of the image. If the
setTimeout happens to fire before the high-quality downscaled rendering is
ready, then this the test will pass without testing what it's trying to
test, which is fine as long as that's rare. -->
<body onload="setTimeout(snapshot, 50)">
<img src="image-pre-rotated-90-deg.jpg" style="width: 50px; height: 25px;">
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html class="reftest-wait">
<head>
<script>
function snapshot() {
document.documentElement.removeAttribute('class');
}
</script>
</head>
<!-- NOTE: Using setTimeout to wait for high-quality downscaled version of
image to be ready, because there's nothing better we can do. If we fix
Bug 1006883, we can do away with this setTimeout.
For now, the setTimeout is just here to increase the likelihood that we
actually test the high-quality downscaled version of the image. If the
setTimeout happens to fire before the high-quality downscaled rendering is
ready, then this the test will pass without testing what it's trying to
test, which is fine as long as that's rare. -->
<body onload="setTimeout(snapshot, 50)">
<img src="../../../../layout/reftests/image/image-exif-90-deg.jpg" style="width: 50px; height: 25px;">
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -110,6 +110,9 @@ fuzzy(0-1,0-1024) == downscale-32px.html?.jpg downscale-32px-ref.html
== downscale-32px.html?-bmp-in.ico downscale-32px-ref.html
== downscale-32px.html?-png-in.ico downscale-32px-ref.html
# Test downscaling a JPEG with orientation metadata.
fuzzy(0-1,0-50) == downscale-orient.html downscale-orient-ref.html
# RUN TESTS WITH DOWNSCALE-DURING-DECODE ENABLED:
# ===============================================
defaults pref(image.downscale-during-decode.enabled,true)
@ -196,6 +199,9 @@ fuzzy(0-18,0-128) == downscale-32px.html?.png downscale-32px-ref.html
fuzzy(0-18,0-128) == downscale-32px.html?-bmp-in.ico downscale-32px-ref.html
fuzzy(0-18,0-128) == downscale-32px.html?-png-in.ico downscale-32px-ref.html
# Test downscaling a JPEG with orientation metadata.
fuzzy(0-4,0-15) == downscale-orient.html downscale-orient-ref.html
# Test images taller or wider than 32767 pixels.
== huge-1.html?100x32768.png,100,100 huge-1.html?100x100.png,100,100
== huge-1.html?100x32768.png,100,32768 huge-1.html?100x100.png,100,32768

View File

@ -0,0 +1,3 @@
<!DOCTYPE html>
<div style="width: 200px; height: 100px;"><img src="../image/image-exif-90-deg.jpg"></div>
<img src="../image/image-exif-90-deg.jpg">

View File

@ -0,0 +1,4 @@
<!DOCTYPE html>
<!-- Test that -moz-element() honors a target image's orientation metadata. -->
<div style="width: 200px; height: 100px; background-image: -moz-element(#e);"></div>
<img id="e" src="../image/image-exif-90-deg.jpg">

View File

@ -49,5 +49,5 @@ HTTP == invalidate-1.html invalidate-1-ref.html
== empty-src.html no-src.html
== broken-icon.html invalid-src.html
fails == invalid-src.html invalid-src-2.html # bug 1506804
fuzzy-if(skiaContent,0-1,0-30000) == mask-image-element.html mask-image-element-ref.html
pref(image.honor-orientation-metadata,true) pref(layout.css.image-orientation.initial-from-image,true) == orientation-1.html orientation-1-ref.html

View File

@ -1,41 +0,0 @@
<!DOCTYPE>
<head>
<style>
body {
border: 0px;
margin: 0px;
padding: 0px;
}
div {
width: 100px;
height: 100px;
margin: 50px;
/* This is deliberately an image with a non-neutral inherent orientation to */
/* ensure that the inherent orientation is irrelevant. */
border-style: solid;
border-width: 20px;
border-image: url(image-exif-90-deg-flip.jpg) 27 repeat;
}
</style>
</head>
<body>
<div></div>
<script>
var fromImage = location.search == "from-image";
// Construct a style.
var style;
if (fromImage) {
style = "div { image-orientation: from-image; }\n";
} else {
style = "div { image-orientation: none; }\n";
}
// Apply the style to the document.
var sheet = document.createElement('style');
sheet.innerHTML = style;
document.body.appendChild(sheet);
</script>
</body>

View File

@ -1,39 +0,0 @@
<!DOCTYPE>
<head>
<style>
body {
border: 0px;
margin: 0px;
padding: 0px;
}
ul {
list-style-position: inside;
list-style-image: url(image-exif-270-deg-flip.jpg);
}
</style>
</head>
<body>
<ul><li></li></ul>
<script>
var orientation = location.search.substring(1).split("&");
var angle = orientation[0];
var flip = orientation[1] == "flip" ? true : false;
// Construct a style. "from-image" is special-cased.
var style;
if (angle == "from-image") {
style = "ul { image-orientation: from-image; }\n";
} else {
style = "ul { image-orientation: "
+ angle + "deg"
+ (flip ? " flip" : "")
+ "; }\n";
}
// Apply the style to the document.
var sheet = document.createElement('style');
sheet.innerHTML = style;
document.body.appendChild(sheet);
</script>
</body>

View File

@ -38,11 +38,6 @@ fuzzy(0-1,0-1) == image-orientation-explicit-none.html image-orientation-ref.htm
# Tests for image-orientation:from-image used on generated content:
fuzzy(0-1,0-1) == image-orientation-generated-content.html image-orientation-generated-content-ref.html
# Tests that image-orientation does not apply to decorative images:
fuzzy(0-1,0-1) == image-orientation-background.html?from-image image-orientation-ref.html?none
== image-orientation-border-image.html?from-image image-orientation-border-image.html?none
== image-orientation-list-style-image.html?from-image image-orientation-list-style-image.html?none
fuzzy(0-1,0-1) == image-orientation-dynamic.html image-orientation-dynamic-ref.html
# <img srcset> tests

View File

@ -0,0 +1 @@
prefs: [layout.css.image-orientation.initial-from-image:true, image.honor-orientation-metadata:true]

View File

@ -0,0 +1,2 @@
[drawImage-from-bitmap-orientation-none.tentative.html]
expected: FAIL

View File

@ -0,0 +1,2 @@
[drawImage-from-bitmap-swap-width-height-orientation-none.tentative.html]
expected: FAIL

View File

@ -1,2 +0,0 @@
[drawImage-from-bitmap-swap-width-height.tentative.html]
expected: FAIL

View File

@ -1,2 +0,0 @@
[drawImage-from-bitmap.tentative.html]
expected: FAIL

View File

@ -0,0 +1,2 @@
[drawImage-from-element-orientation-none.tentative.html]
expected: FAIL

View File

@ -0,0 +1,2 @@
[drawImage-from-element-swap-width-height-orientation-none.tentative.html]
expected: FAIL

View File

@ -1,2 +0,0 @@
[drawImage-from-element-swap-width-height.tentative.html]
expected: FAIL

View File

@ -1,2 +0,0 @@
[drawImage-from-element.tentative.html]
expected: FAIL

View File

@ -1 +1,2 @@
leak-threshold: [default:51200]
prefs: [image.honor-orientation-metadata:true, layout.css.image-orientation.initial-from-image:true]

View File

@ -0,0 +1,2 @@
[image-orientation-background-image.html]
fuzzy: 2;40

View File

@ -0,0 +1,2 @@
[image-orientation-border-image.html]
fuzzy: 0-16;80-160

View File

@ -0,0 +1,2 @@
[image-orientation-list-style-image.html]
fuzzy: 2;40

View File

@ -0,0 +1,2 @@
[image-orientation-mask-image.html]
fuzzy: 1;22

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Images Module Level 3: image-orientation does not apply to background-image</title>
<link rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au">
<link rel="help" href="https://drafts.csswg.org/css-images-3/#propdef-image-orientation">
<link rel="match" href="reference/image-orientation-background-image-ref.html">
<meta name=fuzzy content="2;40">
<style>
div { width: 100px; height: 50px; background-image: url(support/exif-orientation-2-ur.jpg); }
.no-orient { image-orientation: none; }
</style>
<div></div>
<div class="no-orient"></div>

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Images Module Level 3: image-orientation does not apply to border images</title>
<link rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au">
<link rel="help" href="https://drafts.csswg.org/css-images-3/#propdef-image-orientation">
<link rel="match" href="reference/image-orientation-border-image-ref.html">
<style>
div {
width: 100px;
height: 50px;
border: 10px solid black;
border-image: url(support/exif-orientation-2-ur.jpg) 10;
}
.no-orient { image-orientation: none; }
</style>
<div></div>
<div class="no-orient"></div>

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Images Module Level 3: image-orientation does not apply to list-style-image</title>
<link rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au">
<link rel="help" href="https://drafts.csswg.org/css-images-3/#propdef-image-orientation">
<link rel="match" href="reference/image-orientation-list-style-image-ref.html">
<meta name=fuzzy content="2;40">
<style>
ul { margin-left: 100px; list-style-image: url(support/exif-orientation-2-ur.jpg); }
.no-orient { image-orientation: none; }
</style>
<ul><li>&nbsp;</li></ul>
<ul class="no-orient"><li>&nbsp;</li></ul>

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Images Module Level 3: image-orientation does not apply to mask-image</title>
<link rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au">
<link rel="help" href="https://drafts.csswg.org/css-images-3/#propdef-image-orientation">
<link rel="match" href="reference/image-orientation-mask-image-ref.html">
<meta name=fuzzy content="1;22">
<style>
div {
width: 100px;
height: 50px;
background: blue;
mask-image: url(support/exif-orientation-2-ur.jpg);
mask-mode: luminance;
}
.no-orient { image-orientation: none; }
</style>
<div></div>
<div class="no-orient"></div>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Reference</title>
<style>
div { width: 100px; height: 50px; background-image: url(../support/exif-orientation-2-ur-pre-rotated.jpg); }
</style>
<div></div>
<div></div>

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Reference</title>
<style>
div {
width: 100px;
height: 50px;
border: 10px solid black;
border-image: url(../support/exif-orientation-2-ur-pre-rotated.jpg) 10;
}
</style>
<div></div>
<div></div>

View File

@ -0,0 +1,8 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Reference</title>
<style>
ul { margin-left: 100px; list-style-image: url(../support/exif-orientation-2-ur-pre-rotated.jpg); }
</style>
<ul><li>&nbsp;</li></ul>
<ul><li>&nbsp;</li></ul>

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Reference</title>
<style>
div {
width: 100px;
height: 50px;
background: blue;
mask-image: url(../support/exif-orientation-2-ur-pre-rotated.jpg);
mask-mode: luminance;
}
</style>
<div></div>
<div></div>