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

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: 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); 50 » if (fname.size() == 0) {
bungeman-skia 2014/03/05 18:01:53 Ack! A tab! Do we even need this? Does anything f
hal.canary 2014/03/05 18:24:32 Now that I think about it, the other ASSERTs didn'
51 51 continue;
52 }
52 SkAutoTUnref<SkFontStyleSet> fnset(fm->matchFamily(fname.c_str())); 53 SkAutoTUnref<SkFontStyleSet> fnset(fm->matchFamily(fname.c_str()));
53 SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i)); 54 SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i));
54 REPORTER_ASSERT(reporter, fnset->count() == set->count()); 55 REPORTER_ASSERT(reporter, fnset->count() == set->count());
55 56
56 if (verbose) { 57 if (verbose) {
57 SkDebugf("[%2d] %s\n", i, fname.c_str()); 58 SkDebugf("[%2d] %s\n", i, fname.c_str());
58 } 59 }
59 60
60 for (int j = 0; j < set->count(); ++j) { 61 for (int j = 0; j < set->count(); ++j) {
61 SkString sname; 62 SkString sname;
(...skipping 11 matching lines...) Expand all
73 } 74 }
74 } 75 }
75 } 76 }
76 77
77 DEFINE_bool(verboseFontMgr, false, "run verbose fontmgr tests."); 78 DEFINE_bool(verboseFontMgr, false, "run verbose fontmgr tests.");
78 79
79 DEF_TEST(FontMgr, reporter) { 80 DEF_TEST(FontMgr, reporter) {
80 test_fontiter(reporter, FLAGS_verboseFontMgr); 81 test_fontiter(reporter, FLAGS_verboseFontMgr);
81 test_alias_names(reporter); 82 test_alias_names(reporter);
82 } 83 }
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