Commit 6398b025 authored by Aleks Totic's avatar Aleks Totic Committed by Commit Bot

[TablesNG] row/col/ax unit tests

Few more unit test fixes.

Bug: 958381
Change-Id: I902fe45de917b06322e886b02c2b6fe495d08421
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536254
Commit-Queue: Aleks Totic <atotic@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827488}
parent c7a07b61
......@@ -20,7 +20,15 @@ TEST_F(LayoutTableColTest, LocalVisualRect) {
</table>
)HTML");
EXPECT_TRUE(GetLayoutObjectByElementId("col1")->LocalVisualRect().IsEmpty());
// TablesNG hidden columns get geometry, because they paint their background
// into cells.
if (RuntimeEnabledFeatures::LayoutNGTableEnabled()) {
EXPECT_FALSE(
GetLayoutObjectByElementId("col1")->LocalVisualRect().IsEmpty());
} else {
EXPECT_TRUE(
GetLayoutObjectByElementId("col1")->LocalVisualRect().IsEmpty());
}
EXPECT_TRUE(GetLayoutObjectByElementId("col2")->LocalVisualRect().IsEmpty());
EXPECT_TRUE(GetLayoutObjectByElementId("col3")->LocalVisualRect().IsEmpty());
}
......
......@@ -143,16 +143,32 @@ TEST_F(LayoutTableRowTest, VisualOverflow) {
)HTML");
auto* row1 = GetRowByElementId("row1");
EXPECT_EQ(LayoutRect(120, 0, 210, 320), row1->ContentsVisualOverflowRect());
EXPECT_EQ(LayoutRect(0, 0, 450, 320), row1->SelfVisualOverflowRect());
// TablesNG row geometry does not include border spacing. Legacy does.
// All row geometry expectations are different.
if (RuntimeEnabledFeatures::LayoutNGTableEnabled()) {
EXPECT_EQ(LayoutRect(110, 0, 210, 320), row1->ContentsVisualOverflowRect());
EXPECT_EQ(LayoutRect(0, 0, 430, 320), row1->SelfVisualOverflowRect());
} else {
EXPECT_EQ(LayoutRect(120, 0, 210, 320), row1->ContentsVisualOverflowRect());
EXPECT_EQ(LayoutRect(0, 0, 450, 320), row1->SelfVisualOverflowRect());
}
auto* row2 = GetRowByElementId("row2");
EXPECT_EQ(LayoutRect(0, -10, 440, 220), row2->ContentsVisualOverflowRect());
EXPECT_EQ(LayoutRect(0, 0, 450, 210), row2->SelfVisualOverflowRect());
if (RuntimeEnabledFeatures::LayoutNGTableEnabled()) {
EXPECT_EQ(LayoutRect(-10, -10, 440, 220),
row2->ContentsVisualOverflowRect());
EXPECT_EQ(LayoutRect(0, 0, 430, 210), row2->SelfVisualOverflowRect());
} else {
EXPECT_EQ(LayoutRect(0, -10, 440, 220), row2->ContentsVisualOverflowRect());
EXPECT_EQ(LayoutRect(0, 0, 450, 210), row2->SelfVisualOverflowRect());
}
auto* row3 = GetRowByElementId("row3");
EXPECT_EQ(LayoutRect(), row3->ContentsVisualOverflowRect());
EXPECT_EQ(LayoutRect(0, 0, 450, 100), row3->SelfVisualOverflowRect());
if (RuntimeEnabledFeatures::LayoutNGTableEnabled()) {
EXPECT_EQ(LayoutRect(), row3->ContentsVisualOverflowRect());
EXPECT_EQ(LayoutRect(0, 0, 430, 100), row3->SelfVisualOverflowRect());
} else {
EXPECT_EQ(LayoutRect(), row3->ContentsVisualOverflowRect());
EXPECT_EQ(LayoutRect(0, 0, 450, 100), row3->SelfVisualOverflowRect());
}
}
TEST_F(LayoutTableRowTest, VisualOverflowWithCollapsedBorders) {
......@@ -173,17 +189,29 @@ TEST_F(LayoutTableRowTest, VisualOverflowWithCollapsedBorders) {
auto* row = GetRowByElementId("row");
// The row's self visual overflow covers the collapsed borders.
LayoutRect expected_self_visual_overflow = row->BorderBoxRect();
expected_self_visual_overflow.ExpandEdges(LayoutUnit(1), LayoutUnit(8),
LayoutUnit(5), LayoutUnit(0));
if (RuntimeEnabledFeatures::LayoutNGTableEnabled()) {
// Row's visual overflow does not include collapsed borders.
// They are painted by the table.
} else {
// The row's self visual overflow covers the collapsed borders.
expected_self_visual_overflow.ExpandEdges(LayoutUnit(1), LayoutUnit(8),
LayoutUnit(5), LayoutUnit(0));
}
EXPECT_EQ(expected_self_visual_overflow, row->SelfVisualOverflowRect());
// The row's visual overflow covers self visual overflow and visual overflows
// of all cells.
LayoutRect expected_visual_overflow = row->BorderBoxRect();
expected_visual_overflow.ExpandEdges(LayoutUnit(3), LayoutUnit(8),
LayoutUnit(5), LayoutUnit(3));
if (RuntimeEnabledFeatures::LayoutNGTableEnabled()) {
// Row's visual overflow does not include collapsed borders.
// It does include visual overflow of all cells.
expected_visual_overflow.ExpandEdges(LayoutUnit(3), LayoutUnit(0),
LayoutUnit(3), LayoutUnit(3));
} else {
// The row's visual overflow covers self visual overflow and visual
// overflows of all cells.
expected_visual_overflow.ExpandEdges(LayoutUnit(3), LayoutUnit(8),
LayoutUnit(5), LayoutUnit(3));
}
EXPECT_EQ(expected_visual_overflow, row->VisualOverflowRect());
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment