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

Side by Side Diff: app/gfx/font_unittest.cc

Issue 251054: Attempt 4 at fixing font size on linux. I think I finally got... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 | « app/gfx/font_skia.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "app/gfx/font.h" 5 #include "app/gfx/font.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace { 9 namespace {
10 10
(...skipping 13 matching lines...) Expand all
24 TEST_F(FontTest, LoadArialBold) { 24 TEST_F(FontTest, LoadArialBold) {
25 Font cf(Font::CreateFont(L"Arial", 16)); 25 Font cf(Font::CreateFont(L"Arial", 16));
26 Font bold(cf.DeriveFont(0, Font::BOLD)); 26 Font bold(cf.DeriveFont(0, Font::BOLD));
27 ASSERT_TRUE(bold.nativeFont()); 27 ASSERT_TRUE(bold.nativeFont());
28 ASSERT_EQ(bold.style(), Font::BOLD); 28 ASSERT_EQ(bold.style(), Font::BOLD);
29 } 29 }
30 30
31 TEST_F(FontTest, Ascent) { 31 TEST_F(FontTest, Ascent) {
32 Font cf(Font::CreateFont(L"Arial", 16)); 32 Font cf(Font::CreateFont(L"Arial", 16));
33 ASSERT_GT(cf.baseline(), 2); 33 ASSERT_GT(cf.baseline(), 2);
34 ASSERT_LT(cf.baseline(), 20);
35 } 34 }
36 35
37 TEST_F(FontTest, Height) { 36 TEST_F(FontTest, Height) {
38 Font cf(Font::CreateFont(L"Arial", 16)); 37 Font cf(Font::CreateFont(L"Arial", 16));
39 ASSERT_GT(cf.baseline(), 2); 38 ASSERT_LT(cf.baseline(), 22);
40 ASSERT_LT(cf.baseline(), 20);
41 } 39 }
42 40
43 TEST_F(FontTest, AvgWidths) { 41 TEST_F(FontTest, AvgWidths) {
44 Font cf(Font::CreateFont(L"Arial", 16)); 42 Font cf(Font::CreateFont(L"Arial", 16));
45 ASSERT_EQ(cf.GetExpectedTextWidth(0), 0); 43 ASSERT_EQ(cf.GetExpectedTextWidth(0), 0);
46 ASSERT_GT(cf.GetExpectedTextWidth(1), cf.GetExpectedTextWidth(0)); 44 ASSERT_GT(cf.GetExpectedTextWidth(1), cf.GetExpectedTextWidth(0));
47 ASSERT_GT(cf.GetExpectedTextWidth(2), cf.GetExpectedTextWidth(1)); 45 ASSERT_GT(cf.GetExpectedTextWidth(2), cf.GetExpectedTextWidth(1));
48 ASSERT_GT(cf.GetExpectedTextWidth(3), cf.GetExpectedTextWidth(2)); 46 ASSERT_GT(cf.GetExpectedTextWidth(3), cf.GetExpectedTextWidth(2));
49 } 47 }
50 48
(...skipping 18 matching lines...) Expand all
69 TEST_F(FontTest, DeriveFontKeepsOriginalSizeIfHeightOk) { 67 TEST_F(FontTest, DeriveFontKeepsOriginalSizeIfHeightOk) {
70 // This creates font of height -8. 68 // This creates font of height -8.
71 Font cf(Font::CreateFont(L"Arial", 6)); 69 Font cf(Font::CreateFont(L"Arial", 6));
72 Font derived_font = cf.DeriveFont(-2); 70 Font derived_font = cf.DeriveFont(-2);
73 LOGFONT font_info; 71 LOGFONT font_info;
74 GetObject(derived_font.hfont(), sizeof(LOGFONT), &font_info); 72 GetObject(derived_font.hfont(), sizeof(LOGFONT), &font_info);
75 EXPECT_EQ(-6, font_info.lfHeight); 73 EXPECT_EQ(-6, font_info.lfHeight);
76 } 74 }
77 #endif 75 #endif
78 } // anonymous namespace 76 } // anonymous namespace
OLDNEW
« no previous file with comments | « app/gfx/font_skia.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698