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

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

Issue 1192473003: Revert "Add Unicode Variation Selector support to harfBuzzGetGlyph" (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.h ('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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 { "Not-defined Variants", { 0x41, 0xDB40, 0xDDEF }, HB_SCRIPT_LATIN }, 78 { "Not-defined Variants", { 0x41, 0xDB40, 0xDDEF }, HB_SCRIPT_LATIN },
79 }; 79 };
80 for (auto& test : testlist) { 80 for (auto& test : testlist) {
81 String str(test.string); 81 String str(test.string);
82 TextRun run(str); 82 TextRun run(str);
83 HarfBuzzShaper shaper(font, run); 83 HarfBuzzShaper shaper(font, run);
84 shaper.shape(); 84 shaper.shape();
85 EXPECT_EQ(1u, shaper.numberOfRunsForTesting()) << test.name; 85 EXPECT_EQ(1u, shaper.numberOfRunsForTesting()) << test.name;
86 ASSERT_TRUE(shaper.runInfoForTesting(0, startIndex, numGlyphs, script)) << test.name; 86 ASSERT_TRUE(shaper.runInfoForTesting(0, startIndex, numGlyphs, script)) << test.name;
87 EXPECT_EQ(0u, startIndex) << test.name; 87 EXPECT_EQ(0u, startIndex) << test.name;
88 if (numGlyphs == 2) { 88 // TODO(kojii): HarfBuzzFace does not support UVS yet and numGlyphs beco mes 2
89 // If the specified VS is not in the font, it's mapped to .notdef. 89 // EXPECT_EQ(1u, numGlyphs) << test.name;
90 // then hb_ot_hide_default_ignorables() swaps it to a space with zer o-advance.
91 // http://lists.freedesktop.org/archives/harfbuzz/2015-May/004888.ht ml
92 // OpenType recommends Glyph ID 3 for a space; not a hard requiremen t though.
93 // https://www.microsoft.com/typography/otspec/recom.htm
94 #if !OS(MACOSX)
95 EXPECT_EQ(3u, shaper.glyphForTesting(0, 1)) << test.name;
96 #endif
97 EXPECT_EQ(0.f, shaper.advanceForTesting(0, 1)) << test.name;
98 } else {
99 EXPECT_EQ(1u, numGlyphs) << test.name;
100 }
101 EXPECT_EQ(test.script, script) << test.name; 90 EXPECT_EQ(test.script, script) << test.name;
102 } 91 }
103 } 92 }
104 93
105 TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsDevanagariCommon) 94 TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsDevanagariCommon)
106 { 95 {
107 UChar devanagariCommonString[] = { 0x915, 0x94d, 0x930, 0x28, 0x20, 0x29 }; 96 UChar devanagariCommonString[] = { 0x915, 0x94d, 0x930, 0x28, 0x20, 0x29 };
108 TextRun devanagariCommonLatin(devanagariCommonString, 6); 97 TextRun devanagariCommonLatin(devanagariCommonString, 6);
109 HarfBuzzShaper shaper(font, devanagariCommonLatin); 98 HarfBuzzShaper shaper(font, devanagariCommonLatin);
110 shaper.shape(); 99 shaper.shape();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 shaper.shape(); 171 shaper.shape();
183 172
184 EXPECT_EQ(1u, shaper.numberOfRunsForTesting()); 173 EXPECT_EQ(1u, shaper.numberOfRunsForTesting());
185 ASSERT_TRUE(shaper.runInfoForTesting(0, startIndex, numGlyphs, script)); 174 ASSERT_TRUE(shaper.runInfoForTesting(0, startIndex, numGlyphs, script));
186 EXPECT_EQ(0u, startIndex); 175 EXPECT_EQ(0u, startIndex);
187 EXPECT_EQ(3u, numGlyphs); 176 EXPECT_EQ(3u, numGlyphs);
188 EXPECT_EQ(HB_SCRIPT_ARABIC, script); 177 EXPECT_EQ(HB_SCRIPT_ARABIC, script);
189 } 178 }
190 179
191 } // namespace blink 180 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/fonts/shaping/HarfBuzzShaper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698