aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2017-05-01 13:02:42 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-01 18:13:02 +0000
commit7575bb1c389f96db4123783fcd717f3611b3a8eb (patch)
treeba76ce96b732117155b6fc48c644e9e29f50cd85 /tests
parentfe560a8cc3839b7c4c0a63bdb286fe1e1f89a5dc (diff)
SkFontMgr::matchFamily should not crash on nullptr.
While all systems can resolve a font from just a style request (without a name) almost no systems specify a default font family. BUG=skia:6574 Change-Id: If7c81808b62cd5d8212bce2eb4d9c476c45af80a Reviewed-on: https://skia-review.googlesource.com/14902 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/FontMgrTest.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/FontMgrTest.cpp b/tests/FontMgrTest.cpp
index b6a0cc5a74..251eb154a0 100644
--- a/tests/FontMgrTest.cpp
+++ b/tests/FontMgrTest.cpp
@@ -114,6 +114,12 @@ static void test_fontiter(skiatest::Reporter* reporter, bool verbose) {
}
}
+static void test_match(skiatest::Reporter* reporter) {
+ sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault());
+ sk_sp<SkFontStyleSet> styleSet(fm->matchFamily(nullptr));
+ REPORTER_ASSERT(reporter, styleSet);
+}
+
static void test_matchStyleCSS3(skiatest::Reporter* reporter) {
static const SkFontStyle invalidFontStyle(101, SkFontStyle::kNormal_Width, SkFontStyle::kUpright_Slant);
@@ -710,6 +716,7 @@ static void test_matchStyleCSS3(skiatest::Reporter* reporter) {
DEFINE_bool(verboseFontMgr, false, "run verbose fontmgr tests.");
DEF_TEST(FontMgr, reporter) {
+ test_match(reporter);
test_matchStyleCSS3(reporter);
test_fontiter(reporter, FLAGS_verboseFontMgr);
test_alias_names(reporter);