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

Unified Diff: ui/gfx/font_render_params_linux_unittest.cc

Issue 401303002: linux: Use scalable fonts and Fontconfig's bitmap setting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « ui/gfx/font_render_params_linux.cc ('k') | no next file » | 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 1a9167f069666a70ae94c09fb69246e3e68abfba..6d28119206e450446c3931a9fb1e412f397e21c6 100644
--- a/ui/gfx/font_render_params_linux_unittest.cc
+++ b/ui/gfx/font_render_params_linux_unittest.cc
@@ -166,4 +166,48 @@ TEST_F(FontRenderParamsTest, Style) {
EXPECT_EQ(FontRenderParams::HINTING_NONE, params.hinting);
}
+TEST_F(FontRenderParamsTest, Scalable) {
+ ASSERT_TRUE(LoadSystemFont("arial.ttf"));
+ // Load a config that only enables antialiasing for scalable fonts.
msw 2014/07/21 16:06:35 Assuming arial is scalable seems a little fragile,
+ ASSERT_TRUE(LoadConfigDataIntoFontconfig(temp_dir_.path(),
+ std::string(kFontconfigFileHeader) +
+ kFontconfigMatchHeader +
+ CreateFontconfigEditStanza("antialias", "bool", "false") +
+ kFontconfigMatchFooter +
+ kFontconfigMatchHeader +
+ CreateFontconfigTestStanza("scalable", "eq", "bool", "true") +
+ CreateFontconfigEditStanza("antialias", "bool", "true") +
+ kFontconfigMatchFooter +
+ kFontconfigFileFooter));
+
+ // Check that we specifically ask how scalable fonts should be rendered.
+ FontRenderParams params = GetCustomFontRenderParams(
+ false, NULL, NULL, NULL, NULL, NULL);
+ EXPECT_TRUE(params.antialiasing);
+}
+
+TEST_F(FontRenderParamsTest, UseBitmaps) {
+ ASSERT_TRUE(LoadSystemFont("arial.ttf"));
+ // Load a config that enables embedded bitmaps for fonts <= 10 pixels.
+ ASSERT_TRUE(LoadConfigDataIntoFontconfig(temp_dir_.path(),
+ std::string(kFontconfigFileHeader) +
+ kFontconfigMatchHeader +
+ CreateFontconfigEditStanza("embeddedbitmap", "bool", "false") +
+ kFontconfigMatchFooter +
+ kFontconfigMatchHeader +
+ CreateFontconfigTestStanza("pixelsize", "less_eq", "double", "10") +
+ CreateFontconfigEditStanza("embeddedbitmap", "bool", "true") +
+ kFontconfigMatchFooter +
+ kFontconfigFileFooter));
+
+ FontRenderParams params = GetCustomFontRenderParams(
+ false, NULL, NULL, NULL, NULL, NULL);
+ EXPECT_FALSE(params.use_bitmaps);
+
+ const int pixel_size = 5;
+ params = GetCustomFontRenderParams(
+ false, NULL, &pixel_size, NULL, NULL, NULL);
+ EXPECT_TRUE(params.use_bitmaps);
+}
+
} // namespace gfx
« no previous file with comments | « ui/gfx/font_render_params_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698