| OLD | NEW |
| 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/inline/ng_inline_items_builder.h" | 5 #include "core/layout/ng/inline/ng_inline_items_builder.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutInline.h" | 7 #include "core/layout/LayoutInline.h" |
| 8 #include "core/layout/ng/inline/ng_inline_node.h" | 8 #include "core/layout/ng/inline/ng_inline_node.h" |
| 9 #include "core/style/ComputedStyle.h" | 9 #include "core/style/ComputedStyle.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 EXPECT_EQ(nullptr, items_[0].Style()); | 238 EXPECT_EQ(nullptr, items_[0].Style()); |
| 239 EXPECT_EQ(style_.Get(), items_[1].Style()); | 239 EXPECT_EQ(style_.Get(), items_[1].Style()); |
| 240 EXPECT_EQ(nullptr, items_[2].Style()); | 240 EXPECT_EQ(nullptr, items_[2].Style()); |
| 241 } | 241 } |
| 242 | 242 |
| 243 TEST_F(NGInlineItemsBuilderTest, AppendEmptyString) { | 243 TEST_F(NGInlineItemsBuilderTest, AppendEmptyString) { |
| 244 EXPECT_EQ("", TestAppend("")); | 244 EXPECT_EQ("", TestAppend("")); |
| 245 EXPECT_EQ(0u, items_.size()); | 245 EXPECT_EQ(0u, items_.size()); |
| 246 } | 246 } |
| 247 | 247 |
| 248 TEST_F(NGInlineItemsBuilderTest, NewLines) { |
| 249 SetWhiteSpace(EWhiteSpace::kPre); |
| 250 EXPECT_EQ("apple\norange\ngrape\n", TestAppend("apple\norange\ngrape\n")); |
| 251 EXPECT_EQ(6u, items_.size()); |
| 252 EXPECT_EQ(NGInlineItem::kText, items_[0].Type()); |
| 253 EXPECT_EQ(NGInlineItem::kControl, items_[1].Type()); |
| 254 EXPECT_EQ(NGInlineItem::kText, items_[2].Type()); |
| 255 EXPECT_EQ(NGInlineItem::kControl, items_[3].Type()); |
| 256 EXPECT_EQ(NGInlineItem::kText, items_[4].Type()); |
| 257 EXPECT_EQ(NGInlineItem::kControl, items_[5].Type()); |
| 258 } |
| 259 |
| 248 TEST_F(NGInlineItemsBuilderTest, Empty) { | 260 TEST_F(NGInlineItemsBuilderTest, Empty) { |
| 249 Vector<NGInlineItem> items; | 261 Vector<NGInlineItem> items; |
| 250 NGInlineItemsBuilder builder(&items); | 262 NGInlineItemsBuilder builder(&items); |
| 251 RefPtr<ComputedStyle> block_style(ComputedStyle::Create()); | 263 RefPtr<ComputedStyle> block_style(ComputedStyle::Create()); |
| 252 builder.EnterBlock(block_style.Get()); | 264 builder.EnterBlock(block_style.Get()); |
| 253 builder.ExitBlock(); | 265 builder.ExitBlock(); |
| 254 | 266 |
| 255 EXPECT_EQ("", builder.ToString()); | 267 EXPECT_EQ("", builder.ToString()); |
| 256 } | 268 } |
| 257 | 269 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 u"\u2068\u202E" | 338 u"\u2068\u202E" |
| 327 u"\u05E2\u05D1\u05E8\u05D9\u05EA" | 339 u"\u05E2\u05D1\u05E8\u05D9\u05EA" |
| 328 u"\u202C\u2069" | 340 u"\u202C\u2069" |
| 329 u" World"), | 341 u" World"), |
| 330 builder.ToString()); | 342 builder.ToString()); |
| 331 } | 343 } |
| 332 | 344 |
| 333 } // namespace | 345 } // namespace |
| 334 | 346 |
| 335 } // namespace blink | 347 } // namespace blink |
| OLD | NEW |