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

Unified Diff: ui/gfx/font_render_params_linux_unittest.cc

Issue 415043007: linux: Add some font-family-related FontRenderParams tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor updates Created 6 years, 5 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 | « no previous file | ui/gfx/test/fontconfig_util_linux.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/font_render_params_linux_unittest.cc
diff --git a/ui/gfx/font_render_params_linux_unittest.cc b/ui/gfx/font_render_params_linux_unittest.cc
index a7924833234db3646a4808c978e956041878191d..eea196850f49bf8545dd74ed1dcd97f03ac66be5 100644
--- a/ui/gfx/font_render_params_linux_unittest.cc
+++ b/ui/gfx/font_render_params_linux_unittest.cc
@@ -287,4 +287,44 @@ TEST_F(FontRenderParamsTest, NoFontconfigMatch) {
EXPECT_EQ(query.families[0], suggested_family);
}
+TEST_F(FontRenderParamsTest, MissingFamily) {
+ // With Arial and Verdana installed, request (in order) Helvetica, Arial, and
+ // Verdana and check that Arial is returned.
+ ASSERT_TRUE(LoadSystemFont("arial.ttf"));
+ ASSERT_TRUE(LoadSystemFont("verdana.ttf"));
+ FontRenderParamsQuery query(false);
+ query.families.push_back("Helvetica");
+ query.families.push_back("Arial");
+ query.families.push_back("Verdana");
+ std::string suggested_family;
+ GetFontRenderParams(query, &suggested_family);
+ EXPECT_EQ("Arial", suggested_family);
+}
+
+TEST_F(FontRenderParamsTest, SubstituteFamily) {
+ // Configure Fontconfig to use Verdana for both Helvetica and Arial.
+ ASSERT_TRUE(LoadSystemFont("arial.ttf"));
+ ASSERT_TRUE(LoadSystemFont("verdana.ttf"));
+ ASSERT_TRUE(LoadConfigDataIntoFontconfig(temp_dir_.path(),
+ std::string(kFontconfigFileHeader) +
+ CreateFontconfigAliasStanza("Helvetica", "Verdana") +
+ kFontconfigMatchHeader +
+ CreateFontconfigTestStanza("family", "eq", "string", "Arial") +
+ CreateFontconfigEditStanza("family", "string", "Verdana") +
+ kFontconfigMatchFooter +
+ kFontconfigFileFooter));
+
+ FontRenderParamsQuery query(false);
+ query.families.push_back("Helvetica");
+ std::string suggested_family;
+ GetFontRenderParams(query, &suggested_family);
+ EXPECT_EQ("Verdana", suggested_family);
+
+ query.families.clear();
+ query.families.push_back("Arial");
+ suggested_family.clear();
+ GetFontRenderParams(query, &suggested_family);
+ EXPECT_EQ("Verdana", suggested_family);
+}
+
} // namespace gfx
« no previous file with comments | « no previous file | ui/gfx/test/fontconfig_util_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698