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

Side by Side Diff: tests/FontMgrTest.cpp

Issue 24240008: fix build warning for unused function (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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
« 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 "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 #if !defined(SK_BUILD_FOR_ANDROID)
14 /* 15 /*
15 * If the font backend is going to "alias" some font names to other fonts 16 * If the font backend is going to "alias" some font names to other fonts
16 * (e.g. sans -> Arial) then we want to at least get the same typeface back 17 * (e.g. sans -> Arial) then we want to at least get the same typeface back
17 * if we request the alias name multiple times. 18 * if we request the alias name multiple times.
18 */ 19 */
19 static void test_badnames(skiatest::Reporter* reporter) { 20 static void test_badnames(skiatest::Reporter* reporter) {
20 const char* inName = "sans"; 21 const char* inName = "sans";
21 SkAutoTUnref<SkTypeface> first(SkTypeface::CreateFromName(inName, SkTypeface ::kNormal)); 22 SkAutoTUnref<SkTypeface> first(SkTypeface::CreateFromName(inName, SkTypeface ::kNormal));
22 23
23 SkString name; 24 SkString name;
24 for (int i = 0; i < 10; ++i) { 25 for (int i = 0; i < 10; ++i) {
25 SkAutoTUnref<SkTypeface> face(SkTypeface::CreateFromName(inName, SkTypef ace::kNormal)); 26 SkAutoTUnref<SkTypeface> face(SkTypeface::CreateFromName(inName, SkTypef ace::kNormal));
26 #if 0 27 #if 0
27 face->getFamilyName(&name); 28 face->getFamilyName(&name);
28 printf("request %s, received %s, first id %x received %x\n", 29 printf("request %s, received %s, first id %x received %x\n",
29 inName, name.c_str(), first->uniqueID(), face->uniqueID()); 30 inName, name.c_str(), first->uniqueID(), face->uniqueID());
30 #endif 31 #endif
31 REPORTER_ASSERT(reporter, first->uniqueID() == face->uniqueID()); 32 REPORTER_ASSERT(reporter, first->uniqueID() == face->uniqueID());
32 } 33 }
33 } 34 }
35 #endif
34 36
35 static void test_fontiter(skiatest::Reporter* reporter, bool verbose) { 37 static void test_fontiter(skiatest::Reporter* reporter, bool verbose) {
36 SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); 38 SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
37 int count = fm->countFamilies(); 39 int count = fm->countFamilies();
38 40
39 for (int i = 0; i < count; ++i) { 41 for (int i = 0; i < count; ++i) {
40 SkString fname; 42 SkString fname;
41 fm->getFamilyName(i, &fname); 43 fm->getFamilyName(i, &fname);
42 REPORTER_ASSERT(reporter, fname.size() > 0); 44 REPORTER_ASSERT(reporter, fname.size() > 0);
43 45
(...skipping 27 matching lines...) Expand all
71 static void TestFontMgr(skiatest::Reporter* reporter) { 73 static void TestFontMgr(skiatest::Reporter* reporter) {
72 test_fontiter(reporter, FLAGS_verboseFontMgr); 74 test_fontiter(reporter, FLAGS_verboseFontMgr);
73 // The badnames test fails on Android because "sans" is not a valid alias 75 // The badnames test fails on Android because "sans" is not a valid alias
74 #if !defined(SK_BUILD_FOR_ANDROID) 76 #if !defined(SK_BUILD_FOR_ANDROID)
75 test_badnames(reporter); 77 test_badnames(reporter);
76 #endif 78 #endif
77 } 79 }
78 80
79 #include "TestClassDef.h" 81 #include "TestClassDef.h"
80 DEFINE_TESTCLASS("FontMgr", FontMgrClass, TestFontMgr) 82 DEFINE_TESTCLASS("FontMgr", FontMgrClass, TestFontMgr)
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