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_layout_opportunity_iterator.h" | 7 #include "core/layout/ng/ng_layout_opportunity_iterator.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 26 matching lines...) Expand all Loading... |
37 EXPECT_TRUE(horz_space->FixedInlineSize()); | 37 EXPECT_TRUE(horz_space->FixedInlineSize()); |
38 EXPECT_TRUE(vert_space->FixedBlockSize()); | 38 EXPECT_TRUE(vert_space->FixedBlockSize()); |
39 | 39 |
40 EXPECT_FALSE(horz_space->FixedBlockSize()); | 40 EXPECT_FALSE(horz_space->FixedBlockSize()); |
41 EXPECT_FALSE(vert_space->FixedInlineSize()); | 41 EXPECT_FALSE(vert_space->FixedInlineSize()); |
42 | 42 |
43 EXPECT_EQ(FragmentColumn, horz_space->BlockFragmentationType()); | 43 EXPECT_EQ(FragmentColumn, horz_space->BlockFragmentationType()); |
44 EXPECT_EQ(FragmentNone, vert_space->BlockFragmentationType()); | 44 EXPECT_EQ(FragmentNone, vert_space->BlockFragmentationType()); |
45 } | 45 } |
46 | 46 |
47 static String OpportunityToString(const NGConstraintSpace* opportunity) { | 47 static String OpportunityToString(const NGLogicalRect* opportunity) { |
48 return opportunity ? opportunity->ToString() : String("(null)"); | 48 return opportunity ? opportunity->ToString() : String("(null)"); |
49 } | 49 } |
50 | 50 |
51 TEST(NGConstraintSpaceTest, LayoutOpportunitiesNoExclusions) { | 51 TEST(NGConstraintSpaceTest, LayoutOpportunitiesNoExclusions) { |
52 NGPhysicalSize physical_size; | 52 NGPhysicalSize physical_size; |
53 physical_size.width = LayoutUnit(600); | 53 physical_size.width = LayoutUnit(600); |
54 physical_size.height = LayoutUnit(400); | 54 physical_size.height = LayoutUnit(400); |
55 auto* physical_space = new NGPhysicalConstraintSpace(physical_size); | 55 auto* physical_space = new NGPhysicalConstraintSpace(physical_size); |
56 auto* space = | 56 auto* space = |
57 new NGConstraintSpace(HorizontalTopBottom, LeftToRight, physical_space); | 57 new NGConstraintSpace(HorizontalTopBottom, LeftToRight, physical_space); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 bool for_inline_or_bfc = true; | 201 bool for_inline_or_bfc = true; |
202 auto* iterator = space->LayoutOpportunities(NGClearNone, for_inline_or_bfc); | 202 auto* iterator = space->LayoutOpportunities(NGClearNone, for_inline_or_bfc); |
203 | 203 |
204 EXPECT_EQ("0,0 600x100", OpportunityToString(iterator->Next())); | 204 EXPECT_EQ("0,0 600x100", OpportunityToString(iterator->Next())); |
205 EXPECT_EQ("(null)", OpportunityToString(iterator->Next())); | 205 EXPECT_EQ("(null)", OpportunityToString(iterator->Next())); |
206 } | 206 } |
207 | 207 |
208 } // namespace | 208 } // namespace |
209 } // namespace blink | 209 } // namespace blink |
OLD | NEW |