Bug 1823881 [wpt PR 36130] - Integrate script to generate object-view-box tests to ./wpt update-built, a=testonly

Automatic update from web-platform-tests
Integrate script to generate object-view-box tests to ./wpt update-built (#36130)

Move both this script and shell scripts for object-fit into a tools/
subdirectory rather than support/, following the convention elsewhere.

Also make use of some f-strings for readability.
--

wpt-commits: 50d4ff250b1be8f55674c892b652272e16a240e5
wpt-pr: 36130
This commit is contained in:
Philip Jägenstedt 2023-03-30 10:59:54 +00:00 коммит произвёл moz-wptsync-bot
Родитель 5310d1eda4
Коммит 85209d0e1e
21 изменённых файлов: 13 добавлений и 15 удалений

Просмотреть файл

@ -1,18 +1,18 @@
import os
import sys
HERE = os.path.abspath(os.path.dirname(__file__))
def generate_file(source, destination, tag, name, image_source):
file = open(source)
lines = file.read()
file.close()
with open(os.path.join(HERE, source)) as file:
lines = file.read()
replaced_lines = lines.replace('__TAG__',
tag).replace('__NAME__', name).replace(
'__IMAGE_SOURCE__', image_source)
replaced_lines = '<!-- This is an autogen file. Run support/generate_object_view_box_tests.py to update -->\n' + replaced_lines
new_file = open(destination, "w")
new_file.write(replaced_lines)
new_file.close()
with open(os.path.join(HERE, destination), "w") as new_file:
new_file.write(replaced_lines)
def generate_for_object_fit(object_fit):
@ -24,14 +24,12 @@ def generate_for_object_fit(object_fit):
]
for i in range(len(names)):
source = 'object-view-box-fit-' + object_fit + '-template.html'
destination = '../object-view-box-fit-' + object_fit + '-' + names[
i] + '.html'
source = f'object-view-box-fit-{object_fit}-template.html'
destination = f'../object-view-box-fit-{object_fit}-{names[i]}.html'
generate_file(source, destination, tags[i], names[i], image_sources[i])
source = 'object-view-box-fit-' + object_fit + '-ref-template.html'
destination = '../object-view-box-fit-' + object_fit + '-' + names[
i] + '-ref.html'
source = f'object-view-box-fit-{object_fit}-ref-template.html'
destination = f'../object-view-box-fit-{object_fit}-{names[i]}-ref.html'
generate_file(source, destination, tags[i], names[i], image_sources[i])
@ -45,12 +43,11 @@ def generate_for_writing_mode():
for i in range(len(names)):
source = 'object-view-box-writing-mode-template.html'
destination = '../object-view-box-writing-mode-' + names[i] + '.html'
destination = f'../object-view-box-writing-mode-{names[i]}.html'
generate_file(source, destination, tags[i], names[i], image_sources[i])
source = 'object-view-box-writing-mode-ref-template.html'
destination = '../object-view-box-writing-mode-' + names[
i] + '-ref.html'
destination = f'../object-view-box-writing-mode-{names[i]}-ref.html'
generate_file(source, destination, tags[i], names[i], image_sources[i])

Просмотреть файл

@ -15,6 +15,7 @@ scripts = {
"conformance-checkers/tools/ins-del-datetime.py",
"conformance-checkers/tools/picture.py",
"conformance-checkers/tools/url.py"],
"css-images": ["css/css-images/tools/generate_object_view_box_tests.py"],
"css-ui": ["css/css-ui/tools/appearance-build-webkit-reftests.py"],
# FIXME: https://github.com/web-platform-tests/wpt/issues/32060
# "css-text": ["css/css-text/line-breaking/tools/generate-segment-break-transformation-rules-tests.py"],