OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/layout/ng/ng_units.h" | 5 #include "core/layout/ng/ng_units.h" |
6 | 6 |
7 #include "platform/text/TextDirection.h" | 7 #include "platform/text/TextDirection.h" |
8 #include "core/layout/ng/ng_writing_mode.h" | 8 #include "core/layout/ng/ng_writing_mode.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 logical = physical.ConvertToLogical(VerticalRightLeft, LTR); | 94 logical = physical.ConvertToLogical(VerticalRightLeft, LTR); |
95 EXPECT_EQ(top, logical.inline_start); | 95 EXPECT_EQ(top, logical.inline_start); |
96 EXPECT_EQ(right, logical.block_start); | 96 EXPECT_EQ(right, logical.block_start); |
97 | 97 |
98 logical = physical.ConvertToLogical(VerticalRightLeft, RTL); | 98 logical = physical.ConvertToLogical(VerticalRightLeft, RTL); |
99 EXPECT_EQ(bottom, logical.inline_start); | 99 EXPECT_EQ(bottom, logical.inline_start); |
100 EXPECT_EQ(right, logical.block_start); | 100 EXPECT_EQ(right, logical.block_start); |
101 } | 101 } |
102 | 102 |
| 103 TEST(NGUnitsTest, ShrinkToFit) { |
| 104 MinAndMaxContentSizes sizes; |
| 105 |
| 106 sizes.min_content = LayoutUnit(100); |
| 107 sizes.max_content = LayoutUnit(200); |
| 108 EXPECT_EQ(LayoutUnit(200), sizes.ShrinkToFit(LayoutUnit(300))); |
| 109 |
| 110 sizes.min_content = LayoutUnit(100); |
| 111 sizes.max_content = LayoutUnit(300); |
| 112 EXPECT_EQ(LayoutUnit(200), sizes.ShrinkToFit(LayoutUnit(200))); |
| 113 |
| 114 sizes.min_content = LayoutUnit(200); |
| 115 sizes.max_content = LayoutUnit(300); |
| 116 EXPECT_EQ(LayoutUnit(200), sizes.ShrinkToFit(LayoutUnit(100))); |
| 117 } |
| 118 |
103 } // namespace | 119 } // namespace |
104 | 120 |
105 } // namespace blink | 121 } // namespace blink |
OLD | NEW |