OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 2014 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #include "SkFontConfigParser_android.h" | |
9 #include "Test.h" | |
10 | |
11 void ValidateLoadedFonts(SkTDArray<FontFamily*> fontFamilies, | |
12 skiatest::Reporter* reporter) { | |
13 SkDebugf(" .. validating:"); | |
djsollen
2014/08/04 18:13:36
remove
tomhudson
2014/08/04 21:03:57
Done.
| |
14 REPORTER_ASSERT(reporter, fontFamilies[0]->fNames.count() == 5); | |
15 REPORTER_ASSERT(reporter, !strcmp(fontFamilies[0]->fNames[0].c_str(), "sans- serif")); | |
16 REPORTER_ASSERT(reporter, | |
17 !strcmp(fontFamilies[0]->fFontFiles[0].fFileName.c_str(), | |
18 "Roboto-Regular.ttf")); | |
19 REPORTER_ASSERT(reporter, !fontFamilies[0]->fIsFallbackFont); | |
20 | |
21 } | |
22 | |
23 void DumpLoadedFonts(SkTDArray<FontFamily*> fontFamilies) { | |
djsollen
2014/08/04 18:13:35
if you want to keep this function around put it be
tomhudson
2014/08/04 21:03:57
Done.
Reused SK_DEBUG_FONTS instead of creating a
| |
24 SkDebugf(" .. dumping:"); | |
25 for (int i = 0; i < fontFamilies.count(); ++i) { | |
26 SkDebugf("Family %d:\n", i); | |
27 for (int j = 0; j < fontFamilies[i]->fNames.count(); ++j) { | |
28 SkDebugf(" name %s\n", fontFamilies[i]->fNames[j].c_str()); | |
29 } | |
30 } | |
31 } | |
32 | |
33 DEF_TEST(FontConfigParserAndroid, reporter) { | |
34 | |
35 SkTDArray<FontFamily*> preV17FontFamilies; | |
36 SkFontConfigParser::GetTestFontFamilies(preV17FontFamilies, | |
37 "/data/local/tmp/resources/android_fonts/pre_v17/system_fonts.xml", | |
djsollen
2014/08/04 18:13:36
I think there is some kind of GetResourceDir funct
tomhudson
2014/08/04 21:03:57
Done, after much argumentation.
It is now necessa
| |
38 "/data/local/tmp/resources/android_fonts/pre_v17/fallback_fonts.xml"); | |
39 | |
40 REPORTER_ASSERT(reporter, preV17FontFamilies.count() == 14); | |
41 | |
42 DumpLoadedFonts(preV17FontFamilies); | |
43 ValidateLoadedFonts(preV17FontFamilies, reporter); | |
44 | |
45 SkTDArray<FontFamily*> v17FontFamilies; | |
46 SkFontConfigParser::GetTestFontFamilies(v17FontFamilies, | |
47 "/data/local/tmp/resources/android_fonts/v17/system_fonts.xml", | |
48 "/data/local/tmp/resources/android_fonts/v17/fallback_fonts.xml"); | |
49 | |
50 | |
51 REPORTER_ASSERT(reporter, v17FontFamilies.count() == 41); | |
52 | |
53 DumpLoadedFonts(v17FontFamilies); | |
54 ValidateLoadedFonts(v17FontFamilies, reporter); | |
55 | |
56 SkTDArray<FontFamily*> v22FontFamilies; | |
57 SkFontConfigParser::GetTestFontFamilies(v22FontFamilies, | |
58 "/data/local/tmp/resources/android_fonts/v22/fonts.xml", | |
59 NULL); | |
60 | |
61 //REPORTER_ASSERT(reporter, v22FontFamilies.count() > 0); | |
62 if (v22FontFamilies.count() > 0) { | |
63 REPORTER_ASSERT(reporter, v22FontFamilies[0]->fNames.count() > 0); | |
64 } | |
65 | |
66 //ValidateLoadedFonts(v22FontFamilies, reporter); | |
67 } | |
68 | |
OLD | NEW |