mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:57:35 +00:00
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
2 changed files with 8 additions and 3 deletions
|
@ -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
Add a link
Reference in a new issue