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

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

Issue 2525033002: Deprecate NGPhysicalConstraintSpace (Closed)
Patch Set: update TestExpectations Created 4 years 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_length_utils.h" 5 #include "core/layout/ng/ng_length_utils.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_constraint_space_builder.h" 8 #include "core/layout/ng/ng_constraint_space_builder.h"
9 #include "core/layout/ng/ng_fragment.h" 9 #include "core/layout/ng/ng_fragment.h"
10 #include "core/layout/ng/ng_fragment_builder.h" 10 #include "core/layout/ng/ng_fragment_builder.h"
(...skipping 10 matching lines...) Expand all
21 namespace { 21 namespace {
22 22
23 class NGLengthUtilsTest : public ::testing::Test { 23 class NGLengthUtilsTest : public ::testing::Test {
24 protected: 24 protected:
25 void SetUp() override { style_ = ComputedStyle::create(); } 25 void SetUp() override { style_ = ComputedStyle::create(); }
26 26
27 static NGConstraintSpace* ConstructConstraintSpace(int inline_size, 27 static NGConstraintSpace* ConstructConstraintSpace(int inline_size,
28 int block_size, 28 int block_size,
29 bool fixed_inline = false, 29 bool fixed_inline = false,
30 bool fixed_block = false) { 30 bool fixed_block = false) {
31 NGConstraintSpaceBuilder builder(kHorizontalTopBottom); 31 return NGConstraintSpaceBuilder(kHorizontalTopBottom)
32 builder
33 .SetAvailableSize( 32 .SetAvailableSize(
34 NGLogicalSize(LayoutUnit(inline_size), LayoutUnit(block_size))) 33 NGLogicalSize(LayoutUnit(inline_size), LayoutUnit(block_size)))
35 .SetPercentageResolutionSize( 34 .SetPercentageResolutionSize(
36 NGLogicalSize(LayoutUnit(inline_size), LayoutUnit(block_size))) 35 NGLogicalSize(LayoutUnit(inline_size), LayoutUnit(block_size)))
37 .SetIsFixedSizeInline(fixed_inline) 36 .SetIsFixedSizeInline(fixed_inline)
38 .SetIsFixedSizeBlock(fixed_block); 37 .SetIsFixedSizeBlock(fixed_block)
39 38 .ToConstraintSpace();
40 return new NGConstraintSpace(kHorizontalTopBottom, LTR,
41 builder.ToConstraintSpace());
42 } 39 }
43 40
44 LayoutUnit ResolveInlineLength( 41 LayoutUnit ResolveInlineLength(
45 const Length& length, 42 const Length& length,
46 LengthResolveType type = LengthResolveType::kContentSize, 43 LengthResolveType type = LengthResolveType::kContentSize,
47 const WTF::Optional<MinAndMaxContentSizes>& sizes = WTF::nullopt) { 44 const WTF::Optional<MinAndMaxContentSizes>& sizes = WTF::nullopt) {
48 NGConstraintSpace* constraintSpace = ConstructConstraintSpace(200, 300); 45 NGConstraintSpace* constraintSpace = ConstructConstraintSpace(200, 300);
49 return ::blink::ResolveInlineLength(*constraintSpace, *style_, sizes, 46 return ::blink::ResolveInlineLength(*constraintSpace, *style_, sizes,
50 length, type); 47 length, type);
51 } 48 }
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 EXPECT_EQ(125, GetUsedColumnWidth(4, 100, 10, 530)); 422 EXPECT_EQ(125, GetUsedColumnWidth(4, 100, 10, 530));
426 EXPECT_EQ(4, GetUsedColumnCount(4, 100, 10, 530)); 423 EXPECT_EQ(4, GetUsedColumnCount(4, 100, 10, 530));
427 EXPECT_EQ(100, GetUsedColumnWidth(6, 100, 10, 540)); 424 EXPECT_EQ(100, GetUsedColumnWidth(6, 100, 10, 540));
428 EXPECT_EQ(5, GetUsedColumnCount(6, 100, 10, 540)); 425 EXPECT_EQ(5, GetUsedColumnCount(6, 100, 10, 540));
429 EXPECT_EQ(100, GetUsedColumnWidth(0, 100, 10, 540)); 426 EXPECT_EQ(100, GetUsedColumnWidth(0, 100, 10, 540));
430 EXPECT_EQ(5, GetUsedColumnCount(0, 100, 10, 540)); 427 EXPECT_EQ(5, GetUsedColumnCount(0, 100, 10, 540));
431 } 428 }
432 429
433 } // namespace 430 } // namespace
434 } // namespace blink 431 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698