Skip to content

Commit

Permalink
Bug 1616411 - Part 7: Tests. r=tnikkel
Browse files Browse the repository at this point in the history
  • Loading branch information
heycam committed Apr 17, 2020
1 parent ef98dbf commit 84bd629
Show file tree
Hide file tree
Showing 34 changed files with 187 additions and 95 deletions.
2 changes: 1 addition & 1 deletion dom/html/reftests/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions image/test/reftest/downscaling/downscale-orient-ref.html
Original file line number Diff line number Diff line change
@@ -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>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions image/test/reftest/downscaling/downscale-orient.html
Original file line number Diff line number Diff line change
@@ -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>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions image/test/reftest/downscaling/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -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.
pref(layout.css.image-orientation.initial-from-image,true) 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)
Expand Down Expand Up @@ -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.
pref(layout.css.image-orientation.initial-from-image,true) 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
Expand Down
3 changes: 3 additions & 0 deletions layout/reftests/image-element/orientation-1-ref.html
Original file line number Diff line number Diff line change
@@ -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">
4 changes: 4 additions & 0 deletions layout/reftests/image-element/orientation-1.html
Original file line number Diff line number Diff line change
@@ -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">
2 changes: 1 addition & 1 deletion layout/reftests/image-element/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -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
41 changes: 0 additions & 41 deletions layout/reftests/image/image-orientation-border-image.html

This file was deleted.

39 changes: 0 additions & 39 deletions layout/reftests/image/image-orientation-list-style-image.html

This file was deleted.

5 changes: 0 additions & 5 deletions layout/reftests/image/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
prefs: [layout.css.image-orientation.initial-from-image:true, image.honor-orientation-metadata:true]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[drawImage-from-bitmap-orientation-none.tentative.html]
expected: FAIL
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[drawImage-from-bitmap-swap-width-height-orientation-none.tentative.html]
expected: FAIL

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[drawImage-from-element-orientation-none.tentative.html]
expected: FAIL
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[drawImage-from-element-swap-width-height-orientation-none.tentative.html]
expected: FAIL

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
leak-threshold: [default:51200]
prefs: [image.honor-orientation-metadata:true, layout.css.image-orientation.initial-from-image:true]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[image-orientation-background-image.html]
fuzzy: 2;40
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[image-orientation-border-image.html]
fuzzy: 0-16;80-160
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[image-orientation-list-style-image.html]
fuzzy: 0-4;0-41
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[image-orientation-mask-image.html]
fuzzy: 1;22
Original file line number Diff line number Diff line change
@@ -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:[email protected]">
<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>
Original file line number Diff line number Diff line change
@@ -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:[email protected]">
<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>
Original file line number Diff line number Diff line change
@@ -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:[email protected]">
<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>
Original file line number Diff line number Diff line change
@@ -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:[email protected]">
<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>
Original file line number Diff line number Diff line change
@@ -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>

Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 84bd629

Please sign in to comment.