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

Unified Diff: third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp

Issue 2835103002: Move blobalizer implementation to ShapeResultBloberizer (Closed)
Patch Set: Fix canvas tests Created 3 years, 8 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/platform/fonts/shaping/CachingWordShaperTest.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp
index 1de40214246bff0f0b317be813826aaa7adacb4d..fd2d7d71e1d91960e0ff1649c901408f7d1d4913 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp
@@ -5,7 +5,6 @@
#include "platform/fonts/shaping/CachingWordShaper.h"
#include <memory>
-#include "platform/fonts/CharacterRange.h"
#include "platform/fonts/FontCache.h"
#include "platform/fonts/shaping/CachingWordShapeIterator.h"
#include "platform/fonts/shaping/ShapeResultTestInfo.h"
@@ -108,89 +107,6 @@ TEST_F(CachingWordShaperTest, CommonAccentLeftToRightByWord) {
ASSERT_FALSE(iterator.Next(&result));
}
-// Tests that filling a glyph buffer for a specific range returns the same
-// results when shaping word by word as when shaping the full run in one go.
-TEST_F(CachingWordShaperTest, CommonAccentLeftToRightFillGlyphBuffer) {
- // "/. ." with an accent mark over the first dot.
- const UChar kStr[] = {0x2F, 0x301, 0x2E, 0x20, 0x2E, 0x0};
- TextRun text_run(kStr, 5);
- TextRunPaintInfo run_info(text_run);
- run_info.to = 3;
-
- ShapeResultBloberizer bloberizer(font, 1);
- CachingWordShaper(font).FillGlyphs(run_info, bloberizer);
-
- Font reference_font(font_description);
- reference_font.Update(nullptr);
- reference_font.SetCanShapeWordByWordForTesting(false);
- ShapeResultBloberizer reference_bloberizer(reference_font, 1);
- CachingWordShaper(reference_font).FillGlyphs(run_info, reference_bloberizer);
-
- const auto& glyphs =
- ShapeResultBloberizerTestInfo::PendingRunGlyphs(bloberizer);
- ASSERT_EQ(glyphs.size(), 3ul);
- const auto reference_glyphs =
- ShapeResultBloberizerTestInfo::PendingRunGlyphs(reference_bloberizer);
- ASSERT_EQ(reference_glyphs.size(), 3ul);
-
- EXPECT_EQ(reference_glyphs[0], glyphs[0]);
- EXPECT_EQ(reference_glyphs[1], glyphs[1]);
- EXPECT_EQ(reference_glyphs[2], glyphs[2]);
-}
-
-// Tests that filling a glyph buffer for a specific range returns the same
-// results when shaping word by word as when shaping the full run in one go.
-TEST_F(CachingWordShaperTest, CommonAccentRightToLeftFillGlyphBuffer) {
- // "[] []" with an accent mark over the last square bracket.
- const UChar kStr[] = {0x5B, 0x5D, 0x20, 0x5B, 0x301, 0x5D, 0x0};
- TextRun text_run(kStr, 6);
- text_run.SetDirection(TextDirection::kRtl);
- TextRunPaintInfo run_info(text_run);
- run_info.from = 1;
-
- ShapeResultBloberizer bloberizer(font, 1);
- CachingWordShaper(font).FillGlyphs(run_info, bloberizer);
-
- Font reference_font(font_description);
- reference_font.Update(nullptr);
- reference_font.SetCanShapeWordByWordForTesting(false);
- ShapeResultBloberizer reference_bloberizer(reference_font, 1);
- CachingWordShaper(reference_font).FillGlyphs(run_info, reference_bloberizer);
-
- const auto& glyphs =
- ShapeResultBloberizerTestInfo::PendingRunGlyphs(bloberizer);
- ASSERT_EQ(5u, glyphs.size());
- const auto reference_glyphs =
- ShapeResultBloberizerTestInfo::PendingRunGlyphs(reference_bloberizer);
- ASSERT_EQ(5u, reference_glyphs.size());
-
- EXPECT_EQ(reference_glyphs[0], glyphs[0]);
- EXPECT_EQ(reference_glyphs[1], glyphs[1]);
- EXPECT_EQ(reference_glyphs[2], glyphs[2]);
- EXPECT_EQ(reference_glyphs[3], glyphs[3]);
- EXPECT_EQ(reference_glyphs[4], glyphs[4]);
-}
-
-// Tests that runs with zero glyphs (the ZWJ non-printable character in this
-// case) are handled correctly. This test passes if it does not cause a crash.
-TEST_F(CachingWordShaperTest, SubRunWithZeroGlyphs) {
- // "Foo &zwnj; bar"
- const UChar kStr[] = {0x46, 0x6F, 0x6F, 0x20, 0x200C,
- 0x20, 0x62, 0x61, 0x71, 0x0};
- TextRun text_run(kStr, 9);
-
- CachingWordShaper shaper(font);
- FloatRect glyph_bounds;
- ASSERT_GT(shaper.Width(text_run, nullptr, &glyph_bounds), 0);
-
- ShapeResultBloberizer bloberizer(font, 1);
- TextRunPaintInfo run_info(text_run);
- run_info.to = 8;
- shaper.FillGlyphs(run_info, bloberizer);
-
- shaper.GetCharacterRange(text_run, 0, 8);
-}
-
TEST_F(CachingWordShaperTest, SegmentCJKByCharacter) {
const UChar kStr[] = {0x56FD, 0x56FD, // CJK Unified Ideograph
'a', 'b',

Powered by Google App Engine
This is Rietveld 408576698