gecko-dev/testing/web-platform/tests/css/css-ui/tools/appearance-build-webkit-reftests.py
Simon Pieters 383b7a5328 Bug 1553169 [wpt PR 14996] - [css-ui] Test appearance <compat> values and 'auto', a=testonly
Automatic update from web-platform-tests
[css-ui] Test appearance <compat> values and 'auto'

Follows
https://github.com/w3c/csswg-drafts/pull/3545
https://github.com/w3c/csswg-drafts/pull/3546
https://github.com/w3c/csswg-drafts/pull/3574

Co-Authored-By: Philip Jägenstedt <philip@foolip.org>
--

wp5At-commits: 31e7edc073c29fec0e708a2e883c774b55452421
wpt-pr: 14996
2019-06-19 11:05:45 -07:00

28 lines
956 B
Python
Executable file

#!/usr/bin/env python3
import os
import re
re_testname = re.compile(r"^appearance-.+\d\d\d\.html$")
re_link_match = re.compile(r'<link rel="(mis)?match"')
files = {}
parentdir = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir))
assert parentdir.endswith('/css-ui')
for filename in os.listdir(parentdir):
path = os.path.join(parentdir, filename)
if os.path.isfile(path) and re_testname.search(filename) and not filename in files:
with open(path, "r") as file:
files[filename] = file.read()
warning = """<!-- DO NOT EDIT THIS FILE.
Edit the appearance-* file instead and then run:
./tools/appearance-build-webkit-reftests.py
-->
"""
for filename, text in files.items():
if re_link_match.search(text):
with open(os.path.join(parentdir, filename.replace("appearance-", "webkit-appearance-")), "w") as outfile:
outfile.write(warning + text.replace("appearance:", "-webkit-appearance:"))