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

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

Issue 79263004: Enables font-related unittests again. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | « no previous file | ui/gfx/render_text_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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 282
283 FontList derived = 283 FontList derived =
284 font_list.DeriveFontListWithSizeDeltaAndStyle(5, Font::BOLD); 284 font_list.DeriveFontListWithSizeDeltaAndStyle(5, Font::BOLD);
285 const std::vector<Font>& derived_fonts = derived.GetFonts(); 285 const std::vector<Font>& derived_fonts = derived.GetFonts();
286 286
287 EXPECT_EQ(2U, derived_fonts.size()); 287 EXPECT_EQ(2U, derived_fonts.size());
288 EXPECT_EQ("Arial|13|bold", FontToString(derived_fonts[0])); 288 EXPECT_EQ("Arial|13|bold", FontToString(derived_fonts[0]));
289 EXPECT_EQ("Sans serif|13|bold", FontToString(derived_fonts[1])); 289 EXPECT_EQ("Sans serif|13|bold", FontToString(derived_fonts[1]));
290 } 290 }
291 291
292 // Disabled. http://crbug.com/316955 292 TEST(FontListTest, Fonts_GetHeight_GetBaseline) {
293 TEST(FontListTest, DISABLED_Fonts_GetHeight_GetBaseline) {
294 // If a font list has only one font, the height and baseline must be the same. 293 // If a font list has only one font, the height and baseline must be the same.
295 Font font1("Arial", 16); 294 Font font1("Arial", 16);
296 FontList font_list1("Arial, 16px"); 295 FontList font_list1("Arial, 16px");
297 EXPECT_EQ(font1.GetHeight(), font_list1.GetHeight()); 296 EXPECT_EQ(font1.GetHeight(), font_list1.GetHeight());
298 EXPECT_EQ(font1.GetBaseline(), font_list1.GetBaseline()); 297 EXPECT_EQ(font1.GetBaseline(), font_list1.GetBaseline());
299 298
300 // If there are two different fonts, the font list returns the max value 299 // If there are two different fonts, the font list returns the max value
301 // for ascent and descent. 300 // for ascent and descent.
302 Font font2("Symbol", 16); 301 Font font2("Symbol", 16);
msw 2013/11/21 17:07:36 ASSERT_EQ("Symbol", font2.GetFontName()) or simila
303 EXPECT_NE(font1.GetBaseline(), font2.GetBaseline()); 302 EXPECT_NE(font1.GetBaseline(), font2.GetBaseline());
304 EXPECT_NE(font1.GetHeight() - font1.GetBaseline(), 303 EXPECT_NE(font1.GetHeight() - font1.GetBaseline(),
305 font2.GetHeight() - font2.GetBaseline()); 304 font2.GetHeight() - font2.GetBaseline());
306 std::vector<Font> fonts; 305 std::vector<Font> fonts;
307 fonts.push_back(font1); 306 fonts.push_back(font1);
308 fonts.push_back(font2); 307 fonts.push_back(font2);
309 FontList font_list_mix(fonts); 308 FontList font_list_mix(fonts);
310 // ascent of FontList == max(ascent of Fonts) 309 // ascent of FontList == max(ascent of Fonts)
311 EXPECT_EQ(std::max(font1.GetHeight() - font1.GetBaseline(), 310 EXPECT_EQ(std::max(font1.GetHeight() - font1.GetBaseline(),
312 font2.GetHeight() - font2.GetBaseline()), 311 font2.GetHeight() - font2.GetBaseline()),
313 font_list_mix.GetHeight() - font_list_mix.GetBaseline()); 312 font_list_mix.GetHeight() - font_list_mix.GetBaseline());
314 // descent of FontList == max(descent of Fonts) 313 // descent of FontList == max(descent of Fonts)
315 EXPECT_EQ(std::max(font1.GetBaseline(), font2.GetBaseline()), 314 EXPECT_EQ(std::max(font1.GetBaseline(), font2.GetBaseline()),
316 font_list_mix.GetBaseline()); 315 font_list_mix.GetBaseline());
317 } 316 }
318 317
319 } // namespace gfx 318 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698