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

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

Issue 2237623002: Demo patch that demonstrates simple block layout using Layout NG (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed NGBlockLayoutAlgorithmTest Created 4 years, 4 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_block_layout_algorithm.h" 5 #include "core/layout/ng/ng_block_layout_algorithm.h"
6 6
7 #include "core/layout/ng/ng_box.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/style/ComputedStyle.h" 10 #include "core/style/ComputedStyle.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace blink { 13 namespace blink {
14 namespace { 14 namespace {
15 15
16 class NGBlockLayoutAlgorithmTest : public ::testing::Test { 16 class NGBlockLayoutAlgorithmTest : public ::testing::Test {
17 protected: 17 protected:
18 void SetUp() override { 18 void SetUp() override {
19 style_ = ComputedStyle::create(); 19 style_ = ComputedStyle::create();
20 } 20 }
21 21
22 RefPtr<ComputedStyle> style_; 22 RefPtr<ComputedStyle> style_;
23 }; 23 };
24 24
25 TEST_F(NGBlockLayoutAlgorithmTest, FixedSize) { 25 TEST_F(NGBlockLayoutAlgorithmTest, FixedSize) {
26 style_->setWidth(Length(30, Fixed)); 26 style_->setWidth(Length(30, Fixed));
27 style_->setHeight(Length(40, Fixed)); 27 style_->setHeight(Length(40, Fixed));
28 28
29 NGConstraintSpace space(LayoutUnit(100), LayoutUnit(-1)); 29 NGConstraintSpace space(LayoutUnit(100), LayoutUnit(-1));
30 30
31 NGBlockLayoutAlgorithm algorithm(style_, NGBox(nullptr)); 31 NGBlockLayoutAlgorithm algorithm(style_, NGBoxIterator(nullptr));
32 NGFragment* frag = algorithm.layout(space); 32 NGFragment* frag = algorithm.layout(space);
33 EXPECT_EQ(frag->inlineSize(), LayoutUnit(30)); 33 EXPECT_EQ(frag->inlineSize(), LayoutUnit(30));
34 EXPECT_EQ(frag->blockSize(), LayoutUnit(40)); 34 EXPECT_EQ(frag->blockSize(), LayoutUnit(40));
35 } 35 }
36 36
37 } // namespace 37 } // namespace
38 } // namespace blink 38 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698