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

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

Issue 2706403008: [LayoutNG] Implement ComputeMinAndMaxContentSizes for inline (Closed)
Patch Set: Cleanup and add a test Created 3 years, 10 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_inline_node_test.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_inline_node_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_inline_node_test.cc
index 2568b2c89c1da8751a37afd83551a26eaebd3b9a..e24cdc35d701b2797cabb97fdeed54dba79e90ed 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_inline_node_test.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_inline_node_test.cc
@@ -13,6 +13,8 @@
#include "core/layout/ng/ng_text_fragment.h"
#include "core/layout/ng/ng_text_layout_algorithm.h"
#include "core/style/ComputedStyle.h"
+#include "platform/testing/FontTestHelpers.h"
+#include "platform/testing/UnitTestHelpers.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace blink {
@@ -54,13 +56,17 @@ class NGInlineNodeForTest : public NGInlineNode {
is_bidi_enabled_ = true;
NGInlineNode::SegmentText();
}
+
+ using NGInlineNode::ShapeText;
};
class NGInlineNodeTest : public ::testing::Test {
protected:
void SetUp() override {
style_ = ComputedStyle::create();
- style_->font().update(nullptr);
+ Font font = testing::createTestFont(
+ "Ahem", testing::platformTestDataPath("Ahem.woff"), 10);
+ style_->setFont(font);
}
void CreateLine(NGInlineNode* node,
@@ -202,4 +208,15 @@ TEST_F(NGInlineNodeTest, CreateLineBidiIsolate) {
TEST_TEXT_FRAGMENT(fragments[4], node, 8u, 22u, 28u, TextDirection::kLtr);
}
+TEST_F(NGInlineNodeTest, MinAndMaxContentSizes) {
+ NGInlineNodeForTest* node = new NGInlineNodeForTest(style_.get());
+ node->Append("AB CDE", style_.get());
+ node->ShapeText();
+ MinAndMaxContentSizes sizes = node->ComputeMinAndMaxContentSizes();
+ // min_content should be 20, but is 30 until
+ // NGLineBuilder::SetStartOfHangables() is implemented.
+ EXPECT_EQ(30, sizes.min_content);
+ EXPECT_EQ(60, sizes.max_content);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698