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

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

Issue 2721613003: [LayoutNG] Move remaining ng_units structs to their own files (Closed)
Patch Set: Don't export NGBoxStrut for now Created 3 years, 9 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_inline_node.h" 5 #include "core/layout/ng/ng_inline_node.h"
6 6
7 #include "core/layout/LayoutTestHelper.h" 7 #include "core/layout/LayoutTestHelper.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_constraint_space_builder.h" 9 #include "core/layout/ng/ng_constraint_space_builder.h"
10 #include "core/layout/ng/ng_fragment_builder.h" 10 #include "core/layout/ng/ng_fragment_builder.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 Vector<RefPtr<const NGPhysicalTextFragment>> fragments; 209 Vector<RefPtr<const NGPhysicalTextFragment>> fragments;
210 CreateLine(node, &fragments); 210 CreateLine(node, &fragments);
211 ASSERT_EQ(5u, fragments.size()); 211 ASSERT_EQ(5u, fragments.size());
212 TEST_TEXT_FRAGMENT(fragments[0], node, 0u, 0u, 6u, TextDirection::kLtr); 212 TEST_TEXT_FRAGMENT(fragments[0], node, 0u, 0u, 6u, TextDirection::kLtr);
213 TEST_TEXT_FRAGMENT(fragments[1], node, 6u, 16u, 21u, TextDirection::kRtl); 213 TEST_TEXT_FRAGMENT(fragments[1], node, 6u, 16u, 21u, TextDirection::kRtl);
214 TEST_TEXT_FRAGMENT(fragments[2], node, 4u, 14u, 15u, TextDirection::kLtr); 214 TEST_TEXT_FRAGMENT(fragments[2], node, 4u, 14u, 15u, TextDirection::kLtr);
215 TEST_TEXT_FRAGMENT(fragments[3], node, 2u, 7u, 13u, TextDirection::kRtl); 215 TEST_TEXT_FRAGMENT(fragments[3], node, 2u, 7u, 13u, TextDirection::kRtl);
216 TEST_TEXT_FRAGMENT(fragments[4], node, 8u, 22u, 28u, TextDirection::kLtr); 216 TEST_TEXT_FRAGMENT(fragments[4], node, 8u, 22u, 28u, TextDirection::kLtr);
217 } 217 }
218 218
219 TEST_F(NGInlineNodeTest, MinAndMaxContentSizes) { 219 TEST_F(NGInlineNodeTest, MinMaxContentSize) {
220 setAhemToStyle(); 220 setAhemToStyle();
221 NGInlineNodeForTest* node = new NGInlineNodeForTest(style_.get()); 221 NGInlineNodeForTest* node = new NGInlineNodeForTest(style_.get());
222 node->Append("AB CDE", style_.get()); 222 node->Append("AB CDE", style_.get());
223 node->ShapeText(); 223 node->ShapeText();
224 MinAndMaxContentSizes sizes = node->ComputeMinAndMaxContentSizes(); 224 MinMaxContentSize sizes = node->ComputeMinMaxContentSize();
225 // TODO(kojii): min_content should be 20, but is 30 until NGLineBuilder 225 // TODO(kojii): min_content should be 20, but is 30 until NGLineBuilder
226 // implements trailing spaces correctly. 226 // implements trailing spaces correctly.
227 EXPECT_EQ(30, sizes.min_content); 227 EXPECT_EQ(30, sizes.min_content);
228 EXPECT_EQ(60, sizes.max_content); 228 EXPECT_EQ(60, sizes.max_content);
229 } 229 }
230 230
231 TEST_F(NGInlineNodeTest, MinAndMaxContentSizesElementBoundary) { 231 TEST_F(NGInlineNodeTest, MinMaxContentSizeElementBoundary) {
232 setAhemToStyle(); 232 setAhemToStyle();
233 NGInlineNodeForTest* node = new NGInlineNodeForTest(style_.get()); 233 NGInlineNodeForTest* node = new NGInlineNodeForTest(style_.get());
234 node->Append("A B", style_.get()); 234 node->Append("A B", style_.get());
235 node->Append("C D", style_.get()); 235 node->Append("C D", style_.get());
236 node->ShapeText(); 236 node->ShapeText();
237 MinAndMaxContentSizes sizes = node->ComputeMinAndMaxContentSizes(); 237 MinMaxContentSize sizes = node->ComputeMinMaxContentSize();
238 // |min_content| should be the width of "BC" because there is an element 238 // |min_content| should be the width of "BC" because there is an element
239 // boundary between "B" and "C" but no break opportunities. 239 // boundary between "B" and "C" but no break opportunities.
240 // TODO(kojii): min_content should be 20, but is 30 until NGLineBuilder 240 // TODO(kojii): min_content should be 20, but is 30 until NGLineBuilder
241 // implements trailing spaces correctly. 241 // implements trailing spaces correctly.
242 EXPECT_EQ(30, sizes.min_content); 242 EXPECT_EQ(30, sizes.min_content);
243 EXPECT_EQ(60, sizes.max_content); 243 EXPECT_EQ(60, sizes.max_content);
244 } 244 }
245 245
246 } // namespace blink 246 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698