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_constraint_space.h" | 5 #include "core/layout/ng/ng_constraint_space.h" |
6 | 6 |
7 #include "core/layout/ng/ng_derived_constraint_space.h" | 7 #include "core/layout/ng/ng_derived_constraint_space.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 22 matching lines...) Expand all Loading... |
33 EXPECT_TRUE(horz_space->FixedInlineSize()); | 33 EXPECT_TRUE(horz_space->FixedInlineSize()); |
34 EXPECT_TRUE(vert_space->FixedBlockSize()); | 34 EXPECT_TRUE(vert_space->FixedBlockSize()); |
35 | 35 |
36 EXPECT_FALSE(horz_space->FixedBlockSize()); | 36 EXPECT_FALSE(horz_space->FixedBlockSize()); |
37 EXPECT_FALSE(vert_space->FixedInlineSize()); | 37 EXPECT_FALSE(vert_space->FixedInlineSize()); |
38 | 38 |
39 EXPECT_EQ(FragmentColumn, horz_space->BlockFragmentationType()); | 39 EXPECT_EQ(FragmentColumn, horz_space->BlockFragmentationType()); |
40 EXPECT_EQ(FragmentNone, vert_space->BlockFragmentationType()); | 40 EXPECT_EQ(FragmentNone, vert_space->BlockFragmentationType()); |
41 } | 41 } |
42 | 42 |
| 43 TEST(NGConstraintSpaceTest, LayoutOpportunities) { |
| 44 NGPhysicalSize physical_size; |
| 45 physical_size.width = LayoutUnit(600); |
| 46 physical_size.height = LayoutUnit(400); |
| 47 auto* physical_space = new NGPhysicalConstraintSpace(physical_size); |
| 48 auto* space = new NGConstraintSpace(HorizontalTopBottom, physical_space); |
| 49 |
| 50 bool for_inline_or_bfc = false; |
| 51 auto iterator = space->LayoutOpportunities(NGClearNone, for_inline_or_bfc); |
| 52 |
| 53 auto firstOpportunity = iterator.Next(); |
| 54 EXPECT_EQ(LayoutUnit(600), firstOpportunity->Size().inline_size); |
| 55 EXPECT_EQ(LayoutUnit(400), firstOpportunity->Size().block_size); |
| 56 } |
| 57 |
43 } // namespace | 58 } // namespace |
44 | 59 |
45 } // namespace blink | 60 } // namespace blink |
OLD | NEW |