| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 "platform/fonts/shaping/CachingWordShaper.h" | 5 #include "platform/fonts/shaping/CachingWordShaper.h" |
| 6 | 6 |
| 7 #include "platform/fonts/CharacterRange.h" | 7 #include "platform/fonts/CharacterRange.h" |
| 8 #include "platform/fonts/FontCache.h" | 8 #include "platform/fonts/FontCache.h" |
| 9 #include "platform/fonts/GlyphBuffer.h" | 9 #include "platform/fonts/GlyphBuffer.h" |
| 10 #include "platform/fonts/shaping/CachingWordShapeIterator.h" | 10 #include "platform/fonts/shaping/CachingWordShapeIterator.h" |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 | 438 |
| 439 ASSERT_TRUE(iterator.next(&wordResult)); | 439 ASSERT_TRUE(iterator.next(&wordResult)); |
| 440 EXPECT_EQ(1u, wordResult->numCharacters()); | 440 EXPECT_EQ(1u, wordResult->numCharacters()); |
| 441 | 441 |
| 442 ASSERT_TRUE(iterator.next(&wordResult)); | 442 ASSERT_TRUE(iterator.next(&wordResult)); |
| 443 EXPECT_EQ(2u, wordResult->numCharacters()); | 443 EXPECT_EQ(2u, wordResult->numCharacters()); |
| 444 | 444 |
| 445 ASSERT_FALSE(iterator.next(&wordResult)); | 445 ASSERT_FALSE(iterator.next(&wordResult)); |
| 446 } | 446 } |
| 447 | 447 |
| 448 TEST_F(CachingWordShaperTest, SegmentCJKSmallFormVariants) |
| 449 { |
| 450 const UChar str[] = { |
| 451 0x5916, // CJK UNIFIED IDEOGRPAH |
| 452 0xFE50, // SMALL COMMA |
| 453 0x0 |
| 454 }; |
| 455 TextRun textRun(str, 2); |
| 456 |
| 457 RefPtr<ShapeResult> wordResult; |
| 458 CachingWordShapeIterator iterator(cache.get(), textRun, &font); |
| 459 |
| 460 ASSERT_TRUE(iterator.next(&wordResult)); |
| 461 EXPECT_EQ(2u, wordResult->numCharacters()); |
| 462 |
| 463 ASSERT_FALSE(iterator.next(&wordResult)); |
| 464 } |
| 465 |
| 448 TEST_F(CachingWordShaperTest, TextOrientationFallbackShouldNotInFallbackList) | 466 TEST_F(CachingWordShaperTest, TextOrientationFallbackShouldNotInFallbackList) |
| 449 { | 467 { |
| 450 const UChar str[] = { | 468 const UChar str[] = { |
| 451 'A', // code point for verticalRightOrientationFontData() | 469 'A', // code point for verticalRightOrientationFontData() |
| 452 // Ideally we'd like to test uprightOrientationFontData() too | 470 // Ideally we'd like to test uprightOrientationFontData() too |
| 453 // using code point such as U+3042, but it'd fallback to system | 471 // using code point such as U+3042, but it'd fallback to system |
| 454 // fonts as the glyph is missing. | 472 // fonts as the glyph is missing. |
| 455 0x0 | 473 0x0 |
| 456 }; | 474 }; |
| 457 TextRun textRun(str, 1); | 475 TextRun textRun(str, 1); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 481 float periodsAndSpacesWidth = shaper.width(&font, periodsAndSpaces, nullptr,
&periodsAndSpacesGlyphBounds); | 499 float periodsAndSpacesWidth = shaper.width(&font, periodsAndSpaces, nullptr,
&periodsAndSpacesGlyphBounds); |
| 482 | 500 |
| 483 // The total width of periods and spaces should be longer than the width of
periods alone. | 501 // The total width of periods and spaces should be longer than the width of
periods alone. |
| 484 ASSERT_GT(periodsAndSpacesWidth, periodsWidth); | 502 ASSERT_GT(periodsAndSpacesWidth, periodsWidth); |
| 485 | 503 |
| 486 // The glyph bounds of periods and spaces should be longer than the glyph bo
unds of periods alone. | 504 // The glyph bounds of periods and spaces should be longer than the glyph bo
unds of periods alone. |
| 487 ASSERT_GT(periodsAndSpacesGlyphBounds.width(), periodsGlyphBounds.width()); | 505 ASSERT_GT(periodsAndSpacesGlyphBounds.width(), periodsGlyphBounds.width()); |
| 488 } | 506 } |
| 489 | 507 |
| 490 } // namespace blink | 508 } // namespace blink |
| OLD | NEW |