From 2ede299b4ac9405b248910ac06e3dc55db2b0bee Mon Sep 17 00:00:00 2001 From: MacDue Date: Sat, 17 Feb 2024 22:25:05 +0000 Subject: [PATCH] headless-browser: Run `.svg` dump tests Previously, the check for `.html` meant that `.svg` tests were excluded. This led to a few `.svg` with missing or bit-rotted expectations, which have now been added/updated. --- ...ith-zero-intrinsic-size-and-no-viewbox.txt | 28 ++++++++++++++++ .../LibWeb/Layout/expected/svg/rectangle.txt | 9 +++++ ...ith-zero-intrinsic-size-and-no-viewbox.txt | 33 ++++--------------- .../expected/svg/svg-without-viewbox.txt | 7 ++++ ...h-zero-intrinsic-size-and-no-viewbox.html} | 0 ...ith-zero-intrinsic-size-and-no-viewbox.svg | 4 +-- Userland/Utilities/headless-browser.cpp | 2 +- 7 files changed, 54 insertions(+), 29 deletions(-) create mode 100644 Tests/LibWeb/Layout/expected/svg/inline-svg-with-zero-intrinsic-size-and-no-viewbox.txt create mode 100644 Tests/LibWeb/Layout/expected/svg/rectangle.txt create mode 100644 Tests/LibWeb/Layout/expected/svg/svg-without-viewbox.txt rename Tests/LibWeb/Layout/input/svg/{svg-with-zero-intrinsic-size-and-no-viewbox.html => inline-svg-with-zero-intrinsic-size-and-no-viewbox.html} (100%) diff --git a/Tests/LibWeb/Layout/expected/svg/inline-svg-with-zero-intrinsic-size-and-no-viewbox.txt b/Tests/LibWeb/Layout/expected/svg/inline-svg-with-zero-intrinsic-size-and-no-viewbox.txt new file mode 100644 index 0000000000..e5a9f22cf6 --- /dev/null +++ b/Tests/LibWeb/Layout/expected/svg/inline-svg-with-zero-intrinsic-size-and-no-viewbox.txt @@ -0,0 +1,28 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline + BlockContainer at (8,8) content-size 784x17 children: inline + frag 0 from ImageBox start: 0, length: 0, rect: [8,21 0x0] baseline: 0 + frag 1 from TextNode start: 0, length: 1, rect: [8,8 8x17] baseline: 13.296875 + " " + frag 2 from SVGSVGBox start: 0, length: 0, rect: [16,21 0x0] baseline: 0 + ImageBox at (8,21) content-size 0x0 children: not-inline + (SVG-as-image isolated context) + Viewport <#document> at (0,0) content-size 0x0 [BFC] children: inline + SVGSVGBox at (0,0) content-size 0x0 [SVG] children: inline + TextNode <#text> + SVGGeometryBox at (0,0) content-size 1x1 children: not-inline + TextNode <#text> + TextNode <#text> + SVGSVGBox at (16,21) content-size 0x0 [SVG] children: inline + TextNode <#text> + SVGGeometryBox at (16,21) content-size 1x1 children: not-inline + TextNode <#text> + TextNode <#text> + +ViewportPaintable (Viewport<#document>) [0,0 800x600] + PaintableWithLines (BlockContainer) [0,0 800x600] + PaintableWithLines (BlockContainer) [8,8 784x17] + ImagePaintable (ImageBox) [8,21 0x0] + TextPaintable (TextNode<#text>) + SVGSVGPaintable (SVGSVGBox) [16,21 0x0] + SVGPathPaintable (SVGGeometryBox) [16,21 1x1] diff --git a/Tests/LibWeb/Layout/expected/svg/rectangle.txt b/Tests/LibWeb/Layout/expected/svg/rectangle.txt new file mode 100644 index 0000000000..dcd21f511b --- /dev/null +++ b/Tests/LibWeb/Layout/expected/svg/rectangle.txt @@ -0,0 +1,9 @@ +Viewport <#document> at (0,0) content-size 800x600 [BFC] children: inline + SVGSVGBox at (0,0) content-size 800x600 [SVG] children: inline + TextNode <#text> + SVGGeometryBox at (250,0) content-size 300x600 children: not-inline + TextNode <#text> + +ViewportPaintable (Viewport<#document>) [0,0 800x600] + SVGSVGPaintable (SVGSVGBox) [0,0 800x600] + SVGPathPaintable (SVGGeometryBox) [250,0 300x600] diff --git a/Tests/LibWeb/Layout/expected/svg/svg-with-zero-intrinsic-size-and-no-viewbox.txt b/Tests/LibWeb/Layout/expected/svg/svg-with-zero-intrinsic-size-and-no-viewbox.txt index e5a9f22cf6..13e51e5beb 100644 --- a/Tests/LibWeb/Layout/expected/svg/svg-with-zero-intrinsic-size-and-no-viewbox.txt +++ b/Tests/LibWeb/Layout/expected/svg/svg-with-zero-intrinsic-size-and-no-viewbox.txt @@ -1,28 +1,9 @@ -Viewport <#document> at (0,0) content-size 800x600 children: not-inline - BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline - BlockContainer at (8,8) content-size 784x17 children: inline - frag 0 from ImageBox start: 0, length: 0, rect: [8,21 0x0] baseline: 0 - frag 1 from TextNode start: 0, length: 1, rect: [8,8 8x17] baseline: 13.296875 - " " - frag 2 from SVGSVGBox start: 0, length: 0, rect: [16,21 0x0] baseline: 0 - ImageBox at (8,21) content-size 0x0 children: not-inline - (SVG-as-image isolated context) - Viewport <#document> at (0,0) content-size 0x0 [BFC] children: inline - SVGSVGBox at (0,0) content-size 0x0 [SVG] children: inline - TextNode <#text> - SVGGeometryBox at (0,0) content-size 1x1 children: not-inline - TextNode <#text> - TextNode <#text> - SVGSVGBox at (16,21) content-size 0x0 [SVG] children: inline - TextNode <#text> - SVGGeometryBox at (16,21) content-size 1x1 children: not-inline - TextNode <#text> - TextNode <#text> +Viewport <#document> at (0,0) content-size 800x600 children: inline + InlineNode + TextNode <#text> + InlineNode + TextNode <#text> ViewportPaintable (Viewport<#document>) [0,0 800x600] - PaintableWithLines (BlockContainer) [0,0 800x600] - PaintableWithLines (BlockContainer) [8,8 784x17] - ImagePaintable (ImageBox) [8,21 0x0] - TextPaintable (TextNode<#text>) - SVGSVGPaintable (SVGSVGBox) [16,21 0x0] - SVGPathPaintable (SVGGeometryBox) [16,21 1x1] + InlinePaintable (InlineNode) + InlinePaintable (InlineNode) diff --git a/Tests/LibWeb/Layout/expected/svg/svg-without-viewbox.txt b/Tests/LibWeb/Layout/expected/svg/svg-without-viewbox.txt new file mode 100644 index 0000000000..04ad3c6928 --- /dev/null +++ b/Tests/LibWeb/Layout/expected/svg/svg-without-viewbox.txt @@ -0,0 +1,7 @@ +Viewport <#document> at (0,0) content-size 800x600 [BFC] children: inline + SVGSVGBox at (0,0) content-size 800x600 [SVG] children: not-inline + SVGGeometryBox at (0,0) content-size 100x200 children: not-inline + +ViewportPaintable (Viewport<#document>) [0,0 800x600] + SVGSVGPaintable (SVGSVGBox) [0,0 800x600] + SVGPathPaintable (SVGGeometryBox) [0,0 100x200] diff --git a/Tests/LibWeb/Layout/input/svg/svg-with-zero-intrinsic-size-and-no-viewbox.html b/Tests/LibWeb/Layout/input/svg/inline-svg-with-zero-intrinsic-size-and-no-viewbox.html similarity index 100% rename from Tests/LibWeb/Layout/input/svg/svg-with-zero-intrinsic-size-and-no-viewbox.html rename to Tests/LibWeb/Layout/input/svg/inline-svg-with-zero-intrinsic-size-and-no-viewbox.html diff --git a/Tests/LibWeb/Layout/input/svg/svg-with-zero-intrinsic-size-and-no-viewbox.svg b/Tests/LibWeb/Layout/input/svg/svg-with-zero-intrinsic-size-and-no-viewbox.svg index a2406d6b4c..884afa476a 100644 --- a/Tests/LibWeb/Layout/input/svg/svg-with-zero-intrinsic-size-and-no-viewbox.svg +++ b/Tests/LibWeb/Layout/input/svg/svg-with-zero-intrinsic-size-and-no-viewbox.svg @@ -1,3 +1,3 @@ - - + + diff --git a/Userland/Utilities/headless-browser.cpp b/Userland/Utilities/headless-browser.cpp index 44a2df556e..cdd9e0d750 100644 --- a/Userland/Utilities/headless-browser.cpp +++ b/Userland/Utilities/headless-browser.cpp @@ -490,7 +490,7 @@ static ErrorOr collect_dump_tests(Vector& tests, StringView path, St TRY(collect_dump_tests(tests, path, TRY(String::formatted("{}/{}", trail, name)), mode)); continue; } - if (!name.ends_with(".html"sv)) + if (!name.ends_with(".html"sv) && !name.ends_with(".svg"sv)) continue; auto basename = LexicalPath::title(name); auto expectation_path = TRY(String::formatted("{}/expected/{}/{}.txt", path, trail, basename));