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

Side by Side Diff: tests/TypefaceTest.cpp

Issue 1818043002: SkTypeface::MakeFromName to take SkFontStyle. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Compile fixes Created 4 years, 6 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
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 "SkRefCnt.h" 8 #include "SkRefCnt.h"
9 #include "SkTypeface.h" 9 #include "SkTypeface.h"
10 #include "SkTypefaceCache.h" 10 #include "SkTypefaceCache.h"
11 #include "Test.h" 11 #include "Test.h"
12 12
13 DEF_TEST(Typeface, reporter) { 13 DEF_TEST(Typeface, reporter) {
14 14
15 sk_sp<SkTypeface> t1(SkTypeface::MakeFromName(nullptr, SkTypeface::kNormal)) ; 15 sk_sp<SkTypeface> t1(SkTypeface::MakeFromName(nullptr, SkFontStyle()));
16 sk_sp<SkTypeface> t2(SkTypeface::MakeDefault(SkTypeface::kNormal)); 16 sk_sp<SkTypeface> t2(SkTypeface::MakeDefault(SkTypeface::kNormal));
17 17
18 REPORTER_ASSERT(reporter, SkTypeface::Equal(t1.get(), t2.get())); 18 REPORTER_ASSERT(reporter, SkTypeface::Equal(t1.get(), t2.get()));
19 REPORTER_ASSERT(reporter, SkTypeface::Equal(0, t1.get())); 19 REPORTER_ASSERT(reporter, SkTypeface::Equal(0, t1.get()));
20 REPORTER_ASSERT(reporter, SkTypeface::Equal(0, t2.get())); 20 REPORTER_ASSERT(reporter, SkTypeface::Equal(0, t2.get()));
21 REPORTER_ASSERT(reporter, SkTypeface::Equal(t1.get(), 0)); 21 REPORTER_ASSERT(reporter, SkTypeface::Equal(t1.get(), 0));
22 REPORTER_ASSERT(reporter, SkTypeface::Equal(t2.get(), 0)); 22 REPORTER_ASSERT(reporter, SkTypeface::Equal(t2.get(), 0));
23 23
24 #ifdef SK_BUILD_FOR_ANDROID 24 #ifdef SK_BUILD_FOR_ANDROID
25 sk_sp<SkTypeface> t3(SkTypeface::MakeFromName("non-existent-font", SkTypefac e::kNormal)); 25 sk_sp<SkTypeface> t3(SkTypeface::MakeFromName("non-existent-font", SkTypefac e::kNormal));
bungeman-skia 2016/05/26 15:39:33 Need to update this one as well. (The wonders of m
Mikus 2016/05/30 14:18:39 Done.
26 REPORTER_ASSERT(reporter, nullptr == t3); 26 REPORTER_ASSERT(reporter, nullptr == t3);
27 #endif 27 #endif
28 } 28 }
29 29
30 namespace { 30 namespace {
31 31
32 class SkEmptyTypeface : public SkTypeface { 32 class SkEmptyTypeface : public SkTypeface {
33 public: 33 public:
34 static sk_sp<SkTypeface> Create(SkFontID id) { return sk_sp<SkTypeface>(new SkEmptyTypeface(id)); } 34 static sk_sp<SkTypeface> Create(SkFontID id) { return sk_sp<SkTypeface>(new SkEmptyTypeface(id)); }
35 protected: 35 protected:
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 REPORTER_ASSERT(reporter, count(reporter, cache) == 2); 88 REPORTER_ASSERT(reporter, count(reporter, cache) == 2);
89 cache.purgeAll(); 89 cache.purgeAll();
90 REPORTER_ASSERT(reporter, count(reporter, cache) == 2); 90 REPORTER_ASSERT(reporter, count(reporter, cache) == 2);
91 } 91 }
92 REPORTER_ASSERT(reporter, count(reporter, cache) == 2); 92 REPORTER_ASSERT(reporter, count(reporter, cache) == 2);
93 cache.purgeAll(); 93 cache.purgeAll();
94 REPORTER_ASSERT(reporter, count(reporter, cache) == 1); 94 REPORTER_ASSERT(reporter, count(reporter, cache) == 1);
95 } 95 }
96 REPORTER_ASSERT(reporter, t1->unique()); 96 REPORTER_ASSERT(reporter, t1->unique());
97 } 97 }
OLDNEW
« gm/fontcache.cpp ('K') | « tests/PictureTest.cpp ('k') | tools/sk_tool_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698