Bug 1098417 part 4: Add reftests for anchor-point handling, with SVG images & a range of "object-position" values. (no review)

--HG--
rename : layout/reftests/w3c-css/submitted/images3/support/generate-object-position-png-tests.sh => layout/reftests/w3c-css/submitted/images3/support/generate-object-position-svg-tests.sh
This commit is contained in:
Daniel Holbert 2014-11-25 16:46:15 -08:00
parent 3379bd0195
commit 6062b6e735
12 changed files with 532 additions and 0 deletions

View File

@ -0,0 +1,42 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<meta charset="utf-8">
<title>CSS Reftest Reference</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<style type="text/css">
div {
background: lightgray;
margin-right: 2px;
background-image: url("support/colors-16x8.svg");
background-size: contain;
background-repeat: no-repeat;
float: left;
width: 20px;
height: 20px;
}
.op_y-7 { background-position: 50% -7% }
.op_y13 { background-position: 50% 13% }
.op_y23 { background-position: 50% 23% }
.op_y50 { background-position: 50% 50% }
.op_y75 { background-position: 50% 75% }
.op_y88 { background-position: 50% 88% }
.op_y111 { background-position: 50% 111% }
</style>
</head>
<body>
<div class="op_y-7"></div>
<div class="op_y13"></div>
<div class="op_y23"></div>
<div class="op_y50"></div>
<div class="op_y75"></div>
<div class="op_y88"></div>
<div class="op_y111"></div>
</body>
</html>

View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<meta charset="utf-8">
<title>CSS Test: various 'object-position' values on a fixed-size embed element, with a SVG image and 'object-fit:contain'.</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<link rel="help" href="http://www.w3.org/TR/css3-images/#sizing">
<link rel="help" href="http://www.w3.org/TR/css3-images/#the-object-fit">
<link rel="help" href="http://www.w3.org/TR/css3-images/#the-object-position">
<link rel="match" href="object-position-svg-001-ref.html">
<style type="text/css">
embed {
background: lightgray;
margin-right: 2px;
object-fit: contain;
float: left;
width: 20px;
height: 20px;
}
.op_y-7 { object-position: 50% -7% }
.op_y13 { object-position: 50% 13% }
.op_y23 { object-position: 50% 23% }
.op_y50 { object-position: 50% 50% }
.op_y75 { object-position: 50% 75% }
.op_y88 { object-position: 50% 88% }
.op_y111 { object-position: 50% 111% }
</style>
</head>
<body>
<embed src="support/colors-16x8.svg" class="op_y-7">
<embed src="support/colors-16x8.svg" class="op_y13">
<embed src="support/colors-16x8.svg" class="op_y23">
<embed src="support/colors-16x8.svg" class="op_y50">
<embed src="support/colors-16x8.svg" class="op_y75">
<embed src="support/colors-16x8.svg" class="op_y88">
<embed src="support/colors-16x8.svg" class="op_y111">
</body>
</html>

View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<meta charset="utf-8">
<title>CSS Test: various 'object-position' values on a fixed-size img element, with a SVG image and 'object-fit:contain'.</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<link rel="help" href="http://www.w3.org/TR/css3-images/#sizing">
<link rel="help" href="http://www.w3.org/TR/css3-images/#the-object-fit">
<link rel="help" href="http://www.w3.org/TR/css3-images/#the-object-position">
<link rel="match" href="object-position-svg-001-ref.html">
<style type="text/css">
img {
background: lightgray;
margin-right: 2px;
object-fit: contain;
float: left;
width: 20px;
height: 20px;
}
.op_y-7 { object-position: 50% -7% }
.op_y13 { object-position: 50% 13% }
.op_y23 { object-position: 50% 23% }
.op_y50 { object-position: 50% 50% }
.op_y75 { object-position: 50% 75% }
.op_y88 { object-position: 50% 88% }
.op_y111 { object-position: 50% 111% }
</style>
</head>
<body>
<img src="support/colors-16x8.svg" class="op_y-7">
<img src="support/colors-16x8.svg" class="op_y13">
<img src="support/colors-16x8.svg" class="op_y23">
<img src="support/colors-16x8.svg" class="op_y50">
<img src="support/colors-16x8.svg" class="op_y75">
<img src="support/colors-16x8.svg" class="op_y88">
<img src="support/colors-16x8.svg" class="op_y111">
</body>
</html>

View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<meta charset="utf-8">
<title>CSS Test: various 'object-position' values on a fixed-size object element, with a SVG image and 'object-fit:contain'.</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<link rel="help" href="http://www.w3.org/TR/css3-images/#sizing">
<link rel="help" href="http://www.w3.org/TR/css3-images/#the-object-fit">
<link rel="help" href="http://www.w3.org/TR/css3-images/#the-object-position">
<link rel="match" href="object-position-svg-001-ref.html">
<style type="text/css">
object {
background: lightgray;
margin-right: 2px;
object-fit: contain;
float: left;
width: 20px;
height: 20px;
}
.op_y-7 { object-position: 50% -7% }
.op_y13 { object-position: 50% 13% }
.op_y23 { object-position: 50% 23% }
.op_y50 { object-position: 50% 50% }
.op_y75 { object-position: 50% 75% }
.op_y88 { object-position: 50% 88% }
.op_y111 { object-position: 50% 111% }
</style>
</head>
<body>
<object data="support/colors-16x8.svg" class="op_y-7"></object>
<object data="support/colors-16x8.svg" class="op_y13"></object>
<object data="support/colors-16x8.svg" class="op_y23"></object>
<object data="support/colors-16x8.svg" class="op_y50"></object>
<object data="support/colors-16x8.svg" class="op_y75"></object>
<object data="support/colors-16x8.svg" class="op_y88"></object>
<object data="support/colors-16x8.svg" class="op_y111"></object>
</body>
</html>

View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<meta charset="utf-8">
<title>CSS Test: various 'object-position' values on a fixed-size video element, with a SVG image and 'object-fit:contain'.</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<link rel="help" href="http://www.w3.org/TR/css3-images/#sizing">
<link rel="help" href="http://www.w3.org/TR/css3-images/#the-object-fit">
<link rel="help" href="http://www.w3.org/TR/css3-images/#the-object-position">
<link rel="match" href="object-position-svg-001-ref.html">
<style type="text/css">
video {
background: lightgray;
margin-right: 2px;
object-fit: contain;
float: left;
width: 20px;
height: 20px;
}
.op_y-7 { object-position: 50% -7% }
.op_y13 { object-position: 50% 13% }
.op_y23 { object-position: 50% 23% }
.op_y50 { object-position: 50% 50% }
.op_y75 { object-position: 50% 75% }
.op_y88 { object-position: 50% 88% }
.op_y111 { object-position: 50% 111% }
</style>
</head>
<body>
<video poster="support/colors-16x8.svg" class="op_y-7"></video>
<video poster="support/colors-16x8.svg" class="op_y13"></video>
<video poster="support/colors-16x8.svg" class="op_y23"></video>
<video poster="support/colors-16x8.svg" class="op_y50"></video>
<video poster="support/colors-16x8.svg" class="op_y75"></video>
<video poster="support/colors-16x8.svg" class="op_y88"></video>
<video poster="support/colors-16x8.svg" class="op_y111"></video>
</body>
</html>

View File

@ -0,0 +1,42 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<meta charset="utf-8">
<title>CSS Reftest Reference</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<style type="text/css">
div {
background: lightgray;
margin-right: 2px;
background-image: url("support/colors-8x16.svg");
background-size: contain;
background-repeat: no-repeat;
float: left;
width: 20px;
height: 20px;
}
.op_x-7 { background-position: -7% 50% }
.op_x13 { background-position: 13% 50% }
.op_x23 { background-position: 23% 50% }
.op_x50 { background-position: 50% 50% }
.op_x75 { background-position: 75% 50% }
.op_x88 { background-position: 88% 50% }
.op_x111 { background-position: 111% 50% }
</style>
</head>
<body>
<div class="op_x-7"></div>
<div class="op_x13"></div>
<div class="op_x23"></div>
<div class="op_x50"></div>
<div class="op_x75"></div>
<div class="op_x88"></div>
<div class="op_x111"></div>
</body>
</html>

View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<meta charset="utf-8">
<title>CSS Test: various 'object-position' values on a fixed-size embed element, with a SVG image and 'object-fit:contain'.</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<link rel="help" href="http://www.w3.org/TR/css3-images/#sizing">
<link rel="help" href="http://www.w3.org/TR/css3-images/#the-object-fit">
<link rel="help" href="http://www.w3.org/TR/css3-images/#the-object-position">
<link rel="match" href="object-position-svg-002-ref.html">
<style type="text/css">
embed {
background: lightgray;
margin-right: 2px;
object-fit: contain;
float: left;
width: 20px;
height: 20px;
}
.op_x-7 { object-position: -7% 50% }
.op_x13 { object-position: 13% 50% }
.op_x23 { object-position: 23% 50% }
.op_x50 { object-position: 50% 50% }
.op_x75 { object-position: 75% 50% }
.op_x88 { object-position: 88% 50% }
.op_x111 { object-position: 111% 50% }
</style>
</head>
<body>
<embed src="support/colors-8x16.svg" class="op_x-7">
<embed src="support/colors-8x16.svg" class="op_x13">
<embed src="support/colors-8x16.svg" class="op_x23">
<embed src="support/colors-8x16.svg" class="op_x50">
<embed src="support/colors-8x16.svg" class="op_x75">
<embed src="support/colors-8x16.svg" class="op_x88">
<embed src="support/colors-8x16.svg" class="op_x111">
</body>
</html>

View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<meta charset="utf-8">
<title>CSS Test: various 'object-position' values on a fixed-size img element, with a SVG image and 'object-fit:contain'.</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<link rel="help" href="http://www.w3.org/TR/css3-images/#sizing">
<link rel="help" href="http://www.w3.org/TR/css3-images/#the-object-fit">
<link rel="help" href="http://www.w3.org/TR/css3-images/#the-object-position">
<link rel="match" href="object-position-svg-002-ref.html">
<style type="text/css">
img {
background: lightgray;
margin-right: 2px;
object-fit: contain;
float: left;
width: 20px;
height: 20px;
}
.op_x-7 { object-position: -7% 50% }
.op_x13 { object-position: 13% 50% }
.op_x23 { object-position: 23% 50% }
.op_x50 { object-position: 50% 50% }
.op_x75 { object-position: 75% 50% }
.op_x88 { object-position: 88% 50% }
.op_x111 { object-position: 111% 50% }
</style>
</head>
<body>
<img src="support/colors-8x16.svg" class="op_x-7">
<img src="support/colors-8x16.svg" class="op_x13">
<img src="support/colors-8x16.svg" class="op_x23">
<img src="support/colors-8x16.svg" class="op_x50">
<img src="support/colors-8x16.svg" class="op_x75">
<img src="support/colors-8x16.svg" class="op_x88">
<img src="support/colors-8x16.svg" class="op_x111">
</body>
</html>

View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<meta charset="utf-8">
<title>CSS Test: various 'object-position' values on a fixed-size object element, with a SVG image and 'object-fit:contain'.</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<link rel="help" href="http://www.w3.org/TR/css3-images/#sizing">
<link rel="help" href="http://www.w3.org/TR/css3-images/#the-object-fit">
<link rel="help" href="http://www.w3.org/TR/css3-images/#the-object-position">
<link rel="match" href="object-position-svg-002-ref.html">
<style type="text/css">
object {
background: lightgray;
margin-right: 2px;
object-fit: contain;
float: left;
width: 20px;
height: 20px;
}
.op_x-7 { object-position: -7% 50% }
.op_x13 { object-position: 13% 50% }
.op_x23 { object-position: 23% 50% }
.op_x50 { object-position: 50% 50% }
.op_x75 { object-position: 75% 50% }
.op_x88 { object-position: 88% 50% }
.op_x111 { object-position: 111% 50% }
</style>
</head>
<body>
<object data="support/colors-8x16.svg" class="op_x-7"></object>
<object data="support/colors-8x16.svg" class="op_x13"></object>
<object data="support/colors-8x16.svg" class="op_x23"></object>
<object data="support/colors-8x16.svg" class="op_x50"></object>
<object data="support/colors-8x16.svg" class="op_x75"></object>
<object data="support/colors-8x16.svg" class="op_x88"></object>
<object data="support/colors-8x16.svg" class="op_x111"></object>
</body>
</html>

View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<meta charset="utf-8">
<title>CSS Test: various 'object-position' values on a fixed-size video element, with a SVG image and 'object-fit:contain'.</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<link rel="help" href="http://www.w3.org/TR/css3-images/#sizing">
<link rel="help" href="http://www.w3.org/TR/css3-images/#the-object-fit">
<link rel="help" href="http://www.w3.org/TR/css3-images/#the-object-position">
<link rel="match" href="object-position-svg-002-ref.html">
<style type="text/css">
video {
background: lightgray;
margin-right: 2px;
object-fit: contain;
float: left;
width: 20px;
height: 20px;
}
.op_x-7 { object-position: -7% 50% }
.op_x13 { object-position: 13% 50% }
.op_x23 { object-position: 23% 50% }
.op_x50 { object-position: 50% 50% }
.op_x75 { object-position: 75% 50% }
.op_x88 { object-position: 88% 50% }
.op_x111 { object-position: 111% 50% }
</style>
</head>
<body>
<video poster="support/colors-8x16.svg" class="op_x-7"></video>
<video poster="support/colors-8x16.svg" class="op_x13"></video>
<video poster="support/colors-8x16.svg" class="op_x23"></video>
<video poster="support/colors-8x16.svg" class="op_x50"></video>
<video poster="support/colors-8x16.svg" class="op_x75"></video>
<video poster="support/colors-8x16.svg" class="op_x88"></video>
<video poster="support/colors-8x16.svg" class="op_x111"></video>
</body>
</html>

View File

@ -170,3 +170,11 @@ fails == object-fit-fill-svg-006p.html object-fit-fill-svg-006-ref.html # bug 10
== object-position-png-002i.html object-position-png-002-ref.html
== object-position-png-002o.html object-position-png-002-ref.html
== object-position-png-002p.html object-position-png-002-ref.html
fails == object-position-svg-001e.html object-position-svg-001-ref.html # bug 1103286
== object-position-svg-001i.html object-position-svg-001-ref.html
fails == object-position-svg-001o.html object-position-svg-001-ref.html # bug 1103286
== object-position-svg-001p.html object-position-svg-001-ref.html
fails == object-position-svg-002e.html object-position-svg-002-ref.html # bug 1103286
== object-position-svg-002i.html object-position-svg-002-ref.html
fails == object-position-svg-002o.html object-position-svg-002-ref.html # bug 1103286
== object-position-svg-002p.html object-position-svg-002-ref.html

View File

@ -0,0 +1,88 @@
#!/bin/bash
#
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
#
# This is a script that I used to generate a suite of tests for the CSS
# properties "object-fit" and "object-position" (focusing on edge-case
# object-position values that require pixel rounding), using a template
# testcase file and reference case file.
#
# The reference case uses the "background-size" & "background-position"
# equivalent of the tested "object-fit" / "object-position" values.
FILE_PATH="./"
REFTEST_LIST_FILE="$FILE_PATH/reftest.list"
TEMPLATE_TESTCASE_FILENAME=$FILE_PATH/support/template-object-position-test.html
TEMPLATE_REFERENCE_FILENAME=$FILE_PATH/support/template-object-position-ref.html
imageFileFormat="svg"
# Array of image files to use for testing:
imageFileArr=("support/colors-16x8.svg" "support/colors-8x16.svg")
numImageFiles=${#imageFileArr[@]}
# Array of CSS classes to delete from the template, for a given image-file.
# DETAILS: The template files contain some elements/styles that exercise
# object-position x-values (op_x), and other elements/styles that exercise
# object-position y-values (op_y). But actually, we'll only have extra space
# for these percent values to resolve against in *one* dimension (since our
# image-files are rectangular, and the container element is square, and we
# scale the image up with "object-fit: contain"). So, we delete the
# elements/styles in the dimension where object-position % values will just
# resolve to 0 ("op_x" for the fat image, and "op_y" for the tall image).
classPatternToDeleteArr=("op_x" "op_y")
# Array of tag-names for elements that we'd like to test:
# (Also: array of a single-letter abbreviation for each element, an array of
# the close tag for each element -- if a close tag is needed -- and an array
# indicating the attribute that each element uses to specify its image source.)
tagNameArr=( "embed" "img" "object" "video" )
tagLetterArr=( "e" "i" "o" "p" )
tagCloseTokenArr=( "" "" "</object>" "</video>" )
tagSrcAttrArr=( "src" "src" "data" "poster" )
numTags=${#tagNameArr[@]}
for ((j = 0; j < $numImageFiles; j++)); do
imageFile=${imageFileArr[$j]}
classPatternToDelete=${classPatternToDeleteArr[$j]}
let testNum=$j+1
testNum="00$testNum" # zero-pad to 3 digits, per w3c convention
filenameStub="object-position-$imageFileFormat-$testNum"
# Generate a reference case:
filenameRef="$filenameStub-ref.html"
echo Generating ${filenameRef}.
cat $TEMPLATE_REFERENCE_FILENAME \
| sed "s,REPLACEME_IMAGE_FILENAME,$imageFile," \
| sed "/$classPatternToDelete/d" \
> $FILE_PATH/$filenameRef
# Generate a test for each of our tags:
for ((k = 0; k < $numTags; k++)); do
tagName=${tagNameArr[$k]}
tagLetter=${tagLetterArr[$k]}
tagCloseToken=${tagCloseTokenArr[$k]}
tagSrcAttr=${tagSrcAttrArr[$k]}
filenameTest="$filenameStub$tagLetter.html"
testTitle="various 'object-position' values on a fixed-size $tagName element, with a SVG image and 'object-fit:contain'."
echo Generating ${filenameTest}.
cat $TEMPLATE_TESTCASE_FILENAME \
| sed "s,REPLACEME_IMAGE_FILENAME,$imageFile," \
| sed "s/REPLACEME_TEST_TITLE/$testTitle/" \
| sed "s,REPLACEME_REFERENCE_FILENAME,$filenameRef," \
| sed "s/REPLACEME_CONTAINER_TAG/$tagName/" \
| sed "s,REPLACEME_CONTAINER_CLOSETAG,$tagCloseToken," \
| sed "s/REPLACEME_SRC_ATTR/$tagSrcAttr/" \
| sed "/$classPatternToDelete/d" \
> $FILE_PATH/$filenameTest
echo "== $filenameTest $filenameRef" \
>> $REFTEST_LIST_FILE
done
done