Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_constraint_space_test.cc

Issue 2456193002: [LayoutNG] Remove last NGConstraintSpace constructor. (Closed)
Patch Set: address comment. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_constraint_space.h" 7 #include "core/layout/ng/ng_constraint_space.h"
8 #include "core/layout/ng/ng_layout_opportunity_iterator.h" 8 #include "core/layout/ng/ng_layout_opportunity_iterator.h"
9 #include "core/layout/ng/ng_physical_constraint_space.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 11
11 namespace blink { 12 namespace blink {
12 13
13 namespace { 14 namespace {
14 15
15 TEST(NGConstraintSpaceTest, WritingMode) { 16 TEST(NGConstraintSpaceTest, WritingMode) {
17 NGPhysicalConstraintSpace* phy_space = new NGPhysicalConstraintSpace(
18 NGPhysicalSize(LayoutUnit(200), LayoutUnit(100)), /* fixed_width */ true,
19 /* fixed_height */ false, /* width_direction_triggers_scrollbar */ true,
20 /* height_direction_triggers_scrollbar */ false, FragmentNone,
21 FragmentColumn, /* is_new_fc */ false);
22
16 NGConstraintSpace* horz_space = 23 NGConstraintSpace* horz_space =
17 new NGConstraintSpace(HorizontalTopBottom, LeftToRight, 24 new NGConstraintSpace(HorizontalTopBottom, LeftToRight, phy_space);
18 NGLogicalSize(LayoutUnit(200), LayoutUnit(100)));
19 horz_space->SetOverflowTriggersScrollbar(true, false);
20 horz_space->SetFixedSize(true, false);
21 horz_space->SetFragmentationType(FragmentColumn);
22 25
23 NGConstraintSpace* vert_space = new NGConstraintSpace( 26 NGConstraintSpace* vert_space =
24 VerticalRightLeft, LeftToRight, horz_space->MutablePhysicalSpace()); 27 new NGConstraintSpace(VerticalRightLeft, LeftToRight, phy_space);
25 28
26 EXPECT_EQ(LayoutUnit(200), horz_space->ContainerSize().inline_size); 29 EXPECT_EQ(LayoutUnit(200), horz_space->ContainerSize().inline_size);
27 EXPECT_EQ(LayoutUnit(200), vert_space->ContainerSize().block_size); 30 EXPECT_EQ(LayoutUnit(200), vert_space->ContainerSize().block_size);
28 31
29 EXPECT_EQ(LayoutUnit(100), horz_space->ContainerSize().block_size); 32 EXPECT_EQ(LayoutUnit(100), horz_space->ContainerSize().block_size);
30 EXPECT_EQ(LayoutUnit(100), vert_space->ContainerSize().inline_size); 33 EXPECT_EQ(LayoutUnit(100), vert_space->ContainerSize().inline_size);
31 34
32 EXPECT_TRUE(horz_space->InlineTriggersScrollbar()); 35 EXPECT_TRUE(horz_space->InlineTriggersScrollbar());
33 EXPECT_TRUE(vert_space->BlockTriggersScrollbar()); 36 EXPECT_TRUE(vert_space->BlockTriggersScrollbar());
34 37
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 new NGConstraintSpace(HorizontalTopBottom, LeftToRight, physical_space); 199 new NGConstraintSpace(HorizontalTopBottom, LeftToRight, physical_space);
197 200
198 auto* iterator = space->LayoutOpportunities(); 201 auto* iterator = space->LayoutOpportunities();
199 202
200 EXPECT_EQ("0,0 600x100", OpportunityToString(iterator->Next())); 203 EXPECT_EQ("0,0 600x100", OpportunityToString(iterator->Next()));
201 EXPECT_EQ("(empty)", OpportunityToString(iterator->Next())); 204 EXPECT_EQ("(empty)", OpportunityToString(iterator->Next()));
202 } 205 }
203 206
204 } // namespace 207 } // namespace
205 } // namespace blink 208 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698