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

Unified Diff: tests/FontConfigParser.cpp

Issue 925933003: Verify all parsed test font files start with cap. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ports/SkFontConfigParser_android.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/FontConfigParser.cpp
diff --git a/tests/FontConfigParser.cpp b/tests/FontConfigParser.cpp
index dc1fac0547ba44b0eb09fac6dd7ee99b5aecf34b..35cc4d098c0ab95369913e9988ac36af01876d18 100644
--- a/tests/FontConfigParser.cpp
+++ b/tests/FontConfigParser.cpp
@@ -48,6 +48,19 @@ void ValidateLoadedFonts(SkTDArray<FontFamily*> fontFamilies, const char* firstE
REPORTER_ASSERT(reporter, isALPHA(c) || isDIGIT(c) || '-' == c);
}
}
+
+ // All file names in the test configuration files start with a capital letter.
+ // This is not a general requirement, but it is true of all the test configuration data.
+ // Verifying ensures the filenames have been read sanely and have not been 'sliced'.
+ for (int i = 0; i < fontFamilies.count(); ++i) {
+ FontFamily& family = *fontFamilies[i];
+ for (int j = 0; j < family.fFonts.count(); ++j) {
+ FontFileInfo& file = family.fFonts[j];
+ REPORTER_ASSERT(reporter, !file.fFileName.isEmpty() &&
+ file.fFileName[0] >= 'A' &&
+ file.fFileName[0] <= 'Z');
+ }
+ }
}
void DumpLoadedFonts(SkTDArray<FontFamily*> fontFamilies) {
« no previous file with comments | « src/ports/SkFontConfigParser_android.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698