Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/line/InlineBoxTest.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/line/InlineBoxTest.cpp b/third_party/WebKit/Source/core/layout/line/InlineBoxTest.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2c779d438e66c9e9623c673fd191111fd7933acf |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/layout/line/InlineBoxTest.cpp |
| @@ -0,0 +1,46 @@ |
| +// Copyright 2016 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 "core/layout/line/InlineBox.h" |
| + |
| +#include "core/layout/LayoutBlockFlow.h" |
| +#include "core/layout/LayoutTestHelper.h" |
| + |
| +namespace blink { |
| + |
| +using InlineBoxTest = RenderingTest; |
| + |
| +TEST_F(InlineBoxTest, LogicalRectToPhysicalRectNormal) { |
| + setBodyInnerHTML( |
| + "<div id='div' style='width: 80px; height: 50px'>Test</div>"); |
| + LayoutBlockFlow* div = toLayoutBlockFlow(getLayoutObjectByElementId("div")); |
| + InlineBox* inlineBox = div->firstLineBox(); |
| + LayoutRect rect(11, 22, 33, 44); |
| + inlineBox->logicalRectToPhysicalRect(rect); |
| + EXPECT_EQ(LayoutRect(11, 22, 33, 44), rect); |
| +} |
| + |
| +TEST_F(InlineBoxTest, LogicalRectToPhysicalRectVerticalRL) { |
| + setBodyInnerHTML( |
| + "<div id='div' " |
| + "style='writing-mode:vertical-rl; width: 80px; height: 50px'>Test</div>"); |
| + LayoutBlockFlow* div = toLayoutBlockFlow(getLayoutObjectByElementId("div")); |
| + InlineBox* inlineBox = div->firstLineBox(); |
| + LayoutRect rect(11, 22, 33, 44); |
| + inlineBox->logicalRectToPhysicalRect(rect); |
| + EXPECT_EQ(LayoutRect(14, 11, 44, 33), rect); |
|
chrishtr
2016/11/28 19:16:01
Could you confirm quickly that this did not change
Xianzhu
2016/11/28 20:10:07
Confirmed that these tests passed without the chan
|
| +} |
| + |
| +TEST_F(InlineBoxTest, LogicalRectToPhysicalRectVerticalLR) { |
| + setBodyInnerHTML( |
| + "<div id='div' " |
| + "style='writing-mode:vertical-lr; width: 80px; height: 50px'>Test</div>"); |
| + LayoutBlockFlow* div = toLayoutBlockFlow(getLayoutObjectByElementId("div")); |
| + InlineBox* inlineBox = div->firstLineBox(); |
| + LayoutRect rect(11, 22, 33, 44); |
| + inlineBox->logicalRectToPhysicalRect(rect); |
| + EXPECT_EQ(LayoutRect(22, 11, 44, 33), rect); |
|
chrishtr
2016/11/28 19:16:01
Same here. Just a little paranoid because I tried
|
| +} |
| + |
| +} // namespace blink |