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

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

Issue 2462153002: [layoutng] Support computing min-content and max-content (Closed)
Patch Set: Created 4 years, 1 month 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_box_test.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_box_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_box_test.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b63fb398f12362742692277f6fb3d3b841e17383
--- /dev/null
+++ b/third_party/WebKit/Source/core/layout/ng/ng_box_test.cc
@@ -0,0 +1,37 @@
+// 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_box.h"
+
+#include "core/layout/ng/ng_fragment.h"
+#include "core/style/ComputedStyle.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace blink {
+namespace {
+class NGBoxTest : public ::testing::Test {
+ protected:
+ void SetUp() override { style_ = ComputedStyle::create(); }
+
+ RefPtr<ComputedStyle> style_;
+};
+
+TEST_F(NGBoxTest, MinAndMaxContent) {
+ const int kWidth = 30;
+
+ RefPtr<ComputedStyle> first_style = ComputedStyle::create();
+ first_style->setWidth(Length(kWidth, Fixed));
+ NGBox* first_child = new NGBox(first_style.get());
+
+ NGBox* box = new NGBox(style_.get());
+ box->SetFirstChild(first_child);
+
+ NGFragment* min_content;
+ NGFragment* max_content;
+ box->ComputeMinAndMaxContentSizes(&min_content, &max_content);
+ EXPECT_EQ(LayoutUnit(kWidth), min_content->InlineSize());
+ EXPECT_EQ(LayoutUnit(kWidth), max_content->InlineSize());
+}
+} // namespace
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698