| 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/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 // more information. | 272 // more information. |
| 273 FontRenderParams params = GetFontRenderParams( | 273 FontRenderParams params = GetFontRenderParams( |
| 274 FontRenderParamsQuery(), NULL); | 274 FontRenderParamsQuery(), NULL); |
| 275 EXPECT_FALSE(params.antialiasing); | 275 EXPECT_FALSE(params.antialiasing); |
| 276 EXPECT_EQ(FontRenderParams::HINTING_FULL, params.hinting); | 276 EXPECT_EQ(FontRenderParams::HINTING_FULL, params.hinting); |
| 277 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_NONE, | 277 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_NONE, |
| 278 params.subpixel_rendering); | 278 params.subpixel_rendering); |
| 279 EXPECT_FALSE(params.subpixel_positioning); | 279 EXPECT_FALSE(params.subpixel_positioning); |
| 280 } | 280 } |
| 281 | 281 |
| 282 #if defined(OS_CHROMEOS) | |
| 283 TEST_F(FontRenderParamsTest, ForceSubpixelPositioning) { | 282 TEST_F(FontRenderParamsTest, ForceSubpixelPositioning) { |
| 284 { | 283 { |
| 285 FontRenderParams params = | 284 FontRenderParams params = |
| 286 GetFontRenderParams(FontRenderParamsQuery(), NULL); | 285 GetFontRenderParams(FontRenderParamsQuery(), NULL); |
| 287 EXPECT_TRUE(params.antialiasing); | 286 EXPECT_TRUE(params.antialiasing); |
| 288 EXPECT_FALSE(params.subpixel_positioning); | 287 EXPECT_FALSE(params.subpixel_positioning); |
| 289 SetFontRenderParamsDeviceScaleFactor(1.0f); | 288 SetFontRenderParamsDeviceScaleFactor(1.0f); |
| 290 } | 289 } |
| 291 ClearFontRenderParamsCacheForTest(); | 290 ClearFontRenderParamsCacheForTest(); |
| 292 SetFontRenderParamsDeviceScaleFactor(1.25f); | 291 SetFontRenderParamsDeviceScaleFactor(1.25f); |
| 293 // Subpixel positioning should be forced. | 292 // Subpixel positioning should be forced. |
| 294 { | 293 { |
| 295 FontRenderParams params = | 294 FontRenderParams params = |
| 296 GetFontRenderParams(FontRenderParamsQuery(), NULL); | 295 GetFontRenderParams(FontRenderParamsQuery(), NULL); |
| 297 EXPECT_TRUE(params.antialiasing); | 296 EXPECT_TRUE(params.antialiasing); |
| 298 EXPECT_TRUE(params.subpixel_positioning); | 297 EXPECT_TRUE(params.subpixel_positioning); |
| 299 SetFontRenderParamsDeviceScaleFactor(1.0f); | 298 SetFontRenderParamsDeviceScaleFactor(1.0f); |
| 300 } | 299 } |
| 301 } | 300 } |
| 302 #endif | |
| 303 | 301 |
| 304 TEST_F(FontRenderParamsTest, OnlySetConfiguredValues) { | 302 TEST_F(FontRenderParamsTest, OnlySetConfiguredValues) { |
| 305 // Configure the LinuxFontDelegate (which queries GtkSettings on desktop | 303 // Configure the LinuxFontDelegate (which queries GtkSettings on desktop |
| 306 // Linux) to request subpixel rendering. | 304 // Linux) to request subpixel rendering. |
| 307 FontRenderParams system_params; | 305 FontRenderParams system_params; |
| 308 system_params.subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_RGB; | 306 system_params.subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_RGB; |
| 309 test_font_delegate_.set_params(system_params); | 307 test_font_delegate_.set_params(system_params); |
| 310 | 308 |
| 311 // Load a Fontconfig config that enables antialiasing but doesn't say anything | 309 // Load a Fontconfig config that enables antialiasing but doesn't say anything |
| 312 // about subpixel rendering. | 310 // about subpixel rendering. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 EXPECT_EQ("Verdana", suggested_family); | 377 EXPECT_EQ("Verdana", suggested_family); |
| 380 | 378 |
| 381 query.families.clear(); | 379 query.families.clear(); |
| 382 query.families.push_back("Arial"); | 380 query.families.push_back("Arial"); |
| 383 suggested_family.clear(); | 381 suggested_family.clear(); |
| 384 GetFontRenderParams(query, &suggested_family); | 382 GetFontRenderParams(query, &suggested_family); |
| 385 EXPECT_EQ("Verdana", suggested_family); | 383 EXPECT_EQ("Verdana", suggested_family); |
| 386 } | 384 } |
| 387 | 385 |
| 388 } // namespace gfx | 386 } // namespace gfx |
| OLD | NEW |