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

Side by Side Diff: tests/FontMgrTest.cpp

Issue 14314008: Add FontMgr to DirectWrite. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Add matcher, fix GrGLCaps. Created 7 years, 7 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 | Annotate | Revision Log
« src/gpu/gl/GrGLCaps.cpp ('K') | « src/ports/SkFontHost_win_dw.cpp ('k') | 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 "Test.h" 8 #include "Test.h"
9 9
10 #include "SkCommandLineFlags.h" 10 #include "SkCommandLineFlags.h"
11 #include "SkFontMgr.h" 11 #include "SkFontMgr.h"
12 #include "SkTypeface.h" 12 #include "SkTypeface.h"
13 13
14 static void test_fontiter(skiatest::Reporter* reporter, bool verbose) { 14 static void test_fontiter(skiatest::Reporter* reporter, bool verbose) {
15 SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); 15 SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
16 int count = fm->countFamilies(); 16 int count = fm->countFamilies();
17 17
18 for (int i = 0; i < count; ++i) { 18 for (int i = 0; i < count; ++i) {
19 SkString fname; 19 SkString fname;
20 fm->getFamilyName(i, &fname); 20 fm->getFamilyName(i, &fname);
21 REPORTER_ASSERT(reporter, fname.size() > 0); 21 REPORTER_ASSERT(reporter, fname.size() > 0);
22 22
23 SkAutoTUnref<SkFontStyleSet> fnset(fm->matchFamily(fname.c_str()));
23 SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i)); 24 SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i));
25 REPORTER_ASSERT(reporter, fnset->count() == set->count());
24 26
25 if (verbose) { 27 if (verbose) {
26 SkDebugf("[%2d] %s\n", i, fname.c_str()); 28 SkDebugf("[%2d] %s\n", i, fname.c_str());
27 } 29 }
28 30
29 for (int j = 0; j < set->count(); ++j) { 31 for (int j = 0; j < set->count(); ++j) {
30 SkString sname; 32 SkString sname;
31 SkFontStyle fs; 33 SkFontStyle fs;
32 set->getStyle(j, &fs, &sname); 34 set->getStyle(j, &fs, &sname);
33 // REPORTER_ASSERT(reporter, sname.size() > 0); 35 // REPORTER_ASSERT(reporter, sname.size() > 0);
(...skipping 10 matching lines...) Expand all
44 } 46 }
45 47
46 DEFINE_bool(verboseFontMgr, false, "run verbose fontmgr tests."); 48 DEFINE_bool(verboseFontMgr, false, "run verbose fontmgr tests.");
47 49
48 static void TestFontMgr(skiatest::Reporter* reporter) { 50 static void TestFontMgr(skiatest::Reporter* reporter) {
49 test_fontiter(reporter, FLAGS_verboseFontMgr); 51 test_fontiter(reporter, FLAGS_verboseFontMgr);
50 } 52 }
51 53
52 #include "TestClassDef.h" 54 #include "TestClassDef.h"
53 DEFINE_TESTCLASS("FontMgr", FontMgrClass, TestFontMgr) 55 DEFINE_TESTCLASS("FontMgr", FontMgrClass, TestFontMgr)
OLDNEW
« src/gpu/gl/GrGLCaps.cpp ('K') | « src/ports/SkFontHost_win_dw.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698