diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /layout/reftests/xul/generate-object-position-xul-tests.sh | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | layout/reftests/xul/generate-object-position-xul-tests.sh | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/layout/reftests/xul/generate-object-position-xul-tests.sh b/layout/reftests/xul/generate-object-position-xul-tests.sh new file mode 100644 index 0000000000..b03b245790 --- /dev/null +++ b/layout/reftests/xul/generate-object-position-xul-tests.sh @@ -0,0 +1,68 @@ +#!/bin/bash +# +# Any copyright is dedicated to the Public Domain. +# http://creativecommons.org/publicdomain/zero/1.0/ +# +# Script to generate XUL <image> reftest files, from corresponding reftest +# files that use <img>. +# +# This script expects to be run from this working directory: +# mozilla-central/layout/reftests/w3c-css/submitted/images3 +# and it expects to be run *after* generate-object-fit-xul-tests.sh, since the +# copied test files will make use of image resources which are copied by that +# other script. + +XUL_REFTEST_PATH="../../../xul" + +reftestListFileName="$XUL_REFTEST_PATH/reftest.list" + +# Loop across all object-position tests that use <img> ("i" suffix): +for origTestName in object-position-png-*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 <video poster="support/foo.png"> to <video src="foo.webm">): + echo "Generating $newTestName from $origTestName." + newTestFullPath=$XUL_REFTEST_PATH/$newTestName + hg cp $origTestName $newTestFullPath + + # Replace doctype with XML decl: + sed -i "s/<!DOCTYPE html>/<?xml version=\"1.0\"?>/" $newTestFullPath + + # Replace html tags with window tags: + sed -i "s,<html>,<window xmlns=\"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul\">," $newTestFullPath + + # Delete a bunch of HTML (not XUL) / W3C-testsuite boilerplate: + sed -i "/head>/d" $newTestFullPath # Delete head open & close tags + sed -i "/body>/d" $newTestFullPath # Delete body open & close tags + sed -i "/<meta/d" $newTestFullPath # Delete meta charset tag + sed -i "/<title/d" $newTestFullPath # Delete title line + sed -i "/<link/d" $newTestFullPath # Delete link tags + + # Fix style open/close tags, and add 8px of padding on outer <window> to + # match our HTML reference case, and change style rule to target <image>. + # Also, add <hbox> to wrap the image elements. + sed -i "s, <style type=\"text/css\">,\<style xmlns=\"http://www.w3.org/1999/xhtml\"><![CDATA[\n window { padding: 8px; }," $newTestFullPath + sed -i "s, </style>,]]></style>\n <hbox>," $newTestFullPath + sed -i "s,</html>, </hbox>\n</window>," $newTestFullPath + sed -i "s/img {/image {/" $newTestFullPath + + sed -i "s,support/,," $newTestFullPath + sed -i "s,<img\(.*\)>,<image\1/>," $newTestFullPath + + # Update reftest manifest: + echo "== $newTestName $referenceName" \ + >> $reftestListFileName + +done |