OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkCommandLineFlags.h" | 8 #include "SkCommandLineFlags.h" |
9 #include "SkFontMgr.h" | 9 #include "SkFontMgr.h" |
10 #include "SkTypeface.h" | 10 #include "SkTypeface.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 static void test_fontiter(skiatest::Reporter* reporter, bool verbose) { | 43 static void test_fontiter(skiatest::Reporter* reporter, bool verbose) { |
44 SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); | 44 SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); |
45 int count = fm->countFamilies(); | 45 int count = fm->countFamilies(); |
46 | 46 |
47 for (int i = 0; i < count; ++i) { | 47 for (int i = 0; i < count; ++i) { |
48 SkString fname; | 48 SkString fname; |
49 fm->getFamilyName(i, &fname); | 49 fm->getFamilyName(i, &fname); |
50 REPORTER_ASSERT(reporter, fname.size() > 0); | |
51 | 50 |
52 SkAutoTUnref<SkFontStyleSet> fnset(fm->matchFamily(fname.c_str())); | 51 SkAutoTUnref<SkFontStyleSet> fnset(fm->matchFamily(fname.c_str())); |
53 SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i)); | 52 SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i)); |
54 REPORTER_ASSERT(reporter, fnset->count() == set->count()); | 53 REPORTER_ASSERT(reporter, fnset->count() == set->count()); |
55 | 54 |
56 if (verbose) { | 55 if (verbose) { |
57 SkDebugf("[%2d] %s\n", i, fname.c_str()); | 56 SkDebugf("[%2d] %s\n", i, fname.c_str()); |
58 } | 57 } |
59 | 58 |
60 for (int j = 0; j < set->count(); ++j) { | 59 for (int j = 0; j < set->count(); ++j) { |
(...skipping 12 matching lines...) Expand all Loading... |
73 } | 72 } |
74 } | 73 } |
75 } | 74 } |
76 | 75 |
77 DEFINE_bool(verboseFontMgr, false, "run verbose fontmgr tests."); | 76 DEFINE_bool(verboseFontMgr, false, "run verbose fontmgr tests."); |
78 | 77 |
79 DEF_TEST(FontMgr, reporter) { | 78 DEF_TEST(FontMgr, reporter) { |
80 test_fontiter(reporter, FLAGS_verboseFontMgr); | 79 test_fontiter(reporter, FLAGS_verboseFontMgr); |
81 test_alias_names(reporter); | 80 test_alias_names(reporter); |
82 } | 81 } |
OLD | NEW |