summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/layout/layout_table_col_test.cc
blob: 354b52278302f2ba084440a8cde78a459221aaac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/core/layout/layout_table_col.h"

#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"

namespace blink {

using LayoutTableColTest = RenderingTest;

TEST_F(LayoutTableColTest, LocalVisualRectSPv1) {
  ScopedSlimmingPaintV175ForTest spv175(false);
  SetBodyInnerHTML(R"HTML(
    <table id='table' style='width: 200px; height: 200px'>
      <col id='col1' style='visibility: hidden'>
      <col id='col2' style='visibility: collapse'>
      <col id='col3'>
      <tr><td></td><td></td></tr>
    </table>
  )HTML");

  auto table_local_visual_rect =
      GetLayoutObjectByElementId("table")->LocalVisualRect();
  EXPECT_NE(LayoutRect(), table_local_visual_rect);
  EXPECT_EQ(table_local_visual_rect,
            GetLayoutObjectByElementId("col1")->LocalVisualRect());
  EXPECT_EQ(table_local_visual_rect,
            GetLayoutObjectByElementId("col2")->LocalVisualRect());
  EXPECT_EQ(table_local_visual_rect,
            GetLayoutObjectByElementId("col3")->LocalVisualRect());
}

TEST_F(LayoutTableColTest, LocalVisualRectSPv175) {
  ScopedSlimmingPaintV175ForTest spv175(true);
  SetBodyInnerHTML(R"HTML(
    <table style='width: 200px; height: 200px'>
      <col id='col1' style='visibility: hidden'>
      <col id='col2' style='visibility: collapse'>
      <col id='col3'>
      <tr><td></td><td></td></tr>
    </table>
  )HTML");

  EXPECT_EQ(LayoutRect(),
            GetLayoutObjectByElementId("col1")->LocalVisualRect());
  EXPECT_EQ(LayoutRect(),
            GetLayoutObjectByElementId("col2")->LocalVisualRect());
  EXPECT_EQ(LayoutRect(),
            GetLayoutObjectByElementId("col3")->LocalVisualRect());
}

}  // namespace blink