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

Side by Side Diff: tests/FontMgrTest.cpp

Issue 187933002: Fix FontMgrTest to allow for unnamed fonts. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: try Created 6 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698