headless-browser: Paint while running layout tests (but discard results)
If we don't paint, SVG-as-image documents don't get laid out, and so have 0x0 size throughout. This change is also generally nice, as it makes the painting code run on all the layout tests, increasing coverage. :^)
This commit is contained in:
parent
79d3942012
commit
a0b4987e92
Notes:
sideshowbarker
2024-07-17 05:05:51 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/a0b4987e92 Pull-request: https://github.com/SerenityOS/serenity/pull/19501
2 changed files with 8 additions and 3 deletions
|
@ -3,8 +3,8 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
|||
BlockContainer <body> at (8,8) content-size 784x1568 children: not-inline
|
||||
ImageBox <img> at (8,8) content-size 784x1568 children: not-inline
|
||||
(SVG-as-image isolated context)
|
||||
Viewport <#document> at (0,0) content-size 0x0 children: inline
|
||||
SVGSVGBox <svg> at (0,0) content-size 0x0 [SVG] children: inline
|
||||
Viewport <#document> at (0,0) content-size 784x1568 children: inline
|
||||
SVGSVGBox <svg> at (0,0) content-size 784x1568 [SVG] children: inline
|
||||
TextNode <#text>
|
||||
SVGGeometryBox <rect> at (0,0) content-size 0x0 children: not-inline
|
||||
SVGGeometryBox <rect> at (-0.000007,-0.000015) content-size 784x1568 children: not-inline
|
||||
TextNode <#text>
|
||||
|
|
|
@ -198,6 +198,10 @@ static ErrorOr<String> run_one_test(HeadlessWebContentView& view, StringView inp
|
|||
|
||||
if (mode == TestMode::Layout) {
|
||||
view.on_load_finish = [&](auto const&) {
|
||||
// NOTE: We take a screenshot here to force the lazy layout of SVG-as-image documents to happen.
|
||||
// It also causes a lot more code to run, which is good for finding bugs. :^)
|
||||
(void)view.take_screenshot();
|
||||
|
||||
result = view.dump_layout_tree().release_value_but_fixme_should_propagate_errors();
|
||||
loop.quit(0);
|
||||
};
|
||||
|
@ -440,6 +444,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
if (dump_layout_tree) {
|
||||
view->on_load_finish = [&](auto const&) {
|
||||
(void)view->take_screenshot();
|
||||
auto layout_tree = view->dump_layout_tree().release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
out("{}", layout_tree);
|
||||
|
|
Loading…
Add table
Reference in a new issue