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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 CreateFontconfigEditStanza("antialias", "bool", "true") + | 262 CreateFontconfigEditStanza("antialias", "bool", "true") + |
263 kFontconfigMatchFooter + | 263 kFontconfigMatchFooter + |
264 kFontconfigFileFooter)); | 264 kFontconfigFileFooter)); |
265 | 265 |
266 // The subpixel rendering setting from the delegate should make it through. | 266 // The subpixel rendering setting from the delegate should make it through. |
267 FontRenderParams params = GetCustomFontRenderParams( | 267 FontRenderParams params = GetCustomFontRenderParams( |
268 false, NULL, NULL, NULL, NULL, NULL); | 268 false, NULL, NULL, NULL, NULL, NULL); |
269 EXPECT_EQ(system_params.subpixel_rendering, params.subpixel_rendering); | 269 EXPECT_EQ(system_params.subpixel_rendering, params.subpixel_rendering); |
270 } | 270 } |
271 | 271 |
| 272 TEST_F(FontRenderParamsTest, NoFontconfigMatch) { |
| 273 // Don't load a Fontconfig configuration. |
| 274 FontRenderParams system_params; |
| 275 system_params.antialiasing = true; |
| 276 system_params.hinting = FontRenderParams::HINTING_MEDIUM; |
| 277 system_params.subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_RGB; |
| 278 test_font_delegate_.set_params(system_params); |
| 279 |
| 280 std::vector<std::string> families; |
| 281 families.push_back("Arial"); |
| 282 families.push_back("Times New Roman"); |
| 283 const int pixel_size = 10; |
| 284 std::string suggested_family; |
| 285 FontRenderParams params = GetCustomFontRenderParams( |
| 286 false, &families, &pixel_size, NULL, NULL, &suggested_family); |
| 287 |
| 288 // The system params and the first requested family should be returned. |
| 289 EXPECT_EQ(system_params.antialiasing, params.antialiasing); |
| 290 EXPECT_EQ(system_params.hinting, params.hinting); |
| 291 EXPECT_EQ(system_params.subpixel_rendering, params.subpixel_rendering); |
| 292 EXPECT_EQ("Arial", suggested_family); |
| 293 } |
| 294 |
272 } // namespace gfx | 295 } // namespace gfx |
OLD | NEW |