aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar mboc <mboc@opera.com>2016-05-31 11:42:36 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-31 11:42:37 -0700
commitee6a9919a362e16c1d84a870ce867d1ad7b8a141 (patch)
tree971189523fe82821c82a936cafaefd59b76338f7 /tests
parentbfa9275968d11d459b30a485cedcb55c7fecf9d7 (diff)
SkTypeface::MakeFromName to take SkFontStyle.
SkTypeface::MakeFromName currently takes SkTypeface::Style, which is quite limited. This starts the transition to this function taking SkFontStyle instead. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1818043002 TBR=reed He said it sounded like a good idea. Review-Url: https://codereview.chromium.org/1818043002
Diffstat (limited to 'tests')
-rw-r--r--tests/FontHostStreamTest.cpp2
-rw-r--r--tests/FontHostTest.cpp4
-rw-r--r--tests/FontMgrTest.cpp4
-rw-r--r--tests/FontObjTest.cpp2
-rw-r--r--tests/PDFPrimitivesTest.cpp2
-rw-r--r--tests/PictureTest.cpp3
-rw-r--r--tests/TypefaceTest.cpp4
7 files changed, 11 insertions, 10 deletions
diff --git a/tests/FontHostStreamTest.cpp b/tests/FontHostStreamTest.cpp
index ec32d9f031..66908bcb72 100644
--- a/tests/FontHostStreamTest.cpp
+++ b/tests/FontHostStreamTest.cpp
@@ -69,7 +69,7 @@ DEF_TEST(FontHostStream, reporter) {
paint.setColor(SK_ColorGRAY);
paint.setTextSize(SkIntToScalar(30));
- paint.setTypeface(SkTypeface::MakeFromName("Georgia", SkTypeface::kNormal));
+ paint.setTypeface(SkTypeface::MakeFromName("Georgia", SkFontStyle()));
SkIRect origRect = SkIRect::MakeWH(64, 64);
SkBitmap origBitmap;
diff --git a/tests/FontHostTest.cpp b/tests/FontHostTest.cpp
index ebcc4ab2ae..811b4b3926 100644
--- a/tests/FontHostTest.cpp
+++ b/tests/FontHostTest.cpp
@@ -223,7 +223,7 @@ static void test_tables(skiatest::Reporter* reporter) {
};
for (size_t i = 0; i < SK_ARRAY_COUNT(gNames); ++i) {
- sk_sp<SkTypeface> face(SkTypeface::MakeFromName(gNames[i], SkTypeface::kNormal));
+ sk_sp<SkTypeface> face(SkTypeface::MakeFromName(gNames[i], SkFontStyle()));
if (face) {
#ifdef DUMP_TABLES
SkDebugf("%s\n", gNames[i]);
@@ -277,7 +277,7 @@ static void test_advances(skiatest::Reporter* reporter) {
char txt[] = "long.text.with.lots.of.dots.";
for (size_t i = 0; i < SK_ARRAY_COUNT(faces); i++) {
- paint.setTypeface(SkTypeface::MakeFromName(faces[i], SkTypeface::kNormal));
+ paint.setTypeface(SkTypeface::MakeFromName(faces[i], SkFontStyle()));
for (size_t j = 0; j < SK_ARRAY_COUNT(settings); j++) {
paint.setHinting(settings[j].hinting);
diff --git a/tests/FontMgrTest.cpp b/tests/FontMgrTest.cpp
index 414631c58f..dd280cd837 100644
--- a/tests/FontMgrTest.cpp
+++ b/tests/FontMgrTest.cpp
@@ -64,12 +64,12 @@ static void test_alias_names(skiatest::Reporter* reporter) {
};
for (size_t i = 0; i < SK_ARRAY_COUNT(inNames); ++i) {
- sk_sp<SkTypeface> first(SkTypeface::MakeFromName(inNames[i], SkTypeface::kNormal));
+ sk_sp<SkTypeface> first(SkTypeface::MakeFromName(inNames[i], SkFontStyle()));
if (nullptr == first.get()) {
continue;
}
for (int j = 0; j < 10; ++j) {
- sk_sp<SkTypeface> face(SkTypeface::MakeFromName(inNames[i], SkTypeface::kNormal));
+ sk_sp<SkTypeface> face(SkTypeface::MakeFromName(inNames[i], SkFontStyle()));
#if 0
SkString name;
face->getFamilyName(&name);
diff --git a/tests/FontObjTest.cpp b/tests/FontObjTest.cpp
index 66c8bd500f..44f799ece1 100644
--- a/tests/FontObjTest.cpp
+++ b/tests/FontObjTest.cpp
@@ -78,7 +78,7 @@ static void test_cachedfont(skiatest::Reporter* reporter) {
char txt[] = "long.text.with.lots.of.dots.";
for (size_t i = 0; i < SK_ARRAY_COUNT(faces); i++) {
- paint.setTypeface(SkTypeface::MakeFromName(faces[i], SkTypeface::kNormal));
+ paint.setTypeface(SkTypeface::MakeFromName(faces[i], SkFontStyle()));
for (size_t j = 0; j < SK_ARRAY_COUNT(settings); j++) {
paint.setHinting(settings[j].hinting);
diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp
index 07ddabc912..e438bfef78 100644
--- a/tests/PDFPrimitivesTest.cpp
+++ b/tests/PDFPrimitivesTest.cpp
@@ -436,7 +436,7 @@ DEF_TEST(PDFFontCanEmbedTypeface, reporter) {
!SkPDFFont::CanEmbedTypeface(noEmbedTypeface.get(), &canon));
}
sk_sp<SkTypeface> portableTypeface(
- sk_tool_utils::create_portable_typeface(NULL, SkTypeface::kNormal));
+ sk_tool_utils::create_portable_typeface(NULL, SkFontStyle()));
REPORTER_ASSERT(reporter,
SkPDFFont::CanEmbedTypeface(portableTypeface.get(), &canon));
}
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index 6dbc86b147..f109482311 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -1163,7 +1163,8 @@ static void test_typeface(skiatest::Reporter* reporter) {
SkPictureRecorder recorder;
SkCanvas* canvas = recorder.beginRecording(10, 10);
SkPaint paint;
- paint.setTypeface(SkTypeface::MakeFromName("Arial", SkTypeface::kItalic));
+ paint.setTypeface(SkTypeface::MakeFromName("Arial",
+ SkFontStyle::FromOldStyle(SkTypeface::kItalic)));
canvas->drawText("Q", 1, 0, 10, paint);
sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture());
SkDynamicMemoryWStream stream;
diff --git a/tests/TypefaceTest.cpp b/tests/TypefaceTest.cpp
index 6a606d4e95..13196bca48 100644
--- a/tests/TypefaceTest.cpp
+++ b/tests/TypefaceTest.cpp
@@ -12,7 +12,7 @@
DEF_TEST(Typeface, reporter) {
- sk_sp<SkTypeface> t1(SkTypeface::MakeFromName(nullptr, SkTypeface::kNormal));
+ sk_sp<SkTypeface> t1(SkTypeface::MakeFromName(nullptr, SkFontStyle()));
sk_sp<SkTypeface> t2(SkTypeface::MakeDefault(SkTypeface::kNormal));
REPORTER_ASSERT(reporter, SkTypeface::Equal(t1.get(), t2.get()));
@@ -22,7 +22,7 @@ DEF_TEST(Typeface, reporter) {
REPORTER_ASSERT(reporter, SkTypeface::Equal(t2.get(), 0));
#ifdef SK_BUILD_FOR_ANDROID
- sk_sp<SkTypeface> t3(SkTypeface::MakeFromName("non-existent-font", SkTypeface::kNormal));
+ sk_sp<SkTypeface> t3(SkTypeface::MakeFromName("non-existent-font", SkFontStyle()));
REPORTER_ASSERT(reporter, nullptr == t3);
#endif
}