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

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

Issue 2272313004: [layoutng] Rename struct members to match style guide (Closed)
Patch Set: Created 4 years, 3 months 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_margin_strut.h" 8 #include "core/layout/ng/ng_margin_strut.h"
9 #include "core/style/ComputedStyle.h" 9 #include "core/style/ComputedStyle.h"
10 #include "platform/CalculationValue.h" 10 #include "platform/CalculationValue.h"
11 #include "platform/LayoutUnit.h" 11 #include "platform/LayoutUnit.h"
12 #include "platform/Length.h" 12 #include "platform/Length.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "wtf/RefPtr.h" 14 #include "wtf/RefPtr.h"
15 15
16 namespace blink { 16 namespace blink {
17 namespace { 17 namespace {
18 18
19 class NGLengthUtilsTest : public ::testing::Test { 19 class NGLengthUtilsTest : public ::testing::Test {
20 protected: 20 protected:
21 void SetUp() override { style_ = ComputedStyle::create(); } 21 void SetUp() override { style_ = ComputedStyle::create(); }
22 22
23 static NGConstraintSpace constructConstraintSpace(int inline_size, 23 static NGConstraintSpace constructConstraintSpace(int inline_size,
24 int block_size) { 24 int block_size) {
25 NGLogicalSize container_size; 25 NGLogicalSize container_size;
26 container_size.inlineSize = LayoutUnit(inline_size); 26 container_size.inline_size = LayoutUnit(inline_size);
27 container_size.blockSize = LayoutUnit(block_size); 27 container_size.block_size = LayoutUnit(block_size);
28 return NGConstraintSpace(container_size); 28 return NGConstraintSpace(container_size);
29 } 29 }
30 30
31 LayoutUnit resolveInlineLength( 31 LayoutUnit resolveInlineLength(
32 const Length& length, 32 const Length& length,
33 LengthResolveType type = LengthResolveType::ContentSize) { 33 LengthResolveType type = LengthResolveType::ContentSize) {
34 NGConstraintSpace constraintSpace = constructConstraintSpace(200, 300); 34 NGConstraintSpace constraintSpace = constructConstraintSpace(200, 300);
35 return ::blink::resolveInlineLength(constraintSpace, length, type); 35 return ::blink::resolveInlineLength(constraintSpace, length, type);
36 } 36 }
37 37
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 TEST_F(NGLengthUtilsTest, testMargins) { 177 TEST_F(NGLengthUtilsTest, testMargins) {
178 style_->setMarginTop(Length(10, Percent)); 178 style_->setMarginTop(Length(10, Percent));
179 style_->setMarginRight(Length(52, Fixed)); 179 style_->setMarginRight(Length(52, Fixed));
180 style_->setMarginBottom(Length(Auto)); 180 style_->setMarginBottom(Length(Auto));
181 style_->setMarginLeft(Length(11, Percent)); 181 style_->setMarginLeft(Length(11, Percent));
182 182
183 NGConstraintSpace constraintSpace(constructConstraintSpace(200, 300)); 183 NGConstraintSpace constraintSpace(constructConstraintSpace(200, 300));
184 184
185 NGBoxMargins margins = computeMargins(constraintSpace, *style_); 185 NGBoxMargins margins = computeMargins(constraintSpace, *style_);
186 186
187 EXPECT_EQ(LayoutUnit(20), margins.blockStart); 187 EXPECT_EQ(LayoutUnit(20), margins.block_start);
188 EXPECT_EQ(LayoutUnit(52), margins.inlineEnd); 188 EXPECT_EQ(LayoutUnit(52), margins.inline_end);
189 EXPECT_EQ(LayoutUnit(), margins.blockEnd); 189 EXPECT_EQ(LayoutUnit(), margins.block_end);
190 EXPECT_EQ(LayoutUnit(22), margins.inlineStart); 190 EXPECT_EQ(LayoutUnit(22), margins.inline_start);
191 } 191 }
192 192
193 } // namespace 193 } // namespace
194 } // namespace blink 194 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698