OLD | NEW |
---|---|
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 Loading... | |
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); | |
279 | |
280 // Subpixel positioning should be forced. | |
281 { | |
Daniel Erat
2014/08/20 04:21:00
you don't need this block, do you?
oshima
2014/08/20 18:36:21
Done.
| |
282 FontRenderParams params = | |
283 GetFontRenderParams(FontRenderParamsQuery(false), NULL); | |
284 EXPECT_TRUE(params.antialiasing); | |
285 EXPECT_TRUE(params.subpixel_positioning); | |
286 } | |
287 SetFontRenderParamsDeviceScaleFactor(1.0f); | |
288 } | |
289 #endif | |
290 | |
276 TEST_F(FontRenderParamsTest, OnlySetConfiguredValues) { | 291 TEST_F(FontRenderParamsTest, OnlySetConfiguredValues) { |
277 // Configure the LinuxFontDelegate (which queries GtkSettings on desktop | 292 // Configure the LinuxFontDelegate (which queries GtkSettings on desktop |
278 // Linux) to request subpixel rendering. | 293 // Linux) to request subpixel rendering. |
279 FontRenderParams system_params; | 294 FontRenderParams system_params; |
280 system_params.subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_RGB; | 295 system_params.subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_RGB; |
281 test_font_delegate_.set_params(system_params); | 296 test_font_delegate_.set_params(system_params); |
282 | 297 |
283 // Load a Fontconfig config that enables antialiasing but doesn't say anything | 298 // Load a Fontconfig config that enables antialiasing but doesn't say anything |
284 // about subpixel rendering. | 299 // about subpixel rendering. |
285 ASSERT_TRUE(LoadSystemFont("arial.ttf")); | 300 ASSERT_TRUE(LoadSystemFont("arial.ttf")); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
352 EXPECT_EQ("Verdana", suggested_family); | 367 EXPECT_EQ("Verdana", suggested_family); |
353 | 368 |
354 query.families.clear(); | 369 query.families.clear(); |
355 query.families.push_back("Arial"); | 370 query.families.push_back("Arial"); |
356 suggested_family.clear(); | 371 suggested_family.clear(); |
357 GetFontRenderParams(query, &suggested_family); | 372 GetFontRenderParams(query, &suggested_family); |
358 EXPECT_EQ("Verdana", suggested_family); | 373 EXPECT_EQ("Verdana", suggested_family); |
359 } | 374 } |
360 | 375 |
361 } // namespace gfx | 376 } // namespace gfx |
OLD | NEW |