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>
diff --git a/tests/FontMgrTest.cpp b/tests/FontMgrTest.cpp
index b6a0cc5..251eb15 100644
--- a/tests/FontMgrTest.cpp
+++ b/tests/FontMgrTest.cpp
@@ -114,6 +114,12 @@
}
}
+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 @@
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);