Index: tests/FontConfigParser.cpp |
diff --git a/tests/FontConfigParser.cpp b/tests/FontConfigParser.cpp |
index 8ca7556df18c124c7ea45e341d37a03a78b9f6ba..86b2b1db904aa97eaa899374b8cd772b0916b120 100644 |
--- a/tests/FontConfigParser.cpp |
+++ b/tests/FontConfigParser.cpp |
@@ -9,6 +9,16 @@ |
#include "SkFontConfigParser_android.h" |
#include "Test.h" |
+int CountFallbacks(SkTDArray<FontFamily*> fontFamilies) { |
+ int countOfFallbackFonts = 0; |
+ for (int i = 0; i < fontFamilies.count(); i++) { |
+ if (fontFamilies[i]->fIsFallbackFont) { |
+ countOfFallbackFonts++; |
+ } |
+ } |
+ return countOfFallbackFonts; |
+} |
+ |
void ValidateLoadedFonts(SkTDArray<FontFamily*> fontFamilies, |
skiatest::Reporter* reporter) { |
REPORTER_ASSERT(reporter, fontFamilies[0]->fNames.count() == 5); |
@@ -17,7 +27,6 @@ void ValidateLoadedFonts(SkTDArray<FontFamily*> fontFamilies, |
!strcmp(fontFamilies[0]->fFonts[0].fFileName.c_str(), |
"Roboto-Regular.ttf")); |
REPORTER_ASSERT(reporter, !fontFamilies[0]->fIsFallbackFont); |
- |
} |
void DumpLoadedFonts(SkTDArray<FontFamily*> fontFamilies) { |
@@ -59,6 +68,7 @@ DEF_TEST(FontConfigParserAndroid, reporter) { |
if (preV17FontFamilies.count() > 0) { |
REPORTER_ASSERT(reporter, preV17FontFamilies.count() == 14); |
+ REPORTER_ASSERT(reporter, CountFallbacks(preV17FontFamilies) == 10); |
DumpLoadedFonts(preV17FontFamilies); |
ValidateLoadedFonts(preV17FontFamilies, reporter); |
@@ -74,6 +84,7 @@ DEF_TEST(FontConfigParserAndroid, reporter) { |
if (v17FontFamilies.count() > 0) { |
REPORTER_ASSERT(reporter, v17FontFamilies.count() == 41); |
+ REPORTER_ASSERT(reporter, CountFallbacks(v17FontFamilies) == 31); |
DumpLoadedFonts(v17FontFamilies); |
ValidateLoadedFonts(v17FontFamilies, reporter); |
@@ -89,6 +100,7 @@ DEF_TEST(FontConfigParserAndroid, reporter) { |
if (v22FontFamilies.count() > 0) { |
REPORTER_ASSERT(reporter, v22FontFamilies.count() == 53); |
+ REPORTER_ASSERT(reporter, CountFallbacks(v22FontFamilies) == 42); |
DumpLoadedFonts(v22FontFamilies); |
ValidateLoadedFonts(v22FontFamilies, reporter); |