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

Side by Side Diff: tests/FontHostTest.cpp

Issue 43463005: onCharsToGlyphs to handle non-bmp on Mac. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/ports/SkFontHost_mac.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 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Test.h" 8 #include "Test.h"
9 #include "SkPaint.h" 9 #include "SkPaint.h"
10 #include "SkFontStream.h" 10 #include "SkFontStream.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 tableGlyphs = SkEndian_SwapBE16(rawGlyphs); 65 tableGlyphs = SkEndian_SwapBE16(rawGlyphs);
66 } 66 }
67 67
68 if (tableGlyphs >= 0) { 68 if (tableGlyphs >= 0) {
69 REPORTER_ASSERT(reporter, tableGlyphs == nativeGlyphs); 69 REPORTER_ASSERT(reporter, tableGlyphs == nativeGlyphs);
70 } else { 70 } else {
71 // not sure this is a bug, but lets report it for now as info. 71 // not sure this is a bug, but lets report it for now as info.
72 SkDebugf("--- typeface returned 0 glyphs [%X]\n", face->uniqueID()); 72 SkDebugf("--- typeface returned 0 glyphs [%X]\n", face->uniqueID());
73 } 73 }
74 } 74 }
75 #if 0 75
76 // The following three are all the same code points in various encodings. 76 // The following three are all the same code points in various encodings.
77 static uint8_t utf8Chars[] = { 0x61, 0xE4, 0xB8, 0xAD, 0xD0, 0xAF, 0xD7, 0x99, 0 xD7, 0x95, 0xF0, 0x9D, 0x84, 0x9E, 0x61 }; 77 static uint8_t utf8Chars[] = { 0x61, 0xE4, 0xB8, 0xAD, 0xD0, 0xAF, 0xD7, 0x99, 0 xD7, 0x95, 0xF0, 0x9D, 0x84, 0x9E, 0x61 };
78 static uint16_t utf16Chars[] = { 0x0061, 0x4E2D, 0x042F, 0x05D9, 0x05D5, 0xD834, 0xDD1E, 0x0061 }; 78 static uint16_t utf16Chars[] = { 0x0061, 0x4E2D, 0x042F, 0x05D9, 0x05D5, 0xD834, 0xDD1E, 0x0061 };
79 static uint32_t utf32Chars[] = { 0x00000061, 0x00004E2D, 0x0000042F, 0x000005D9, 0x000005D5, 0x0001D11E, 0x00000061 }; 79 static uint32_t utf32Chars[] = { 0x00000061, 0x00004E2D, 0x0000042F, 0x000005D9, 0x000005D5, 0x0001D11E, 0x00000061 };
80 80
81 struct CharsToGlyphs_TestData { 81 struct CharsToGlyphs_TestData {
82 const void* chars; 82 const void* chars;
83 int charCount; 83 int charCount;
84 size_t charsByteLength; 84 size_t charsByteLength;
85 SkTypeface::Encoding typefaceEncoding; 85 SkTypeface::Encoding typefaceEncoding;
(...skipping 22 matching lines...) Expand all
108 for (int i = 0; i < test.charCount; ++i) { 108 for (int i = 0; i < test.charCount; ++i) {
109 SkString name; 109 SkString name;
110 face->getFamilyName(&name); 110 face->getFamilyName(&name);
111 SkString a; 111 SkString a;
112 a.appendf("%s, paintGlyphIds[%d] = %d, faceGlyphIds[%d] = %d, face = %s", 112 a.appendf("%s, paintGlyphIds[%d] = %d, faceGlyphIds[%d] = %d, face = %s",
113 test.name, i, (int)paintGlyphIds[i], i, (int)faceGlyphIds[ i], name.c_str()); 113 test.name, i, (int)paintGlyphIds[i], i, (int)faceGlyphIds[ i], name.c_str());
114 REPORTER_ASSERT_MESSAGE(reporter, paintGlyphIds[i] == faceGlyphIds[i ], a.c_str()); 114 REPORTER_ASSERT_MESSAGE(reporter, paintGlyphIds[i] == faceGlyphIds[i ], a.c_str());
115 } 115 }
116 } 116 }
117 } 117 }
118 #endif
119 118
120 static void test_fontstream(skiatest::Reporter* reporter, 119 static void test_fontstream(skiatest::Reporter* reporter,
121 SkStream* stream, int ttcIndex) { 120 SkStream* stream, int ttcIndex) {
122 int n = SkFontStream::GetTableTags(stream, ttcIndex, NULL); 121 int n = SkFontStream::GetTableTags(stream, ttcIndex, NULL);
123 SkAutoTArray<SkFontTableTag> array(n); 122 SkAutoTArray<SkFontTableTag> array(n);
124 123
125 int n2 = SkFontStream::GetTableTags(stream, ttcIndex, array.get()); 124 int n2 = SkFontStream::GetTableTags(stream, ttcIndex, array.get());
126 REPORTER_ASSERT(reporter, n == n2); 125 REPORTER_ASSERT(reporter, n == n2);
127 126
128 for (int i = 0; i < n; ++i) { 127 for (int i = 0; i < n; ++i) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 222
224 for (size_t i = 0; i < SK_ARRAY_COUNT(gNames); ++i) { 223 for (size_t i = 0; i < SK_ARRAY_COUNT(gNames); ++i) {
225 SkAutoTUnref<SkTypeface> face(SkTypeface::CreateFromName(gNames[i], SkTy peface::kNormal)); 224 SkAutoTUnref<SkTypeface> face(SkTypeface::CreateFromName(gNames[i], SkTy peface::kNormal));
226 if (face) { 225 if (face) {
227 #ifdef DUMP_TABLES 226 #ifdef DUMP_TABLES
228 SkDebugf("%s\n", gNames[i]); 227 SkDebugf("%s\n", gNames[i]);
229 #endif 228 #endif
230 test_tables(reporter, face); 229 test_tables(reporter, face);
231 test_unitsPerEm(reporter, face); 230 test_unitsPerEm(reporter, face);
232 test_countGlyphs(reporter, face); 231 test_countGlyphs(reporter, face);
233 //test_charsToGlyphs(reporter, face); 232 test_charsToGlyphs(reporter, face);
234 } 233 }
235 } 234 }
236 } 235 }
237 236
238 /* 237 /*
239 * Verifies that the advance values returned by generateAdvance and 238 * Verifies that the advance values returned by generateAdvance and
240 * generateMetrics match. 239 * generateMetrics match.
241 */ 240 */
242 static void test_advances(skiatest::Reporter* reporter) { 241 static void test_advances(skiatest::Reporter* reporter) {
243 static const char* const faces[] = { 242 static const char* const faces[] = {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 static void TestFontHost(skiatest::Reporter* reporter) { 308 static void TestFontHost(skiatest::Reporter* reporter) {
310 test_tables(reporter); 309 test_tables(reporter);
311 test_fontstream(reporter); 310 test_fontstream(reporter);
312 test_advances(reporter); 311 test_advances(reporter);
313 } 312 }
314 313
315 // need tests for SkStrSearch 314 // need tests for SkStrSearch
316 315
317 #include "TestClassDef.h" 316 #include "TestClassDef.h"
318 DEFINE_TESTCLASS("FontHost", FontHostTestClass, TestFontHost) 317 DEFINE_TESTCLASS("FontHost", FontHostTestClass, TestFontHost)
OLDNEW
« no previous file with comments | « src/ports/SkFontHost_mac.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698