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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/font_render_params_linux.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/font_render_params.h" 5 #include "ui/gfx/font_render_params.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 EXPECT_TRUE(params.antialiasing); 159 EXPECT_TRUE(params.antialiasing);
160 EXPECT_EQ(FontRenderParams::HINTING_NONE, params.hinting); 160 EXPECT_EQ(FontRenderParams::HINTING_NONE, params.hinting);
161 161
162 style = Font::BOLD | Font::ITALIC; 162 style = Font::BOLD | Font::ITALIC;
163 params = GetCustomFontRenderParams( 163 params = GetCustomFontRenderParams(
164 false, NULL, NULL, NULL, &style, NULL); 164 false, NULL, NULL, NULL, &style, NULL);
165 EXPECT_FALSE(params.antialiasing); 165 EXPECT_FALSE(params.antialiasing);
166 EXPECT_EQ(FontRenderParams::HINTING_NONE, params.hinting); 166 EXPECT_EQ(FontRenderParams::HINTING_NONE, params.hinting);
167 } 167 }
168 168
169 TEST_F(FontRenderParamsTest, Scalable) {
170 ASSERT_TRUE(LoadSystemFont("arial.ttf"));
171 // 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,
172 ASSERT_TRUE(LoadConfigDataIntoFontconfig(temp_dir_.path(),
173 std::string(kFontconfigFileHeader) +
174 kFontconfigMatchHeader +
175 CreateFontconfigEditStanza("antialias", "bool", "false") +
176 kFontconfigMatchFooter +
177 kFontconfigMatchHeader +
178 CreateFontconfigTestStanza("scalable", "eq", "bool", "true") +
179 CreateFontconfigEditStanza("antialias", "bool", "true") +
180 kFontconfigMatchFooter +
181 kFontconfigFileFooter));
182
183 // Check that we specifically ask how scalable fonts should be rendered.
184 FontRenderParams params = GetCustomFontRenderParams(
185 false, NULL, NULL, NULL, NULL, NULL);
186 EXPECT_TRUE(params.antialiasing);
187 }
188
189 TEST_F(FontRenderParamsTest, UseBitmaps) {
190 ASSERT_TRUE(LoadSystemFont("arial.ttf"));
191 // Load a config that enables embedded bitmaps for fonts <= 10 pixels.
192 ASSERT_TRUE(LoadConfigDataIntoFontconfig(temp_dir_.path(),
193 std::string(kFontconfigFileHeader) +
194 kFontconfigMatchHeader +
195 CreateFontconfigEditStanza("embeddedbitmap", "bool", "false") +
196 kFontconfigMatchFooter +
197 kFontconfigMatchHeader +
198 CreateFontconfigTestStanza("pixelsize", "less_eq", "double", "10") +
199 CreateFontconfigEditStanza("embeddedbitmap", "bool", "true") +
200 kFontconfigMatchFooter +
201 kFontconfigFileFooter));
202
203 FontRenderParams params = GetCustomFontRenderParams(
204 false, NULL, NULL, NULL, NULL, NULL);
205 EXPECT_FALSE(params.use_bitmaps);
206
207 const int pixel_size = 5;
208 params = GetCustomFontRenderParams(
209 false, NULL, &pixel_size, NULL, NULL, NULL);
210 EXPECT_TRUE(params.use_bitmaps);
211 }
212
169 } // namespace gfx 213 } // namespace gfx
OLDNEW
« 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