| 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 "SkCommandLineFlags.h" | 9 #include "SkCommandLineFlags.h" |
| 10 #include "SkFontConfigParser_android.h" | 10 #include "SkFontConfigParser_android.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 REPORTER_ASSERT(reporter, !fontFamilies[0]->fIsFallbackFont); | 41 REPORTER_ASSERT(reporter, !fontFamilies[0]->fIsFallbackFont); |
| 42 | 42 |
| 43 // Check that the languages are all sane. | 43 // Check that the languages are all sane. |
| 44 for (int i = 0; i < fontFamilies.count(); ++i) { | 44 for (int i = 0; i < fontFamilies.count(); ++i) { |
| 45 const SkString& lang = fontFamilies[i]->fLanguage.getTag(); | 45 const SkString& lang = fontFamilies[i]->fLanguage.getTag(); |
| 46 for (size_t j = 0; j < lang.size(); ++j) { | 46 for (size_t j = 0; j < lang.size(); ++j) { |
| 47 int c = lang[j]; | 47 int c = lang[j]; |
| 48 REPORTER_ASSERT(reporter, isALPHA(c) || isDIGIT(c) || '-' == c); | 48 REPORTER_ASSERT(reporter, isALPHA(c) || isDIGIT(c) || '-' == c); |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 |
| 52 // All file names in the test configuration files start with a capital lette
r. |
| 53 // This is not a general requirement, but it is true of all the test configu
ration data. |
| 54 // Verifying ensures the filenames have been read sanely and have not been '
sliced'. |
| 55 for (int i = 0; i < fontFamilies.count(); ++i) { |
| 56 FontFamily& family = *fontFamilies[i]; |
| 57 for (int j = 0; j < family.fFonts.count(); ++j) { |
| 58 FontFileInfo& file = family.fFonts[j]; |
| 59 REPORTER_ASSERT(reporter, !file.fFileName.isEmpty() && |
| 60 file.fFileName[0] >= 'A' && |
| 61 file.fFileName[0] <= 'Z'); |
| 62 } |
| 63 } |
| 51 } | 64 } |
| 52 | 65 |
| 53 void DumpLoadedFonts(SkTDArray<FontFamily*> fontFamilies) { | 66 void DumpLoadedFonts(SkTDArray<FontFamily*> fontFamilies) { |
| 54 if (!FLAGS_verboseFontMgr) { | 67 if (!FLAGS_verboseFontMgr) { |
| 55 return; | 68 return; |
| 56 } | 69 } |
| 57 | 70 |
| 58 for (int i = 0; i < fontFamilies.count(); ++i) { | 71 for (int i = 0; i < fontFamilies.count(); ++i) { |
| 59 SkDebugf("Family %d:\n", i); | 72 SkDebugf("Family %d:\n", i); |
| 60 switch(fontFamilies[i]->fVariant) { | 73 switch(fontFamilies[i]->fVariant) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 ValidateLoadedFonts(v22FontFamilies, "Roboto-Thin.ttf", reporter); | 143 ValidateLoadedFonts(v22FontFamilies, "Roboto-Thin.ttf", reporter); |
| 131 } else { | 144 } else { |
| 132 resourcesMissing = true; | 145 resourcesMissing = true; |
| 133 } | 146 } |
| 134 | 147 |
| 135 if (resourcesMissing) { | 148 if (resourcesMissing) { |
| 136 SkDebugf("---- Resource files missing for FontConfigParser test\n"); | 149 SkDebugf("---- Resource files missing for FontConfigParser test\n"); |
| 137 } | 150 } |
| 138 } | 151 } |
| 139 | 152 |
| OLD | NEW |