| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "core/layout/ng/geometry/ng_box_strut.h" | |
| 6 | |
| 7 #include "testing/gtest/include/gtest/gtest.h" | |
| 8 | |
| 9 namespace blink { | |
| 10 | |
| 11 namespace { | |
| 12 | |
| 13 // Ideally, this would be tested by NGBoxStrut::ConvertToPhysical, but | |
| 14 // this has not been implemented yet. | |
| 15 TEST(NGGeometryUnitsTest, ConvertPhysicalStrutToLogical) { | |
| 16 LayoutUnit left{5}, right{10}, top{15}, bottom{20}; | |
| 17 NGPhysicalBoxStrut physical{left, right, top, bottom}; | |
| 18 | |
| 19 NGBoxStrut logical = | |
| 20 physical.ConvertToLogical(kHorizontalTopBottom, TextDirection::kLtr); | |
| 21 EXPECT_EQ(left, logical.inline_start); | |
| 22 EXPECT_EQ(top, logical.block_start); | |
| 23 | |
| 24 logical = | |
| 25 physical.ConvertToLogical(kHorizontalTopBottom, TextDirection::kRtl); | |
| 26 EXPECT_EQ(right, logical.inline_start); | |
| 27 EXPECT_EQ(top, logical.block_start); | |
| 28 | |
| 29 logical = physical.ConvertToLogical(kVerticalLeftRight, TextDirection::kLtr); | |
| 30 EXPECT_EQ(top, logical.inline_start); | |
| 31 EXPECT_EQ(left, logical.block_start); | |
| 32 | |
| 33 logical = physical.ConvertToLogical(kVerticalLeftRight, TextDirection::kRtl); | |
| 34 EXPECT_EQ(bottom, logical.inline_start); | |
| 35 EXPECT_EQ(left, logical.block_start); | |
| 36 | |
| 37 logical = physical.ConvertToLogical(kVerticalRightLeft, TextDirection::kLtr); | |
| 38 EXPECT_EQ(top, logical.inline_start); | |
| 39 EXPECT_EQ(right, logical.block_start); | |
| 40 | |
| 41 logical = physical.ConvertToLogical(kVerticalRightLeft, TextDirection::kRtl); | |
| 42 EXPECT_EQ(bottom, logical.inline_start); | |
| 43 EXPECT_EQ(right, logical.block_start); | |
| 44 } | |
| 45 | |
| 46 } // namespace | |
| 47 | |
| 48 } // namespace blink | |
| OLD | NEW |