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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 * If the font backend is going to "alias" some font names to other fonts | 57 * If the font backend is going to "alias" some font names to other fonts |
58 * (e.g. sans -> Arial) then we want to at least get the same typeface back | 58 * (e.g. sans -> Arial) then we want to at least get the same typeface back |
59 * if we request the alias name multiple times. | 59 * if we request the alias name multiple times. |
60 */ | 60 */ |
61 static void test_alias_names(skiatest::Reporter* reporter) { | 61 static void test_alias_names(skiatest::Reporter* reporter) { |
62 const char* inNames[] = { | 62 const char* inNames[] = { |
63 "sans", "sans-serif", "serif", "monospace", "times", "helvetica" | 63 "sans", "sans-serif", "serif", "monospace", "times", "helvetica" |
64 }; | 64 }; |
65 | 65 |
66 for (size_t i = 0; i < SK_ARRAY_COUNT(inNames); ++i) { | 66 for (size_t i = 0; i < SK_ARRAY_COUNT(inNames); ++i) { |
67 sk_sp<SkTypeface> first(SkTypeface::MakeFromName(inNames[i], SkTypeface:
:kNormal)); | 67 sk_sp<SkTypeface> first(SkTypeface::MakeFromName(inNames[i], SkFontStyle
())); |
68 if (nullptr == first.get()) { | 68 if (nullptr == first.get()) { |
69 continue; | 69 continue; |
70 } | 70 } |
71 for (int j = 0; j < 10; ++j) { | 71 for (int j = 0; j < 10; ++j) { |
72 sk_sp<SkTypeface> face(SkTypeface::MakeFromName(inNames[i], SkTypefa
ce::kNormal)); | 72 sk_sp<SkTypeface> face(SkTypeface::MakeFromName(inNames[i], SkFontSt
yle())); |
73 #if 0 | 73 #if 0 |
74 SkString name; | 74 SkString name; |
75 face->getFamilyName(&name); | 75 face->getFamilyName(&name); |
76 printf("request %s, received %s, first id %x received %x\n", | 76 printf("request %s, received %s, first id %x received %x\n", |
77 inNames[i], name.c_str(), first->uniqueID(), face->uniqueID()
); | 77 inNames[i], name.c_str(), first->uniqueID(), face->uniqueID()
); |
78 #endif | 78 #endif |
79 REPORTER_ASSERT(reporter, first->uniqueID() == face->uniqueID()); | 79 REPORTER_ASSERT(reporter, first->uniqueID() == face->uniqueID()); |
80 } | 80 } |
81 } | 81 } |
82 } | 82 } |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 } | 703 } |
704 | 704 |
705 DEFINE_bool(verboseFontMgr, false, "run verbose fontmgr tests."); | 705 DEFINE_bool(verboseFontMgr, false, "run verbose fontmgr tests."); |
706 | 706 |
707 DEF_TEST(FontMgr, reporter) { | 707 DEF_TEST(FontMgr, reporter) { |
708 test_matchStyleCSS3(reporter); | 708 test_matchStyleCSS3(reporter); |
709 test_fontiter(reporter, FLAGS_verboseFontMgr); | 709 test_fontiter(reporter, FLAGS_verboseFontMgr); |
710 test_alias_names(reporter); | 710 test_alias_names(reporter); |
711 test_font(reporter); | 711 test_font(reporter); |
712 } | 712 } |
OLD | NEW |