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

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

Issue 470053004: [Win, Linux] Always display the avatar button text at the same size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: maybe made test better? Created 6 years, 3 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
« ui/gfx/font_list.h ('K') | « ui/gfx/font_list.cc ('k') | no next file » | 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 FontList font_list_mix(fonts); 279 FontList font_list_mix(fonts);
280 // ascent of FontList == max(ascent of Fonts) 280 // ascent of FontList == max(ascent of Fonts)
281 EXPECT_EQ(std::max(font1.GetHeight() - font1.GetBaseline(), 281 EXPECT_EQ(std::max(font1.GetHeight() - font1.GetBaseline(),
282 font2.GetHeight() - font2.GetBaseline()), 282 font2.GetHeight() - font2.GetBaseline()),
283 font_list_mix.GetHeight() - font_list_mix.GetBaseline()); 283 font_list_mix.GetHeight() - font_list_mix.GetBaseline());
284 // descent of FontList == max(descent of Fonts) 284 // descent of FontList == max(descent of Fonts)
285 EXPECT_EQ(std::max(font1.GetBaseline(), font2.GetBaseline()), 285 EXPECT_EQ(std::max(font1.GetBaseline(), font2.GetBaseline()),
286 font_list_mix.GetBaseline()); 286 font_list_mix.GetBaseline());
287 } 287 }
288 288
289 TEST(FontListTest, Fonts_DeriveWithHeightUpperBound) {
290 std::vector<Font> fonts;
291
292 fonts.push_back(gfx::Font("Arial", 18).Derive(0, Font::NORMAL));
msw 2014/08/28 21:43:51 Why do you need to derive the normal style for the
noms (inactive) 2014/08/29 17:10:29 Done.
293 fonts.push_back(gfx::Font("Sans serif", 18).Derive(0, Font::NORMAL));
294 fonts.push_back(gfx::Font("Symbol", 18).Derive(0, Font::NORMAL));
295 FontList font_list = FontList(fonts);
296
297 FontList derived = font_list.DeriveWithHeightUpperBound(
msw 2014/08/28 21:43:51 Maybe just do something like: const int height =
noms (inactive) 2014/08/29 17:10:29 I've done something along these lines, but without
298 font_list.GetHeight() - 6);
299 const std::vector<Font>& derived_fonts = derived.GetFonts();
300
301 EXPECT_EQ(3U, derived_fonts.size());
302 EXPECT_EQ("Arial|13", FontToString(derived_fonts[0]));
303 EXPECT_EQ("Sans serif|13", FontToString(derived_fonts[1]));
304 EXPECT_EQ("Symbol|13", FontToString(derived_fonts[2]));
305 }
306
289 } // namespace gfx 307 } // namespace gfx
OLDNEW
« ui/gfx/font_list.h ('K') | « ui/gfx/font_list.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698