diff --git a/layout/reftests/xul/generate-object-fit-xul-tests.sh b/layout/reftests/xul/generate-object-fit-xul-tests.sh new file mode 100644 index 000000000000..f524d3b2cf27 --- /dev/null +++ b/layout/reftests/xul/generate-object-fit-xul-tests.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# +# Any copyright is dedicated to the Public Domain. +# http://creativecommons.org/publicdomain/zero/1.0/ +# +# Script to generate XUL reftest files, from corresponding reftest +# files that use . +# +# This script expects to be run from this working directory: +# mozilla-central/layout/reftests/w3c-css/submitted/images3 + +XUL_REFTEST_PATH="../../../xul" + +imageFileArr=("colors-16x8.png" "colors-8x16.png" + "colors-16x8.svg" "colors-8x16.svg" + "colors-16x8-noSize.svg" "colors-8x16-noSize.svg" + "colors-16x8-parDefault.svg" "colors-8x16-parDefault.svg") +numImageFiles=${#imageFileArr[@]} + +# Copy image files +for ((i = 0; i < $numImageFiles; i++)); do + imageFileName=${imageFileArr[$i]} + imageDest=$XUL_REFTEST_PATH/$imageFileName + + echo "Copying $imageDest." + hg cp support/$imageFileName $imageDest +done + +# Add comment & default-preferences line to reftest.list in dest directory: +reftestListFileName="$XUL_REFTEST_PATH/reftest.list" +echo " +# Tests for XUL 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 XUL, and it +# wouldn't be fair of us to make a W3C testsuite implicitly depend on XUL. +default-preferences test-pref(layout.css.object-fit-and-position.enabled,true)"\ + >> $reftestListFileName + +# Loop across all object-fit tests that use ("i" suffix): +for origTestName in object-fit*i.html; do + newTestName=$(echo $origTestName | + sed "s/i.html/.xul/") + + # Find the corresponding reference case: + referenceName=$(echo $origTestName | + sed "s/i.html/-ref.html/") + + # Generate reference file (dropping "support" subdir from image paths): + echo "Copying $referenceName to $XUL_REFTEST_PATH." + newReferenceFullPath=$XUL_REFTEST_PATH/$referenceName + hg cp $referenceName $newReferenceFullPath + sed -i "s,support/,," $newReferenceFullPath + + # Generate testcase + # (converting