| 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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 | 456 |
| 457 RefPtr<ShapeResult> wordResult; | 457 RefPtr<ShapeResult> wordResult; |
| 458 CachingWordShapeIterator iterator(cache.get(), textRun, &font); | 458 CachingWordShapeIterator iterator(cache.get(), textRun, &font); |
| 459 | 459 |
| 460 ASSERT_TRUE(iterator.next(&wordResult)); | 460 ASSERT_TRUE(iterator.next(&wordResult)); |
| 461 EXPECT_EQ(2u, wordResult->numCharacters()); | 461 EXPECT_EQ(2u, wordResult->numCharacters()); |
| 462 | 462 |
| 463 ASSERT_FALSE(iterator.next(&wordResult)); | 463 ASSERT_FALSE(iterator.next(&wordResult)); |
| 464 } | 464 } |
| 465 | 465 |
| 466 TEST_F(CachingWordShaperTest, SegmentHangulToneMark) |
| 467 { |
| 468 const UChar str[] = { |
| 469 0xC740, // HANGUL SYLLABLE EUN |
| 470 0x302E, // HANGUL SINGLE DOT TONE MARK |
| 471 0x0 |
| 472 }; |
| 473 TextRun textRun(str, 2); |
| 474 |
| 475 RefPtr<ShapeResult> wordResult; |
| 476 CachingWordShapeIterator iterator(cache.get(), textRun, &font); |
| 477 |
| 478 ASSERT_TRUE(iterator.next(&wordResult)); |
| 479 EXPECT_EQ(2u, wordResult->numCharacters()); |
| 480 |
| 481 ASSERT_FALSE(iterator.next(&wordResult)); |
| 482 } |
| 483 |
| 466 TEST_F(CachingWordShaperTest, TextOrientationFallbackShouldNotInFallbackList) | 484 TEST_F(CachingWordShaperTest, TextOrientationFallbackShouldNotInFallbackList) |
| 467 { | 485 { |
| 468 const UChar str[] = { | 486 const UChar str[] = { |
| 469 'A', // code point for verticalRightOrientationFontData() | 487 'A', // code point for verticalRightOrientationFontData() |
| 470 // Ideally we'd like to test uprightOrientationFontData() too | 488 // Ideally we'd like to test uprightOrientationFontData() too |
| 471 // using code point such as U+3042, but it'd fallback to system | 489 // using code point such as U+3042, but it'd fallback to system |
| 472 // fonts as the glyph is missing. | 490 // fonts as the glyph is missing. |
| 473 0x0 | 491 0x0 |
| 474 }; | 492 }; |
| 475 TextRun textRun(str, 1); | 493 TextRun textRun(str, 1); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 499 float periodsAndSpacesWidth = shaper.width(&font, periodsAndSpaces, nullptr,
&periodsAndSpacesGlyphBounds); | 517 float periodsAndSpacesWidth = shaper.width(&font, periodsAndSpaces, nullptr,
&periodsAndSpacesGlyphBounds); |
| 500 | 518 |
| 501 // The total width of periods and spaces should be longer than the width of
periods alone. | 519 // The total width of periods and spaces should be longer than the width of
periods alone. |
| 502 ASSERT_GT(periodsAndSpacesWidth, periodsWidth); | 520 ASSERT_GT(periodsAndSpacesWidth, periodsWidth); |
| 503 | 521 |
| 504 // The glyph bounds of periods and spaces should be longer than the glyph bo
unds of periods alone. | 522 // The glyph bounds of periods and spaces should be longer than the glyph bo
unds of periods alone. |
| 505 ASSERT_GT(periodsAndSpacesGlyphBounds.width(), periodsGlyphBounds.width()); | 523 ASSERT_GT(periodsAndSpacesGlyphBounds.width(), periodsGlyphBounds.width()); |
| 506 } | 524 } |
| 507 | 525 |
| 508 } // namespace blink | 526 } // namespace blink |
| OLD | NEW |