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 "SkFontConfigParser_android.h" | 9 #include "SkFontConfigParser_android.h" |
10 #include "Test.h" | 10 #include "Test.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 ffi.fPaintOptions.getLanguage().getTag().c_str(), | 43 ffi.fPaintOptions.getLanguage().getTag().c_str(), |
44 ffi.fPaintOptions.getFontVariant(), | 44 ffi.fPaintOptions.getFontVariant(), |
45 ffi.fFileName.c_str()); | 45 ffi.fFileName.c_str()); |
46 } | 46 } |
47 } | 47 } |
48 #endif // SK_DEBUG_FONTS | 48 #endif // SK_DEBUG_FONTS |
49 } | 49 } |
50 | 50 |
51 DEF_TEST(FontConfigParserAndroid, reporter) { | 51 DEF_TEST(FontConfigParserAndroid, reporter) { |
52 | 52 |
| 53 bool resourcesMissing = false; |
| 54 |
53 SkTDArray<FontFamily*> preV17FontFamilies; | 55 SkTDArray<FontFamily*> preV17FontFamilies; |
54 SkFontConfigParser::GetTestFontFamilies(preV17FontFamilies, | 56 SkFontConfigParser::GetTestFontFamilies(preV17FontFamilies, |
55 GetResourcePath("android_fonts/pre_v17/system_fonts.xml").c_str(), | 57 GetResourcePath("android_fonts/pre_v17/system_fonts.xml").c_str(), |
56 GetResourcePath("android_fonts/pre_v17/fallback_fonts.xml").c_str()); | 58 GetResourcePath("android_fonts/pre_v17/fallback_fonts.xml").c_str()); |
57 | 59 |
58 REPORTER_ASSERT(reporter, preV17FontFamilies.count() == 14); | 60 if (preV17FontFamilies.count() > 0) { |
| 61 REPORTER_ASSERT(reporter, preV17FontFamilies.count() == 14); |
59 | 62 |
60 DumpLoadedFonts(preV17FontFamilies); | 63 DumpLoadedFonts(preV17FontFamilies); |
61 ValidateLoadedFonts(preV17FontFamilies, reporter); | 64 ValidateLoadedFonts(preV17FontFamilies, reporter); |
| 65 } else { |
| 66 resourcesMissing = true; |
| 67 } |
62 | 68 |
63 | 69 |
64 SkTDArray<FontFamily*> v17FontFamilies; | 70 SkTDArray<FontFamily*> v17FontFamilies; |
65 SkFontConfigParser::GetTestFontFamilies(v17FontFamilies, | 71 SkFontConfigParser::GetTestFontFamilies(v17FontFamilies, |
66 GetResourcePath("android_fonts/v17/system_fonts.xml").c_str(), | 72 GetResourcePath("android_fonts/v17/system_fonts.xml").c_str(), |
67 GetResourcePath("android_fonts/v17/fallback_fonts.xml").c_str()); | 73 GetResourcePath("android_fonts/v17/fallback_fonts.xml").c_str()); |
68 | 74 |
69 REPORTER_ASSERT(reporter, v17FontFamilies.count() == 41); | 75 if (v17FontFamilies.count() > 0) { |
| 76 REPORTER_ASSERT(reporter, v17FontFamilies.count() == 41); |
70 | 77 |
71 DumpLoadedFonts(v17FontFamilies); | 78 DumpLoadedFonts(v17FontFamilies); |
72 ValidateLoadedFonts(v17FontFamilies, reporter); | 79 ValidateLoadedFonts(v17FontFamilies, reporter); |
| 80 } else { |
| 81 resourcesMissing = true; |
| 82 } |
73 | 83 |
74 | 84 |
75 SkTDArray<FontFamily*> v22FontFamilies; | 85 SkTDArray<FontFamily*> v22FontFamilies; |
76 SkFontConfigParser::GetTestFontFamilies(v22FontFamilies, | 86 SkFontConfigParser::GetTestFontFamilies(v22FontFamilies, |
77 GetResourcePath("android_fonts/v22/fonts.xml").c_str(), | 87 GetResourcePath("android_fonts/v22/fonts.xml").c_str(), |
78 NULL); | 88 NULL); |
79 | 89 |
80 REPORTER_ASSERT(reporter, v22FontFamilies.count() == 53); | 90 if (v22FontFamilies.count() > 0) { |
| 91 REPORTER_ASSERT(reporter, v22FontFamilies.count() == 53); |
81 | 92 |
82 DumpLoadedFonts(v22FontFamilies); | 93 DumpLoadedFonts(v22FontFamilies); |
83 ValidateLoadedFonts(v22FontFamilies, reporter); | 94 ValidateLoadedFonts(v22FontFamilies, reporter); |
| 95 } else { |
| 96 resourcesMissing = true; |
| 97 } |
| 98 |
| 99 if (resourcesMissing) { |
| 100 SkDebugf("---- Resource files missing for FontConfigParser test\n"); |
| 101 } |
84 } | 102 } |
85 | 103 |
OLD | NEW |