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

Side by Side Diff: Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp

Issue 1156763003: Revert of Unicode Variation Selectors support in collectCandidateRuns (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « Source/platform/fonts/shaping/HarfBuzzShaper.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "config.h" 5 #include "config.h"
6 #include "platform/fonts/shaping/HarfBuzzShaper.h" 6 #include "platform/fonts/shaping/HarfBuzzShaper.h"
7 7
8 #include "platform/fonts/Font.h" 8 #include "platform/fonts/Font.h"
9 #include "platform/fonts/FontCache.h" 9 #include "platform/fonts/FontCache.h"
10 #include "platform/fonts/GlyphPage.h" 10 #include "platform/fonts/GlyphPage.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 HarfBuzzShaper shaper(font, leadingCommon); 60 HarfBuzzShaper shaper(font, leadingCommon);
61 shaper.shape(); 61 shaper.shape();
62 62
63 ASSERT_EQ(shaper.numberOfRunsForTesting(), 1u); 63 ASSERT_EQ(shaper.numberOfRunsForTesting(), 1u);
64 ASSERT_EQ(shaper.runInfoForTesting(0, startIndex, numGlyphs, script), true); 64 ASSERT_EQ(shaper.runInfoForTesting(0, startIndex, numGlyphs, script), true);
65 ASSERT_EQ(startIndex, 0u); 65 ASSERT_EQ(startIndex, 0u);
66 ASSERT_EQ(numGlyphs, 8u); 66 ASSERT_EQ(numGlyphs, 8u);
67 ASSERT_EQ(script, HB_SCRIPT_LATIN); 67 ASSERT_EQ(script, HB_SCRIPT_LATIN);
68 } 68 }
69 69
70 TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsUnicodeVariants)
71 {
72 struct {
73 const char* name;
74 UChar string[4];
75 hb_script_t script;
76 } testlist[] = {
77 { "Standard Variants text style", { 0x30, 0xFE0E }, HB_SCRIPT_COMMON },
78 { "Standard Variants emoji style", { 0x203C, 0xFE0F }, HB_SCRIPT_COMMON },
79 { "Standard Variants of Ideograph", { 0x4FAE, 0xFE00 }, HB_SCRIPT_HAN },
80 { "Ideographic Variants", { 0x3402, 0xDB40, 0xDD00 }, HB_SCRIPT_HAN },
81 { "Not-defined Variants", { 0x41, 0xDB40, 0xDDEF }, HB_SCRIPT_LATIN },
82 };
83 for (auto& test : testlist) {
84 TextRun run(test.string, wcslen((const wchar_t*)test.string));
85 HarfBuzzShaper shaper(font, run);
86 shaper.shape();
87 EXPECT_EQ(1u, shaper.numberOfRunsForTesting()) << test.name;
88 ASSERT_TRUE(shaper.runInfoForTesting(0, startIndex, numGlyphs, script)) << test.name;
89 EXPECT_EQ(0u, startIndex) << test.name;
90 // TODO(kojii): HarfBuzzFace does not support UVS yet and numGlyphs beco mes 2
91 // EXPECT_EQ(1u, numGlyphs) << test.name;
92 EXPECT_EQ(test.script, script) << test.name;
93 }
94 }
95
96 TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsDevanagariCommon) 70 TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsDevanagariCommon)
97 { 71 {
98 UChar devanagariCommonString[] = { 0x915, 0x94d, 0x930, 0x28, 0x20, 0x29 }; 72 UChar devanagariCommonString[] = { 0x915, 0x94d, 0x930, 0x28, 0x20, 0x29 };
99 TextRun devanagariCommonLatin(devanagariCommonString, 6); 73 TextRun devanagariCommonLatin(devanagariCommonString, 6);
100 HarfBuzzShaper shaper(font, devanagariCommonLatin); 74 HarfBuzzShaper shaper(font, devanagariCommonLatin);
101 shaper.shape(); 75 shaper.shape();
102 76
103 ASSERT_EQ(shaper.numberOfRunsForTesting(), 2u); 77 ASSERT_EQ(shaper.numberOfRunsForTesting(), 2u);
104 ASSERT_EQ(shaper.runInfoForTesting(0, startIndex, numGlyphs, script), true); 78 ASSERT_EQ(shaper.runInfoForTesting(0, startIndex, numGlyphs, script), true);
105 ASSERT_EQ(startIndex, 0u); 79 ASSERT_EQ(startIndex, 0u);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 shaper.shape(); 147 shaper.shape();
174 148
175 ASSERT_EQ(shaper.numberOfRunsForTesting(), 1u); 149 ASSERT_EQ(shaper.numberOfRunsForTesting(), 1u);
176 ASSERT_EQ(shaper.runInfoForTesting(0, startIndex, numGlyphs, script), true); 150 ASSERT_EQ(shaper.runInfoForTesting(0, startIndex, numGlyphs, script), true);
177 ASSERT_EQ(startIndex, 0u); 151 ASSERT_EQ(startIndex, 0u);
178 ASSERT_EQ(numGlyphs, 3u); 152 ASSERT_EQ(numGlyphs, 3u);
179 ASSERT_EQ(script, HB_SCRIPT_ARABIC); 153 ASSERT_EQ(script, HB_SCRIPT_ARABIC);
180 } 154 }
181 155
182 } 156 }
OLDNEW
« no previous file with comments | « Source/platform/fonts/shaping/HarfBuzzShaper.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698