gecko/layout/reftests/webm-video/generate-object-fit-video-tests.sh
Daniel Holbert fe2b517e51 Bug 624647 reftests, part 2: Test 'object-fit' & 'object-position' properties with a WebM-backed <video> element. r=seth
--HG--
rename : layout/reftests/w3c-css/submitted/images3/support/colors-16x8.png => layout/reftests/webm-video/colors-16x8.png
rename : layout/reftests/w3c-css/submitted/images3/support/colors-8x16.png => layout/reftests/webm-video/colors-8x16.png
rename : layout/reftests/w3c-css/submitted/images3/object-fit-contain-png-001-ref.html => layout/reftests/webm-video/object-fit-contain-webm-001-ref.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-contain-png-001p.html => layout/reftests/webm-video/object-fit-contain-webm-001.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-contain-png-002-ref.html => layout/reftests/webm-video/object-fit-contain-webm-002-ref.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-contain-png-002p.html => layout/reftests/webm-video/object-fit-contain-webm-002.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-cover-png-001-ref.html => layout/reftests/webm-video/object-fit-cover-webm-001-ref.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-cover-png-001p.html => layout/reftests/webm-video/object-fit-cover-webm-001.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-cover-png-002-ref.html => layout/reftests/webm-video/object-fit-cover-webm-002-ref.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-cover-png-002p.html => layout/reftests/webm-video/object-fit-cover-webm-002.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-fill-png-001-ref.html => layout/reftests/webm-video/object-fit-fill-webm-001-ref.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-fill-png-001p.html => layout/reftests/webm-video/object-fit-fill-webm-001.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-fill-png-002-ref.html => layout/reftests/webm-video/object-fit-fill-webm-002-ref.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-fill-png-002p.html => layout/reftests/webm-video/object-fit-fill-webm-002.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-none-png-001-ref.html => layout/reftests/webm-video/object-fit-none-webm-001-ref.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-none-png-001p.html => layout/reftests/webm-video/object-fit-none-webm-001.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-none-png-002-ref.html => layout/reftests/webm-video/object-fit-none-webm-002-ref.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-none-png-002p.html => layout/reftests/webm-video/object-fit-none-webm-002.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-scale-down-png-001-ref.html => layout/reftests/webm-video/object-fit-scale-down-webm-001-ref.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-scale-down-png-001p.html => layout/reftests/webm-video/object-fit-scale-down-webm-001.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-scale-down-png-002-ref.html => layout/reftests/webm-video/object-fit-scale-down-webm-002-ref.html
rename : layout/reftests/w3c-css/submitted/images3/object-fit-scale-down-png-002p.html => layout/reftests/webm-video/object-fit-scale-down-webm-002.html
2014-11-14 16:45:24 -08:00

88 lines
3.5 KiB
Bash

#!/bin/bash
#
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
#
# Script to generate <video src> reftest files, from corresponding reftest
# files that use <video poster>.
#
# This script expects to be run from this working directory:
# mozilla-central/layout/reftests/w3c-css/submitted/images3
#
# It requires that the tools png2yuv and vpxenc be available, from the
# Ubuntu packages 'mjpegtools' and 'vpx-tools'. More info here:
# http://wiki.webmproject.org/howtos/convert-png-frames-to-webm-video
VIDEO_REFTEST_PATH="../../../webm-video"
imageFileArr=("colors-16x8.png" "colors-8x16.png")
numImageFiles=${#imageFileArr[@]}
# Copy image files, and generate webm files:
for ((i = 0; i < $numImageFiles; i++)); do
imageFileName=${imageFileArr[$i]}
imageDest=$VIDEO_REFTEST_PATH/$imageFileName
echo "Copying $imageDest."
hg cp support/$imageFileName $imageDest
videoDest=`echo $imageDest | sed "s/png/webm/"`
echo "Generating $videoDest."
png2yuv -f 1 -I p -b 1 -n 1 -j $imageDest \
| vpxenc --passes=1 --pass=1 --codec=vp9 --lossless=1 --max-q=0 -o $videoDest -
hg add $videoDest
done
# Add comment & default-preferences line to reftest.list in dest directory:
reftestListFileName="$VIDEO_REFTEST_PATH/reftest.list"
echo "
# Tests for <video src> with 'object-fit' & 'object-position':
# These tests should be very similar to tests in our w3c-css/submitted/images3
# reftest directory. They live here because they use WebM video (VP9), and it
# wouldn't be fair of us to make a W3C testsuite implicitly depend on any
# particular (non-spec-mandated) video codec.
default-preferences test-pref(layout.css.object-fit-and-position.enabled,true)"\
>> $reftestListFileName
# Loop across all <video poster> tests:
for origTestName in object*p.html; do
# Find the corresponding reference case:
origReferenceName=$(echo $origTestName |
sed "s/p.html/-ref.html/")
# The generated testcase will have "-webm" instead of "-png", and unlike
# the original png test, it won't have a single-letter suffix to indicate the
# particular container element. (since it's unnecessary -- there's only one
# possible container element for webm, "<video>")
videoTestName=$(echo $origTestName |
sed "s/png/webm/" |
sed "s/p.html/.html/")
videoReferenceName=$(echo $videoTestName |
sed "s/.html/-ref.html/")
# Generate reference file (dropping "support" subdir from image paths):
echo "Copying $origReferenceName to $VIDEO_REFTEST_PATH."
videoReferenceFullPath=$VIDEO_REFTEST_PATH/$videoReferenceName
hg cp $origReferenceName $videoReferenceFullPath
sed -i "s,support/,," $videoReferenceFullPath
# Generate testcase
# (converting <video poster="support/foo.png"> to <video src="foo.webm">):
echo "Generating $videoTestName from $origTestName."
videoTestFullPath=$VIDEO_REFTEST_PATH/$videoTestName
hg cp $origTestName $videoTestFullPath
sed -i "s/PNG image/WebM video/" $videoTestFullPath
sed -i "s/poster/src/" $videoTestFullPath
sed -i "s,support/,," $videoTestFullPath
sed -i "s/png/webm/" $videoTestFullPath
sed -i "s/$origReferenceName/$videoReferenceName/" $videoTestFullPath
# Update reftest manifest:
annotation="fails-if(layersGPUAccelerated) skip-if(Android||B2G)"
comment="# Bug 1083516 for layersGPUAccelerated failures, Bug 1084564 for Android/B2G failures"
echo "$annotation == $videoTestName $videoReferenceName $comment" \
>> $reftestListFileName
done