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

Unified Diff: tests/FontConfigParser.cpp

Issue 468893002: Mark fallback fonts in new Android font config parser (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 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);
« 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