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.
This commit is contained in:
MacDue 2024-02-17 22:25:05 +00:00 committed by Alexander Kalenik
parent 012cb7f71e
commit 2ede299b4a
7 changed files with 54 additions and 29 deletions

View file

@ -0,0 +1,28 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> 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 <img> 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 <svg> at (0,0) content-size 0x0 [SVG] children: inline
TextNode <#text>
SVGGeometryBox <rect> at (0,0) content-size 1x1 children: not-inline
TextNode <#text>
TextNode <#text>
SVGSVGBox <svg> at (16,21) content-size 0x0 [SVG] children: inline
TextNode <#text>
SVGGeometryBox <rect> at (16,21) content-size 1x1 children: not-inline
TextNode <#text>
TextNode <#text>
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x17]
ImagePaintable (ImageBox<IMG>) [8,21 0x0]
TextPaintable (TextNode<#text>)
SVGSVGPaintable (SVGSVGBox<svg>) [16,21 0x0]
SVGPathPaintable (SVGGeometryBox<rect>) [16,21 1x1]

View file

@ -0,0 +1,9 @@
Viewport <#document> at (0,0) content-size 800x600 [BFC] children: inline
SVGSVGBox <svg> at (0,0) content-size 800x600 [SVG] children: inline
TextNode <#text>
SVGGeometryBox <rect> at (250,0) content-size 300x600 children: not-inline
TextNode <#text>
ViewportPaintable (Viewport<#document>) [0,0 800x600]
SVGSVGPaintable (SVGSVGBox<svg>) [0,0 800x600]
SVGPathPaintable (SVGGeometryBox<rect>) [250,0 300x600]

View file

@ -1,28 +1,9 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> 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 <img> 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 <svg> at (0,0) content-size 0x0 [SVG] children: inline
TextNode <#text>
SVGGeometryBox <rect> at (0,0) content-size 1x1 children: not-inline
TextNode <#text>
TextNode <#text>
SVGSVGBox <svg> at (16,21) content-size 0x0 [SVG] children: inline
TextNode <#text>
SVGGeometryBox <rect> at (16,21) content-size 1x1 children: not-inline
TextNode <#text>
TextNode <#text>
Viewport <#document> at (0,0) content-size 800x600 children: inline
InlineNode <svg>
TextNode <#text>
InlineNode <rect>
TextNode <#text>
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x17]
ImagePaintable (ImageBox<IMG>) [8,21 0x0]
TextPaintable (TextNode<#text>)
SVGSVGPaintable (SVGSVGBox<svg>) [16,21 0x0]
SVGPathPaintable (SVGGeometryBox<rect>) [16,21 1x1]
InlinePaintable (InlineNode<svg>)
InlinePaintable (InlineNode<rect>)

View file

@ -0,0 +1,7 @@
Viewport <#document> at (0,0) content-size 800x600 [BFC] children: inline
SVGSVGBox <svg> at (0,0) content-size 800x600 [SVG] children: not-inline
SVGGeometryBox <rect> at (0,0) content-size 100x200 children: not-inline
ViewportPaintable (Viewport<#document>) [0,0 800x600]
SVGSVGPaintable (SVGSVGBox<svg>) [0,0 800x600]
SVGPathPaintable (SVGGeometryBox<rect>) [0,0 100x200]

View file

@ -1,3 +1,3 @@
<svg width=0 height=0>
<rect x=0 y=0 width=1 height=1 />
<svg width="0" height="0">
<rect x="0" y="0" width="1" height="1" />
</svg>

Before

Width:  |  Height:  |  Size: 68 B

After

Width:  |  Height:  |  Size: 80 B

View file

@ -490,7 +490,7 @@ static ErrorOr<void> collect_dump_tests(Vector<Test>& 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));