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

Side by Side Diff: ui/gfx/platform_font_mac_unittest.mm

Issue 1543183002: Switch to standard integer types in ui/gfx/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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/platform_font_mac.mm ('k') | ui/gfx/platform_font_win.h » ('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 <Cocoa/Cocoa.h> 5 #include <Cocoa/Cocoa.h>
6 #include <stddef.h>
6 7
8 #include "base/macros.h"
7 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/gfx/font.h" 10 #include "ui/gfx/font.h"
9 11
10 TEST(PlatformFontMacTest, DeriveFont) { 12 TEST(PlatformFontMacTest, DeriveFont) {
11 // Use a base font that support all traits. 13 // Use a base font that support all traits.
12 gfx::Font base_font("Helvetica", 13); 14 gfx::Font base_font("Helvetica", 13);
13 15
14 // Bold 16 // Bold
15 gfx::Font bold_font(base_font.Derive(0, gfx::Font::BOLD)); 17 gfx::Font bold_font(base_font.Derive(0, gfx::Font::BOLD));
16 NSFontTraitMask traits = [[NSFontManager sharedFontManager] 18 NSFontTraitMask traits = [[NSFontManager sharedFontManager]
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // (plus baseline). So the height depends on the rounding of the ascender, 92 // (plus baseline). So the height depends on the rounding of the ascender,
91 // and can be as much as 1 greater than the simple sum of floats. 93 // and can be as much as 1 greater than the simple sum of floats.
92 EXPECT_LE(sum, font.GetHeight()); 94 EXPECT_LE(sum, font.GetHeight());
93 EXPECT_GE(sum + 1, font.GetHeight()); 95 EXPECT_GE(sum + 1, font.GetHeight());
94 96
95 // Recreate the rounding performed for GetBaseLine(). 97 // Recreate the rounding performed for GetBaseLine().
96 EXPECT_EQ(ceil(ceil(ascender) - descender + leading), font.GetHeight()); 98 EXPECT_EQ(ceil(ceil(ascender) - descender + leading), font.GetHeight());
97 } 99 }
98 } 100 }
99 } 101 }
OLDNEW
« no previous file with comments | « ui/gfx/platform_font_mac.mm ('k') | ui/gfx/platform_font_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698