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

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

Issue 400193004: Unify desktop Linux and Chrome OS font rendering params. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use initializer list 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') | ui/gfx/gfx_tests.gyp » ('j') | 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 kFontconfigMatchHeader + 55 kFontconfigMatchHeader +
56 CreateFontconfigEditStanza("antialias", "bool", "true") + 56 CreateFontconfigEditStanza("antialias", "bool", "true") +
57 CreateFontconfigEditStanza("autohint", "bool", "false") + 57 CreateFontconfigEditStanza("autohint", "bool", "false") +
58 CreateFontconfigEditStanza("hinting", "bool", "true") + 58 CreateFontconfigEditStanza("hinting", "bool", "true") +
59 CreateFontconfigEditStanza("hintstyle", "const", "hintfull") + 59 CreateFontconfigEditStanza("hintstyle", "const", "hintfull") +
60 CreateFontconfigEditStanza("rgba", "const", "rgb") + 60 CreateFontconfigEditStanza("rgba", "const", "rgb") +
61 kFontconfigMatchFooter + 61 kFontconfigMatchFooter +
62 kFontconfigFileFooter)); 62 kFontconfigFileFooter));
63 63
64 FontRenderParams params = GetDefaultFontRenderParams(); 64 FontRenderParams params = GetDefaultFontRenderParams();
65 #if defined(OS_CHROMEOS)
66 // Chrome OS uses its own defaults for everything except subpixel rendering,
67 // which comes from Fontconfig.
68 EXPECT_TRUE(params.antialiasing);
69 EXPECT_TRUE(params.autohinter);
70 EXPECT_TRUE(params.use_bitmaps);
71 EXPECT_EQ(FontRenderParams::HINTING_SLIGHT, params.hinting);
72 #else
73 // Desktop Linux gets all settings from fontconfig.
74 EXPECT_TRUE(params.antialiasing); 65 EXPECT_TRUE(params.antialiasing);
75 EXPECT_FALSE(params.autohinter); 66 EXPECT_FALSE(params.autohinter);
76 EXPECT_TRUE(params.use_bitmaps); 67 EXPECT_TRUE(params.use_bitmaps);
77 EXPECT_EQ(FontRenderParams::HINTING_FULL, params.hinting); 68 EXPECT_EQ(FontRenderParams::HINTING_FULL, params.hinting);
78 #endif
79 EXPECT_FALSE(params.subpixel_positioning); 69 EXPECT_FALSE(params.subpixel_positioning);
80 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_RGB, 70 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_RGB,
81 params.subpixel_rendering); 71 params.subpixel_rendering);
82 } 72 }
83 73
84 // Chrome OS ignores most Fontconfig settings.
85 #if !defined(OS_CHROMEOS)
86 TEST_F(FontRenderParamsTest, Size) { 74 TEST_F(FontRenderParamsTest, Size) {
87 // Fontconfig needs to know about at least one font to return a match. 75 // Fontconfig needs to know about at least one font to return a match.
88 ASSERT_TRUE(LoadSystemFont("arial.ttf")); 76 ASSERT_TRUE(LoadSystemFont("arial.ttf"));
89 ASSERT_TRUE(LoadConfigDataIntoFontconfig(temp_dir_.path(), 77 ASSERT_TRUE(LoadConfigDataIntoFontconfig(temp_dir_.path(),
90 std::string(kFontconfigFileHeader) + 78 std::string(kFontconfigFileHeader) +
91 kFontconfigMatchHeader + 79 kFontconfigMatchHeader +
92 CreateFontconfigEditStanza("antialias", "bool", "true") + 80 CreateFontconfigEditStanza("antialias", "bool", "true") +
93 CreateFontconfigEditStanza("hinting", "bool", "true") + 81 CreateFontconfigEditStanza("hinting", "bool", "true") +
94 CreateFontconfigEditStanza("hintstyle", "const", "hintfull") + 82 CreateFontconfigEditStanza("hintstyle", "const", "hintfull") +
95 CreateFontconfigEditStanza("rgba", "const", "none") + 83 CreateFontconfigEditStanza("rgba", "const", "none") +
(...skipping 26 matching lines...) Expand all
122 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_NONE, 110 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_NONE,
123 params.subpixel_rendering); 111 params.subpixel_rendering);
124 112
125 int point_size = 20; 113 int point_size = 20;
126 params = GetCustomFontRenderParams(false, NULL, NULL, &point_size, NULL); 114 params = GetCustomFontRenderParams(false, NULL, NULL, &point_size, NULL);
127 EXPECT_TRUE(params.antialiasing); 115 EXPECT_TRUE(params.antialiasing);
128 EXPECT_EQ(FontRenderParams::HINTING_SLIGHT, params.hinting); 116 EXPECT_EQ(FontRenderParams::HINTING_SLIGHT, params.hinting);
129 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_RGB, 117 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_RGB,
130 params.subpixel_rendering); 118 params.subpixel_rendering);
131 } 119 }
132 #endif // !defined(OS_CHROMEOS)
133 120
134 } // namespace gfx 121 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/font_render_params_linux.cc ('k') | ui/gfx/gfx_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698