Skip to content

Commit b7a11de

Browse files
graveljpchromium-wpt-export-bot
authored andcommitted
Make name: and code: required parameters in the canvas test generator
In the process of documenting the test generator, it's useful to clarify which parameters are required and which ones are optional. The only two required parameters are 'name:' and 'code:'. Bug: 393561071 Change-Id: I89c0fa7cc9bd0a8923a4320c5e02ac9e5f81a9e0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6219870 Reviewed-by: Andres Ricardo Perez <[email protected]> Commit-Queue: Jean-Philippe Gravel <[email protected]> Cr-Commit-Position: refs/heads/main@{#1423203}
1 parent 6677517 commit b7a11de

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

html/canvas/tools/gentest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,11 @@ def mkdir(self) -> None:
441441

442442

443443
def _validate_test(test: _TestParams):
444+
for param in ['name', 'code']:
445+
if test.get(param) is None:
446+
raise InvalidTestDefinitionError(
447+
f'Test parameter "{param}" must be specified.')
448+
444449
if test.get('expected', '') == 'green' and re.search(
445450
r'@assert pixel .* 0,0,0,0;', test['code']):
446451
print(f'Probable incorrect pixel test in {test["name"]}')

0 commit comments

Comments
 (0)