| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "Resources.h" | 8 #include "Resources.h" |
| 9 #include "SkFontConfigParser_android.h" | 9 #include "SkFontConfigParser_android.h" |
| 10 #include "Test.h" | 10 #include "Test.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 REPORTER_ASSERT(reporter, | 26 REPORTER_ASSERT(reporter, |
| 27 !strcmp(fontFamilies[0]->fFonts[0].fFileName.c_str(), firstE
xpectedFile)); | 27 !strcmp(fontFamilies[0]->fFonts[0].fFileName.c_str(), firstE
xpectedFile)); |
| 28 REPORTER_ASSERT(reporter, !fontFamilies[0]->fIsFallbackFont); | 28 REPORTER_ASSERT(reporter, !fontFamilies[0]->fIsFallbackFont); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void DumpLoadedFonts(SkTDArray<FontFamily*> fontFamilies) { | 31 void DumpLoadedFonts(SkTDArray<FontFamily*> fontFamilies) { |
| 32 #if SK_DEBUG_FONTS | 32 #if SK_DEBUG_FONTS |
| 33 for (int i = 0; i < fontFamilies.count(); ++i) { | 33 for (int i = 0; i < fontFamilies.count(); ++i) { |
| 34 SkDebugf("Family %d:\n", i); | 34 SkDebugf("Family %d:\n", i); |
| 35 switch(fontFamilies[i]->fVariant) { | 35 switch(fontFamilies[i]->fVariant) { |
| 36 case SkPaintOptionsAndroid::kElegant_Variant: SkDebugf(" elegant");
break; | 36 case kElegant_FontVariant: SkDebugf(" elegant\n"); break; |
| 37 case SkPaintOptionsAndroid::kCompact_Variant: SkDebugf(" compact");
break; | 37 case kCompact_FontVariant: SkDebugf(" compact\n"); break; |
| 38 default: break; | 38 default: break; |
| 39 } | 39 } |
| 40 if (!fontFamilies[i]->fLanguage.getTag().isEmpty()) { | 40 if (!fontFamilies[i]->fLanguage.getTag().isEmpty()) { |
| 41 SkDebugf(" language: %s", fontFamilies[i]->fLanguage.getTag().c_str
()); | 41 SkDebugf(" language %s\n", fontFamilies[i]->fLanguage.getTag().c_st
r()); |
| 42 } | 42 } |
| 43 for (int j = 0; j < fontFamilies[i]->fNames.count(); ++j) { | 43 for (int j = 0; j < fontFamilies[i]->fNames.count(); ++j) { |
| 44 SkDebugf(" name %s\n", fontFamilies[i]->fNames[j].c_str()); | 44 SkDebugf(" name %s\n", fontFamilies[i]->fNames[j].c_str()); |
| 45 } | 45 } |
| 46 for (int j = 0; j < fontFamilies[i]->fFonts.count(); ++j) { | 46 for (int j = 0; j < fontFamilies[i]->fFonts.count(); ++j) { |
| 47 const FontFileInfo& ffi = fontFamilies[i]->fFonts[j]; | 47 const FontFileInfo& ffi = fontFamilies[i]->fFonts[j]; |
| 48 SkDebugf(" file (%d %s %d) %s\n", | 48 SkDebugf(" file (%d) %s#%d\n", ffi.fWeight, ffi.fFileName.c_str(),
ffi.fIndex); |
| 49 ffi.fWeight, | |
| 50 ffi.fPaintOptions.getLanguage().getTag().isEmpty() ? "" : | |
| 51 ffi.fPaintOptions.getLanguage().getTag().c_str(), | |
| 52 ffi.fPaintOptions.getFontVariant(), | |
| 53 ffi.fFileName.c_str()); | |
| 54 } | 49 } |
| 55 } | 50 } |
| 56 #endif // SK_DEBUG_FONTS | 51 #endif // SK_DEBUG_FONTS |
| 57 } | 52 } |
| 58 | 53 |
| 59 DEF_TEST(FontConfigParserAndroid, reporter) { | 54 DEF_TEST(FontConfigParserAndroid, reporter) { |
| 60 | 55 |
| 61 bool resourcesMissing = false; | 56 bool resourcesMissing = false; |
| 62 | 57 |
| 63 SkTDArray<FontFamily*> preV17FontFamilies; | 58 SkTDArray<FontFamily*> preV17FontFamilies; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 ValidateLoadedFonts(v22FontFamilies, "Roboto-Thin.ttf", reporter); | 100 ValidateLoadedFonts(v22FontFamilies, "Roboto-Thin.ttf", reporter); |
| 106 } else { | 101 } else { |
| 107 resourcesMissing = true; | 102 resourcesMissing = true; |
| 108 } | 103 } |
| 109 | 104 |
| 110 if (resourcesMissing) { | 105 if (resourcesMissing) { |
| 111 SkDebugf("---- Resource files missing for FontConfigParser test\n"); | 106 SkDebugf("---- Resource files missing for FontConfigParser test\n"); |
| 112 } | 107 } |
| 113 } | 108 } |
| 114 | 109 |
| OLD | NEW |