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

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

Issue 2274593002: [layoutng] Correctly resolve indefinite percentages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NGSizeIndefinite 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_length_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_block_layout_algorithm.h" 5 #include "core/layout/ng/ng_block_layout_algorithm.h"
6 6
7 #include "core/layout/ng/ng_box_iterator.h" 7 #include "core/layout/ng/ng_box_iterator.h"
8 #include "core/layout/ng/ng_constraint_space.h" 8 #include "core/layout/ng/ng_constraint_space.h"
9 #include "core/layout/ng/ng_fragment.h" 9 #include "core/layout/ng/ng_fragment.h"
10 #include "core/layout/ng/ng_length_utils.h"
10 #include "core/style/ComputedStyle.h" 11 #include "core/style/ComputedStyle.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 namespace blink { 14 namespace blink {
14 namespace { 15 namespace {
15 16
16 class NGBlockLayoutAlgorithmTest : public ::testing::Test { 17 class NGBlockLayoutAlgorithmTest : public ::testing::Test {
17 protected: 18 protected:
18 void SetUp() override { style_ = ComputedStyle::create(); } 19 void SetUp() override { style_ = ComputedStyle::create(); }
19 20
20 RefPtr<ComputedStyle> style_; 21 RefPtr<ComputedStyle> style_;
21 }; 22 };
22 23
23 TEST_F(NGBlockLayoutAlgorithmTest, FixedSize) { 24 TEST_F(NGBlockLayoutAlgorithmTest, FixedSize) {
24 style_->setWidth(Length(30, Fixed)); 25 style_->setWidth(Length(30, Fixed));
25 style_->setHeight(Length(40, Fixed)); 26 style_->setHeight(Length(40, Fixed));
26 27
27 NGLogicalSize container_size; 28 NGLogicalSize container_size;
28 container_size.inlineSize = LayoutUnit(100); 29 container_size.inlineSize = LayoutUnit(100);
29 container_size.blockSize = LayoutUnit(-1); 30 container_size.blockSize = NGSizeIndefinite;
30 NGConstraintSpace space(container_size); 31 NGConstraintSpace space(container_size);
31 32
32 NGBlockLayoutAlgorithm algorithm(style_, NGBoxIterator(NGBox())); 33 NGBlockLayoutAlgorithm algorithm(style_, NGBoxIterator(NGBox()));
33 NGFragment* frag = algorithm.layout(space); 34 NGFragment* frag = algorithm.layout(space);
34 EXPECT_EQ(frag->inlineSize(), LayoutUnit(30)); 35 EXPECT_EQ(frag->inlineSize(), LayoutUnit(30));
35 EXPECT_EQ(frag->blockSize(), LayoutUnit(40)); 36 EXPECT_EQ(frag->blockSize(), LayoutUnit(40));
36 } 37 }
37 38
38 } // namespace 39 } // namespace
39 } // namespace blink 40 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_length_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698