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

Unified Diff: tests/FontMgrTest.cpp

Issue 23710072: fix fontconfig backend to only cache new fonts if their outName was unique (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ports/SkFontHost_fontconfig.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/FontMgrTest.cpp
diff --git a/tests/FontMgrTest.cpp b/tests/FontMgrTest.cpp
index 6b6ee9a73f9899bed76985ca7fe2fe85055e3af7..00ff79b89788cbfaa30ed8a4f759cab74a3ebe2a 100644
--- a/tests/FontMgrTest.cpp
+++ b/tests/FontMgrTest.cpp
@@ -11,6 +11,27 @@
#include "SkFontMgr.h"
#include "SkTypeface.h"
+/*
+ * If the font backend is going to "alias" some font names to other fonts
+ * (e.g. sans -> Arial) then we want to at least get the same typeface back
+ * if we request the alias name multiple times.
+ */
+static void test_badnames(skiatest::Reporter* reporter) {
+ const char* inName = "sans";
bungeman-skia 2013/09/18 20:31:02 Just for the sake of testing aliases on all platfo
+ SkAutoTUnref<SkTypeface> first(SkTypeface::CreateFromName(inName, SkTypeface::kNormal));
+
+ SkString name;
+ for (int i = 0; i < 10; ++i) {
+ SkAutoTUnref<SkTypeface> face(SkTypeface::CreateFromName(inName, SkTypeface::kNormal));
+#if 0
+ face->getFamilyName(&name);
+ printf("request %s, received %s, first id %x received %x\n",
+ inName, name.c_str(), first->uniqueID(), face->uniqueID());
+#endif
+ REPORTER_ASSERT(reporter, first->uniqueID() == face->uniqueID());
+ }
+}
+
static void test_fontiter(skiatest::Reporter* reporter, bool verbose) {
SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
int count = fm->countFamilies();
@@ -49,6 +70,7 @@ DEFINE_bool(verboseFontMgr, false, "run verbose fontmgr tests.");
static void TestFontMgr(skiatest::Reporter* reporter) {
test_fontiter(reporter, FLAGS_verboseFontMgr);
+ test_badnames(reporter);
}
#include "TestClassDef.h"
« no previous file with comments | « src/ports/SkFontHost_fontconfig.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698