Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005'

This commit is contained in:
WPT Sync Bot 2022-11-10 01:22:36 +00:00
parent ace9b32b1c
commit df68c4e5d1
15632 changed files with 514865 additions and 155000 deletions

View file

@ -15,8 +15,6 @@
# * Modify the tests*.yaml files.
# 'name' is an arbitrary hierarchical name to help categorise tests.
# 'desc' is a rough description of what behaviour the test aims to test.
# 'testing' is a list of references to spec.yaml, to show which spec sentences
# this test case is primarily testing.
# 'code' is JavaScript code to execute, with some special commands starting with '@'
# 'expected' is what the final canvas output should be: a string 'green' or 'clear'
# (100x50 images in both cases), or a string 'size 100 50' (or any other size)
@ -56,8 +54,6 @@ def genTestUtils_union(TEMPLATEFILE, NAME2DIRFILE):
OFFSCREENCANVASOUTPUTDIR = '../offscreen'
OFFSCREENCANVASIMAGEOUTPUTDIR = '../offscreen'
MISCOUTPUTDIR = './output'
SPECOUTPUTDIR = '../'
SPECOUTPUTPATH = './' # relative to CANVASOUTPUTDIR
def simpleEscapeJS(str):
return str.replace('\\', '\\\\').replace('"', '\\"')
@ -125,14 +121,6 @@ def genTestUtils_union(TEMPLATEFILE, NAME2DIRFILE):
templates = yaml.safe_load(open(TEMPLATEFILE, "r").read())
name_mapping = yaml.safe_load(open(NAME2DIRFILE, "r").read())
SPECFILE = 'spec.yaml'
spec_assertions = []
for s in yaml.safe_load(open(SPECFILE, "r").read())['assertions']:
if 'meta' in s:
eval(compile(s['meta'], '<meta spec assertion>', 'exec'), {}, {'assertions':spec_assertions})
else:
spec_assertions.append(s)
tests = []
test_yaml_directory = "yaml-new"
TESTSFILES = [
@ -150,10 +138,6 @@ def genTestUtils_union(TEMPLATEFILE, NAME2DIRFILE):
category_contents_direct = {}
category_contents_all = {}
spec_ids = {}
for t in spec_assertions: spec_ids[t['id']] = True
spec_refs = {}
def backref_html(name):
backrefs = []
c = ''
@ -190,15 +174,15 @@ def genTestUtils_union(TEMPLATEFILE, NAME2DIRFILE):
code = re.sub(r'@nonfinite ([^(]+)\(([^)]+)\)(.*)', lambda m: expand_nonfinite(m.group(1), m.group(2), m.group(3)), code) # must come before '@assert throws'
code = re.sub(r'@assert pixel (\d+,\d+) == (\d+,\d+,\d+,\d+);',
r'_assertPixel(canvas, \1, \2, "\1", "\2");',
r'_assertPixel(canvas, \1, \2);',
code)
code = re.sub(r'@assert pixel (\d+,\d+) ==~ (\d+,\d+,\d+,\d+);',
r'_assertPixelApprox(canvas, \1, \2, "\1", "\2", 2);',
r'_assertPixelApprox(canvas, \1, \2, 2);',
code)
code = re.sub(r'@assert pixel (\d+,\d+) ==~ (\d+,\d+,\d+,\d+) \+/- (\d+);',
r'_assertPixelApprox(canvas, \1, \2, "\1", "\2", \3);',
r'_assertPixelApprox(canvas, \1, \2, \3);',
code)
code = re.sub(r'@assert throws (\S+_ERR) (.*);',
@ -272,14 +256,6 @@ def genTestUtils_union(TEMPLATEFILE, NAME2DIRFILE):
category_contents_all.setdefault(cat_total, []).append(name)
category_contents_direct.setdefault(cat_total, []).append(name)
for ref in test.get('testing', []):
if ref not in spec_ids:
print("Test %s uses nonexistent spec point %s" % (name, ref))
spec_refs.setdefault(ref, []).append(name)
if not test.get('testing', []):
print("Test %s doesn't refer to any spec points" % name)
if test.get('expected', '') == 'green' and re.search(r'@assert pixel .* 0,0,0,0;', test['code']):
print("Probable incorrect pixel test in %s" % name)
@ -323,8 +299,6 @@ def genTestUtils_union(TEMPLATEFILE, NAME2DIRFILE):
name_wrapped = name.replace('.', '.&#8203;')
refs = ''.join('<li><a href="%s/annotated-spec.html#testrefs.%s">%s</a>\n' % (SPECOUTPUTPATH, n,n) for n in test.get('testing', []))
notes = '<p class="notes">%s' % test['notes'] if 'notes' in test else ''
timeout = '\n<meta name="timeout" content="%s">' % test['timeout'] if 'timeout' in test else ''
@ -383,7 +357,7 @@ def genTestUtils_union(TEMPLATEFILE, NAME2DIRFILE):
'name_wrapped':name_wrapped, 'backrefs':backref_html(name),
'mapped_name':mapped_name,
'desc':desc, 'escaped_desc':escaped_desc,
'prev':prev, 'next':next, 'refs':refs, 'notes':notes, 'images':images,
'prev':prev, 'next':next, 'notes':notes, 'images':images,
'fonts':fonts, 'fonthack':fonthack, 'timeout': timeout,
'canvas':canvas, 'expected':expectation_html, 'code':code_canvas,
'scripts':scripts + extra_script,
@ -396,13 +370,18 @@ def genTestUtils_union(TEMPLATEFILE, NAME2DIRFILE):
f = codecs.open('%s/%s%s.html' % (CANVASOUTPUTDIR, mapped_name, name_variant), 'w', 'utf-8')
f.write(templates['w3ccanvas'] % template_params)
if OffscreenCanvas_test:
f = codecs.open('%s/%s%s.html' % (OFFSCREENCANVASOUTPUTDIR, mapped_name, name_variant), 'w', 'utf-8')
f.write(templates['w3coffscreencanvas'] % template_params)
# Create test case for offscreencanvas worker.
timeout = '// META: timeout=%s\n' % test['timeout'] if 'timeout' in test else ''
template_params['timeout'] = timeout
f = codecs.open('%s/%s%s.worker.js' % (OFFSCREENCANVASOUTPUTDIR, mapped_name, name_variant), 'w', 'utf-8')
f.write(templates['w3cworker'] % template_params)
f_html = codecs.open('%s/%s%s.html' % (OFFSCREENCANVASOUTPUTDIR, mapped_name, name_variant), 'w', 'utf-8')
f_worker = codecs.open('%s/%s%s.worker.js' % (OFFSCREENCANVASOUTPUTDIR, mapped_name, name_variant), 'w', 'utf-8')
if ("then(t_pass, t_fail);" in code_canvas):
temp_offscreen = templates['w3coffscreencanvas'].replace("t.done();\n", "")
temp_worker = templates['w3cworker'].replace("t.done();\n", "")
f_html.write(temp_offscreen % template_params)
timeout = '// META: timeout=%s\n' % test['timeout'] if 'timeout' in test else ''
template_params['timeout'] = timeout
f_worker.write(temp_worker % template_params)
else:
f_html.write(templates['w3coffscreencanvas'] % template_params)
timeout = '// META: timeout=%s\n' % test['timeout'] if 'timeout' in test else ''
template_params['timeout'] = timeout
f_worker.write(templates['w3cworker'] % template_params)
print()