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

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

Issue 2235823002: [layoutng] Add a basic unit test for NGBlockLayoutAlgorithm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One more try 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f008d686370ed2844e0e40f2442916bc5c17a0e6
--- /dev/null
+++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc
@@ -0,0 +1,38 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/layout/ng/ng_block_layout_algorithm.h"
+
+#include "core/layout/ng/ng_box.h"
+#include "core/layout/ng/ng_constraint_space.h"
+#include "core/layout/ng/ng_fragment.h"
+#include "core/style/ComputedStyle.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace blink {
+namespace {
+
+class NGBlockLayoutAlgorithmTest : public ::testing::Test {
+ protected:
+ void SetUp() override {
+ style_ = ComputedStyle::create();
+ }
+
+ RefPtr<ComputedStyle> style_;
+};
+
+TEST_F(NGBlockLayoutAlgorithmTest, FixedSize) {
+ style_->setWidth(Length(30, Fixed));
+ style_->setHeight(Length(40, Fixed));
+
+ NGConstraintSpace space(LayoutUnit(100), LayoutUnit(-1));
+
+ NGBlockLayoutAlgorithm algorithm(style_, NGBox(nullptr));
+ NGFragment* frag = algorithm.layout(space);
+ EXPECT_EQ(frag->inlineSize(), LayoutUnit(30));
+ EXPECT_EQ(frag->blockSize(), LayoutUnit(40));
+}
+
+} // namespace
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698