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

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

Issue 1282363003: Convert remaining StringToLowerASCII to ToLowerASCII (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « ui/gfx/font_fallback_win.cc ('k') | ui/gfx/font_unittest.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_list.h" 5 #include "ui/gfx/font_list.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 // TODO(489354): Enable this on android. 254 // TODO(489354): Enable this on android.
255 #if defined(OS_ANDROID) 255 #if defined(OS_ANDROID)
256 #define MAYBE_Fonts_GetHeight_GetBaseline DISABLED_Fonts_GetHeight_GetBaseline 256 #define MAYBE_Fonts_GetHeight_GetBaseline DISABLED_Fonts_GetHeight_GetBaseline
257 #else 257 #else
258 #define MAYBE_Fonts_GetHeight_GetBaseline Fonts_GetHeight_GetBaseline 258 #define MAYBE_Fonts_GetHeight_GetBaseline Fonts_GetHeight_GetBaseline
259 #endif 259 #endif
260 TEST(FontListTest, MAYBE_Fonts_GetHeight_GetBaseline) { 260 TEST(FontListTest, MAYBE_Fonts_GetHeight_GetBaseline) {
261 // If a font list has only one font, the height and baseline must be the same. 261 // If a font list has only one font, the height and baseline must be the same.
262 Font font1("Arial", 16); 262 Font font1("Arial", 16);
263 ASSERT_EQ("arial", 263 ASSERT_EQ("arial", base::ToLowerASCII(font1.GetActualFontNameForTesting()));
264 base::StringToLowerASCII(font1.GetActualFontNameForTesting()));
265 FontList font_list1("Arial, 16px"); 264 FontList font_list1("Arial, 16px");
266 EXPECT_EQ(font1.GetHeight(), font_list1.GetHeight()); 265 EXPECT_EQ(font1.GetHeight(), font_list1.GetHeight());
267 EXPECT_EQ(font1.GetBaseline(), font_list1.GetBaseline()); 266 EXPECT_EQ(font1.GetBaseline(), font_list1.GetBaseline());
268 267
269 // If there are two different fonts, the font list returns the max value 268 // If there are two different fonts, the font list returns the max value
270 // for the baseline (ascent) and height. 269 // for the baseline (ascent) and height.
271 Font font2("Symbol", 16); 270 Font font2("Symbol", 16);
272 ASSERT_EQ("symbol", 271 ASSERT_EQ("symbol", base::ToLowerASCII(font2.GetActualFontNameForTesting()));
273 base::StringToLowerASCII(font2.GetActualFontNameForTesting()));
274 EXPECT_NE(font1.GetBaseline(), font2.GetBaseline()); 272 EXPECT_NE(font1.GetBaseline(), font2.GetBaseline());
275 // TODO(ananta): Find a size and font pair with reliably distinct descents. 273 // TODO(ananta): Find a size and font pair with reliably distinct descents.
276 EXPECT_NE(font1.GetHeight(), font2.GetHeight()); 274 EXPECT_NE(font1.GetHeight(), font2.GetHeight());
277 std::vector<Font> fonts; 275 std::vector<Font> fonts;
278 fonts.push_back(font1); 276 fonts.push_back(font1);
279 fonts.push_back(font2); 277 fonts.push_back(font2);
280 FontList font_list_mix(fonts); 278 FontList font_list_mix(fonts);
281 // ascent of FontList == max(ascent of Fonts) 279 // ascent of FontList == max(ascent of Fonts)
282 EXPECT_EQ(std::max(font1.GetBaseline(), font2.GetBaseline()), 280 EXPECT_EQ(std::max(font1.GetBaseline(), font2.GetBaseline()),
283 font_list_mix.GetBaseline()); 281 font_list_mix.GetBaseline());
(...skipping 27 matching lines...) Expand all
311 309
312 // A larger upper bound should not change the height of the font list. 310 // A larger upper bound should not change the height of the font list.
313 const int height_2 = font_list.GetHeight() + 5; 311 const int height_2 = font_list.GetHeight() + 5;
314 FontList derived_2 = font_list.DeriveWithHeightUpperBound(height_2); 312 FontList derived_2 = font_list.DeriveWithHeightUpperBound(height_2);
315 EXPECT_LE(derived_2.GetHeight(), height_2); 313 EXPECT_LE(derived_2.GetHeight(), height_2);
316 EXPECT_EQ(font_list.GetHeight(), derived_2.GetHeight()); 314 EXPECT_EQ(font_list.GetHeight(), derived_2.GetHeight());
317 EXPECT_EQ(font_list.GetFontSize(), derived_2.GetFontSize()); 315 EXPECT_EQ(font_list.GetFontSize(), derived_2.GetFontSize());
318 } 316 }
319 317
320 } // namespace gfx 318 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/font_fallback_win.cc ('k') | ui/gfx/font_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698