mirror of
https://github.com/servo/servo.git
synced 2025-10-13 23:10:20 +01:00
Update web-platform-tests to revision b'd1192ca239e944dc6cdbcd079e1c16227e08e30c'
This commit is contained in:
parent
69b272b4e1
commit
ec63c43030
233 changed files with 5065 additions and 1252 deletions
|
@ -175,6 +175,21 @@ def _expand_test_code(code: str) -> str:
|
|||
return code
|
||||
|
||||
|
||||
_CANVAS_SIZE_REGEX = re.compile(r'(?P<width>.*), (?P<height>.*)',
|
||||
re.MULTILINE | re.DOTALL)
|
||||
|
||||
|
||||
def _get_canvas_size(test: Mapping[str, str]):
|
||||
size = test.get('size', '100, 50')
|
||||
match = _CANVAS_SIZE_REGEX.match(size)
|
||||
if not match:
|
||||
raise InvalidTestDefinitionError(
|
||||
'Invalid canvas size "%s" in test %s. Expected a string matching '
|
||||
'this pattern: "%%s, %%s" %% (width, height)' %
|
||||
(size, test['name']))
|
||||
return match.group('width'), match.group('height')
|
||||
|
||||
|
||||
def _generate_test(test: Mapping[str, str], templates: Mapping[str, str],
|
||||
sub_dir: str, test_output_dir: str, image_output_dir: str,
|
||||
is_offscreen_canvas: bool):
|
||||
|
@ -214,16 +229,15 @@ def _generate_test(test: Mapping[str, str], templates: Mapping[str, str],
|
|||
'<img src="%s" class="output expected" id="expected" '
|
||||
'alt="">' % expected_img)
|
||||
|
||||
canvas = test.get('canvas', 'width="100" height="50"')
|
||||
canvas = ' ' + test['canvas'] if 'canvas' in test else ''
|
||||
width, height = _get_canvas_size(test)
|
||||
|
||||
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 '')
|
||||
|
||||
scripts = ''
|
||||
for s in test.get('scripts', []):
|
||||
scripts += '<script src="%s"></script>\n' % (s)
|
||||
timeout_js = ('// META: timeout=%s\n' % test['timeout']
|
||||
if 'timeout' in test else '')
|
||||
|
||||
images = ''
|
||||
for src in test.get('images', []):
|
||||
|
@ -273,10 +287,12 @@ def _generate_test(test: Mapping[str, str], templates: Mapping[str, str],
|
|||
'fonts': fonts,
|
||||
'fonthack': fonthack,
|
||||
'timeout': timeout,
|
||||
'timeout_js': timeout_js,
|
||||
'canvas': canvas,
|
||||
'width': width,
|
||||
'height': height,
|
||||
'expected': expectation_html,
|
||||
'code': code,
|
||||
'scripts': scripts,
|
||||
'fallback': fallback,
|
||||
'attributes': attributes,
|
||||
'context_args': context_args
|
||||
|
@ -289,9 +305,6 @@ def _generate_test(test: Mapping[str, str], templates: Mapping[str, str],
|
|||
if is_offscreen_canvas:
|
||||
pathlib.Path(f'{test_path}.html').write_text(
|
||||
templates['w3coffscreencanvas'] % template_params, 'utf-8')
|
||||
timeout = ('// META: timeout=%s\n' %
|
||||
test['timeout'] if 'timeout' in test else '')
|
||||
template_params['timeout'] = timeout
|
||||
pathlib.Path(f'{test_path}.worker.js').write_text(
|
||||
templates['w3cworker'] % template_params, 'utf-8')
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue