| Auto-Submit | +1 |
- name: 2d.state.saverestore.zerosizeFredrik SöderquistThis test is essentially the same as the one above (`2d.state.saverestore`), but it's implemented differently (using the `{% for ... %}` unrolling of the test below).
Note that the only reason that the test below uses a Jinja `for` statement is because these tests were migrated from an old `meta.yaml` definition (in https://crrev.com/c/5593168) and the migration only targeted the YAML file, preserving the generated files untouched (with all their technical debt). That original test definition generated different test files for the `2d.state.saverestore` test, but bundled all of the test cases of `2d.canvas.host.initial.reset.2dstate` into a single file. This is what was reproduced in this current YAML config, using test variants in the former and a Jinja `for` loop in the latter. Ideally, we'd follow-up with a cleanup to implement both tests the same way.
That being said, it's usually preferable to have atomic tests, each validating a single behavior. For instance, test failures are harder to diagnose if multiple behaviors are bundled into the same test body. One nice thing about using a test generator is that we can generate atomic tests for a large number of test inputs, with minimal boilerplate. In that sense, test variants are generally better.
Here, what about extending the above test by adding a new dimension to the variant definition? The test generator can either put test variant dimensions in different files, or all in the same file. The following would produce test files with two `test(t => {...})` instances, one with a normal canvas size and another with a zero size:
```
- name: 2d.state.saverestore
desc: >-
save()/restore() works for {{ variant_names[1] }}, with a canvas size of
{{ size }}
code: |
// Test that restore() undoes any modifications
var old = ctx.{{ variant_names[1] }};
[...]
ctx.restore();
variants_layout: [single_file, multi_files]
variants:
- non-zero-size:
size: [100, 50]
zero-size:
size: [0, 0]
- &2d_state_test_cases
[...]
```(Make sure you update all `variant_names[0]` to `variant_names[1]`.)
You'll need to sync passed https://crrev.com/c/7210510 for the above to work correctly (I just submitted that CL to fix the `size` handling).
See here for more details on test variants:
https://chromium.googlesource.com/chromium/src.git/+/master/third_party/blink/web_tests/external/wpt/html/canvas/tools/README.md#test-variants
Done
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Commit-Queue | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Fix CanvasRenderingContext2D.restore() on zero-size canvas
Canvas2DRecorderContext::restore() would return without restoring the
state stack if there was no PaintCanvas.
Hoist the operations on the PaintCanvas out of PopAndRestore() into the
respective callers and drop the PaintCanvas argument. Rename to
PopStateStack().
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
The WPT PR for this CL has been merged upstream! https://github.com/web-platform-tests/wpt/pull/56369
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |