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

Side by Side Diff: ui/gfx/font_render_params_linux_unittest.cc

Issue 485873002: Enable subpixel positioning for internal display with dsf larger than 1.0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // more information. 266 // more information.
267 FontRenderParams params = GetFontRenderParams( 267 FontRenderParams params = GetFontRenderParams(
268 FontRenderParamsQuery(false), NULL); 268 FontRenderParamsQuery(false), NULL);
269 EXPECT_FALSE(params.antialiasing); 269 EXPECT_FALSE(params.antialiasing);
270 EXPECT_EQ(FontRenderParams::HINTING_FULL, params.hinting); 270 EXPECT_EQ(FontRenderParams::HINTING_FULL, params.hinting);
271 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_NONE, 271 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_NONE,
272 params.subpixel_rendering); 272 params.subpixel_rendering);
273 EXPECT_FALSE(params.subpixel_positioning); 273 EXPECT_FALSE(params.subpixel_positioning);
274 } 274 }
275 275
276 #if defined(OS_CHROMEOS)
277 TEST_F(FontRenderParamsTest, ForceSubpixelPositioning) {
278 SetFontRenderParamsDeviceScaleFactor(1.25f);
Daniel Erat 2014/08/20 20:14:42 nit: do a query before you increase it to 1.25 and
oshima 2014/08/20 21:54:40 Done.
279
280 // Subpixel positioning should be forced.
281 FontRenderParams params =
282 GetFontRenderParams(FontRenderParamsQuery(false), NULL);
283 EXPECT_TRUE(params.antialiasing);
284 EXPECT_TRUE(params.subpixel_positioning);
285 SetFontRenderParamsDeviceScaleFactor(1.0f);
286 }
287 #endif
288
276 TEST_F(FontRenderParamsTest, OnlySetConfiguredValues) { 289 TEST_F(FontRenderParamsTest, OnlySetConfiguredValues) {
277 // Configure the LinuxFontDelegate (which queries GtkSettings on desktop 290 // Configure the LinuxFontDelegate (which queries GtkSettings on desktop
278 // Linux) to request subpixel rendering. 291 // Linux) to request subpixel rendering.
279 FontRenderParams system_params; 292 FontRenderParams system_params;
280 system_params.subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_RGB; 293 system_params.subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_RGB;
281 test_font_delegate_.set_params(system_params); 294 test_font_delegate_.set_params(system_params);
282 295
283 // Load a Fontconfig config that enables antialiasing but doesn't say anything 296 // Load a Fontconfig config that enables antialiasing but doesn't say anything
284 // about subpixel rendering. 297 // about subpixel rendering.
285 ASSERT_TRUE(LoadSystemFont("arial.ttf")); 298 ASSERT_TRUE(LoadSystemFont("arial.ttf"));
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 EXPECT_EQ("Verdana", suggested_family); 365 EXPECT_EQ("Verdana", suggested_family);
353 366
354 query.families.clear(); 367 query.families.clear();
355 query.families.push_back("Arial"); 368 query.families.push_back("Arial");
356 suggested_family.clear(); 369 suggested_family.clear();
357 GetFontRenderParams(query, &suggested_family); 370 GetFontRenderParams(query, &suggested_family);
358 EXPECT_EQ("Verdana", suggested_family); 371 EXPECT_EQ("Verdana", suggested_family);
359 } 372 }
360 373
361 } // namespace gfx 374 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698