From 1440845aadaa457a00558579fb2b79c833da1ebf Mon Sep 17 00:00:00 2001 From: martinfalisse Date: Sun, 2 Apr 2023 19:53:06 +0200 Subject: LibWeb: Add table formatting tests Creates some TableFormattingContext tests based on the tests in /html/misc. --- Tests/LibWeb/Layout/expected/table/basic.txt | 69 +++++++ Tests/LibWeb/Layout/expected/table/borders.txt | 260 +++++++++++++++++++++++++ Tests/LibWeb/Layout/input/table/basic.html | 30 +++ Tests/LibWeb/Layout/input/table/borders.html | 94 +++++++++ 4 files changed, 453 insertions(+) create mode 100644 Tests/LibWeb/Layout/expected/table/basic.txt create mode 100644 Tests/LibWeb/Layout/expected/table/borders.txt create mode 100644 Tests/LibWeb/Layout/input/table/basic.html create mode 100644 Tests/LibWeb/Layout/input/table/borders.html diff --git a/Tests/LibWeb/Layout/expected/table/basic.txt b/Tests/LibWeb/Layout/expected/table/basic.txt new file mode 100644 index 0000000000..71959087d6 --- /dev/null +++ b/Tests/LibWeb/Layout/expected/table/basic.txt @@ -0,0 +1,69 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x74.40625 children: not-inline + BlockContainer at (8,8) content-size 784x58.40625 children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 784x0 children: not-inline + TableBox at (8,8) content-size 784x0 children: not-inline + BlockContainer <(anonymous)> at (8,8) content-size 784x0 children: inline + TextNode <#text> + TextNode <#text> + TableWrapper <(anonymous)> at (8,8) content-size 95.171875x58.40625 children: not-inline + TableBox at (8,8) content-size 95.171875x58.40625 children: not-inline + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + BlockContainer at (8,8) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + TableRowGroupBox at (8,8) content-size 95.171875x19.46875 children: not-inline + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + TableRowBox at (8,8) content-size 95.171875x19.46875 children: not-inline + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (9,9) content-size 93.171875x17.46875 children: inline + line 0 width: 73.65625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 9, rect: [9,9 73.65625x17.46875] + "Head Cell" + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + TableRowGroupBox at (8,27.46875) content-size 95.171875x19.46875 children: not-inline + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + TableRowBox at (8,27.46875) content-size 95.171875x19.46875 children: not-inline + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (9,28.46875) content-size 93.171875x17.46875 children: inline + line 0 width: 70.234375, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 9, rect: [9,28.46875 70.234375x17.46875] + "Body Cell" + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + TableRowGroupBox at (8,46.9375) content-size 95.171875x19.46875 children: not-inline + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + TableRowBox at (8,46.9375) content-size 95.171875x19.46875 children: not-inline + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (9,47.9375) content-size 93.171875x17.46875 children: inline + line 0 width: 93.171875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 11, rect: [9,47.9375 93.171875x17.46875] + "Footer Cell" + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,66.40625) content-size 784x0 children: inline + TextNode <#text> diff --git a/Tests/LibWeb/Layout/expected/table/borders.txt b/Tests/LibWeb/Layout/expected/table/borders.txt new file mode 100644 index 0000000000..2e26f8d3ed --- /dev/null +++ b/Tests/LibWeb/Layout/expected/table/borders.txt @@ -0,0 +1,260 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x293.625 children: not-inline + BlockContainer at (8,8) content-size 784x277.625 children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 166.296875x66.40625 children: not-inline + TableBox at (9,9) content-size 166.296875x64.40625 children: not-inline + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + TableRowGroupBox at (9,9) content-size 166.296875x64.40625 children: not-inline + TableRowBox at (9,9) content-size 166.296875x21.46875 children: not-inline + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (11,11) content-size 82.015625x17.46875 children: inline + line 0 width: 82.015625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 9, rect: [11,11 82.015625x17.46875] + "Firstname" + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (97.015625,11) content-size 76.28125x17.46875 children: inline + line 0 width: 76.28125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 8, rect: [97.015625,11 76.28125x17.46875] + "Lastname" + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + TableRowBox at (9,30.46875) content-size 166.296875x21.46875 children: not-inline + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (11,32.46875) content-size 82.015625x17.46875 children: inline + line 0 width: 44.65625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 5, rect: [11,32.46875 44.65625x17.46875] + "Peter" + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (97.015625,32.46875) content-size 76.28125x17.46875 children: inline + line 0 width: 53.671875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 7, rect: [97.015625,32.46875 53.671875x17.46875] + "Griffin" + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + TableRowBox at (9,51.9375) content-size 166.296875x21.46875 children: not-inline + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (11,53.9375) content-size 82.015625x17.46875 children: inline + line 0 width: 35.125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [11,53.9375 35.125x17.46875] + "Lois" + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (97.015625,53.9375) content-size 76.28125x17.46875 children: inline + line 0 width: 53.671875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 7, rect: [97.015625,53.9375 53.671875x17.46875] + "Griffin" + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,74.40625) content-size 784x0 children: inline + TextNode <#text> + TextNode <#text> + TableWrapper <(anonymous)> at (8,74.40625) content-size 164.296875x62.40625 children: not-inline + TableBox at (8,74.40625) content-size 164.296875x62.40625 children: not-inline + BlockContainer <(anonymous)> at (8,74.40625) content-size 0x0 children: inline + TextNode <#text> + TableRowGroupBox at (8,74.40625) content-size 164.296875x62.40625 children: not-inline + TableRowBox at (8,74.40625) content-size 164.296875x20.46875 children: not-inline + BlockContainer <(anonymous)> at (8,74.40625) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (9,75.40625) content-size 82.015625x17.46875 children: inline + line 0 width: 82.015625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 9, rect: [9,75.40625 82.015625x17.46875] + "Firstname" + TextNode <#text> + BlockContainer <(anonymous)> at (8,74.40625) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (95.015625,75.40625) content-size 76.28125x17.46875 children: inline + line 0 width: 76.28125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 8, rect: [95.015625,75.40625 76.28125x17.46875] + "Lastname" + TextNode <#text> + BlockContainer <(anonymous)> at (8,74.40625) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,74.40625) content-size 0x0 children: inline + TextNode <#text> + TableRowBox at (8,94.875) content-size 164.296875x21.46875 children: not-inline + BlockContainer <(anonymous)> at (8,74.40625) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (9,96.875) content-size 82.015625x17.46875 children: inline + line 0 width: 44.65625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 5, rect: [9,96.875 44.65625x17.46875] + "Peter" + TextNode <#text> + BlockContainer <(anonymous)> at (8,74.40625) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (95.015625,96.875) content-size 76.28125x17.46875 children: inline + line 0 width: 53.671875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 7, rect: [95.015625,96.875 53.671875x17.46875] + "Griffin" + TextNode <#text> + BlockContainer <(anonymous)> at (8,74.40625) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,74.40625) content-size 0x0 children: inline + TextNode <#text> + TableRowBox at (8,116.34375) content-size 164.296875x20.46875 children: not-inline + BlockContainer <(anonymous)> at (8,74.40625) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (9,118.34375) content-size 82.015625x17.46875 children: inline + line 0 width: 35.125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [9,118.34375 35.125x17.46875] + "Lois" + TextNode <#text> + BlockContainer <(anonymous)> at (8,74.40625) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (95.015625,118.34375) content-size 76.28125x17.46875 children: inline + line 0 width: 53.671875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 7, rect: [95.015625,118.34375 53.671875x17.46875] + "Griffin" + TextNode <#text> + BlockContainer <(anonymous)> at (8,74.40625) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,74.40625) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,136.8125) content-size 784x0 children: inline + TextNode <#text> + TextNode <#text> + TableWrapper <(anonymous)> at (8,136.8125) content-size 160.296875x56.40625 children: not-inline + TableBox at (8,136.8125) content-size 160.296875x56.40625 children: not-inline + BlockContainer <(anonymous)> at (8,136.8125) content-size 0x0 children: inline + TextNode <#text> + TableRowBox at (8,136.8125) content-size 160.296875x18.46875 children: not-inline + BlockContainer <(anonymous)> at (8,136.8125) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (8,136.8125) content-size 82.015625x17.46875 children: inline + line 0 width: 82.015625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 9, rect: [8,136.8125 82.015625x17.46875] + "Firstname" + TextNode <#text> + BlockContainer <(anonymous)> at (8,136.8125) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (92.015625,136.8125) content-size 76.28125x17.46875 children: inline + line 0 width: 76.28125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 8, rect: [92.015625,136.8125 76.28125x17.46875] + "Lastname" + TextNode <#text> + BlockContainer <(anonymous)> at (8,136.8125) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,136.8125) content-size 0x0 children: inline + TextNode <#text> + TableRowBox at (8,155.28125) content-size 160.296875x19.46875 children: not-inline + BlockContainer <(anonymous)> at (8,136.8125) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (8,156.28125) content-size 82.015625x17.46875 children: inline + line 0 width: 44.65625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 5, rect: [8,156.28125 44.65625x17.46875] + "Peter" + TextNode <#text> + BlockContainer <(anonymous)> at (8,136.8125) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (92.015625,156.28125) content-size 76.28125x17.46875 children: inline + line 0 width: 53.671875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 7, rect: [92.015625,156.28125 53.671875x17.46875] + "Griffin" + TextNode <#text> + BlockContainer <(anonymous)> at (8,136.8125) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,136.8125) content-size 0x0 children: inline + TextNode <#text> + TableRowBox at (8,174.75) content-size 160.296875x18.46875 children: not-inline + BlockContainer <(anonymous)> at (8,136.8125) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (8,175.75) content-size 82.015625x17.46875 children: inline + line 0 width: 35.125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [8,175.75 35.125x17.46875] + "Lois" + TextNode <#text> + BlockContainer <(anonymous)> at (8,136.8125) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (92.015625,175.75) content-size 76.28125x17.46875 children: inline + line 0 width: 53.671875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 7, rect: [92.015625,175.75 53.671875x17.46875] + "Griffin" + TextNode <#text> + BlockContainer <(anonymous)> at (8,136.8125) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,136.8125) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,193.21875) content-size 784x0 children: inline + TextNode <#text> + TextNode <#text> + TableWrapper <(anonymous)> at (8,193.21875) content-size 178.296875x92.40625 children: not-inline + TableBox at (8,193.21875) content-size 178.296875x92.40625 children: not-inline + BlockContainer <(anonymous)> at (8,193.21875) content-size 0x0 children: inline + TextNode <#text> + TableRowBox at (8,193.21875) content-size 178.296875x27.46875 children: not-inline + BlockContainer <(anonymous)> at (8,193.21875) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (8,193.21875) content-size 82.015625x17.46875 children: inline + line 0 width: 82.015625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 9, rect: [8,193.21875 82.015625x17.46875] + "Firstname" + TextNode <#text> + BlockContainer <(anonymous)> at (8,193.21875) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (110.015625,193.21875) content-size 76.28125x17.46875 children: inline + line 0 width: 76.28125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 8, rect: [110.015625,193.21875 76.28125x17.46875] + "Lastname" + TextNode <#text> + BlockContainer <(anonymous)> at (8,193.21875) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,193.21875) content-size 0x0 children: inline + TextNode <#text> + TableRowBox at (8,220.6875) content-size 178.296875x37.46875 children: not-inline + BlockContainer <(anonymous)> at (8,193.21875) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (8,230.6875) content-size 82.015625x17.46875 children: inline + line 0 width: 44.65625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 5, rect: [8,230.6875 44.65625x17.46875] + "Peter" + TextNode <#text> + BlockContainer <(anonymous)> at (8,193.21875) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (110.015625,230.6875) content-size 76.28125x17.46875 children: inline + line 0 width: 53.671875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 7, rect: [110.015625,230.6875 53.671875x17.46875] + "Griffin" + TextNode <#text> + BlockContainer <(anonymous)> at (8,193.21875) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,193.21875) content-size 0x0 children: inline + TextNode <#text> + TableRowBox at (8,258.15625) content-size 178.296875x27.46875 children: not-inline + BlockContainer <(anonymous)> at (8,193.21875) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (8,268.15625) content-size 82.015625x17.46875 children: inline + line 0 width: 35.125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [8,268.15625 35.125x17.46875] + "Lois" + TextNode <#text> + BlockContainer <(anonymous)> at (8,193.21875) content-size 0x0 children: inline + TextNode <#text> + TableCellBox at (110.015625,268.15625) content-size 76.28125x17.46875 children: inline + line 0 width: 53.671875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 7, rect: [110.015625,268.15625 53.671875x17.46875] + "Griffin" + TextNode <#text> + BlockContainer <(anonymous)> at (8,193.21875) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,193.21875) content-size 0x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,285.625) content-size 784x0 children: inline + TextNode <#text> diff --git a/Tests/LibWeb/Layout/input/table/basic.html b/Tests/LibWeb/Layout/input/table/basic.html new file mode 100644 index 0000000000..88c4377095 --- /dev/null +++ b/Tests/LibWeb/Layout/input/table/basic.html @@ -0,0 +1,30 @@ + + + +
+ + + + + + + + + + + + + + + + + + + +
+ A Caption +
Head Cell
Body Cell
Footer Cell
diff --git a/Tests/LibWeb/Layout/input/table/borders.html b/Tests/LibWeb/Layout/input/table/borders.html new file mode 100644 index 0000000000..2ad9169cfa --- /dev/null +++ b/Tests/LibWeb/Layout/input/table/borders.html @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + +
FirstnameLastname
PeterGriffin
LoisGriffin
+ + + + + + + + + + + + + + + +
FirstnameLastname
PeterGriffin
LoisGriffin
+ + +
+
+
Firstname
+
Lastname
+
+
+
Peter
+
Griffin
+
+
+
Lois
+
Griffin
+
+
+ + +
+
+
Firstname
+
Lastname
+
+
+
Peter
+
Griffin
+
+
+
Lois
+
Griffin
+
+
-- cgit v1.2.3