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

Side by Side Diff: views/controls/label_unittest.cc

Issue 113441: ChromeFont->gfx::Font... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: Created 11 years, 7 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 | « views/controls/label.cc ('k') | views/controls/link.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) 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/chrome_canvas.h" 5 #include "app/gfx/chrome_canvas.h"
6 #include "app/l10n_util.h" 6 #include "app/l10n_util.h"
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "views/border.h" 9 #include "views/border.h"
10 #include "views/controls/label.h" 10 #include "views/controls/label.h"
11 11
12 namespace views { 12 namespace views {
13 13
14 // All text sizing measurements (width and height) should be greater than this. 14 // All text sizing measurements (width and height) should be greater than this.
15 const int kMinTextDimension = 4; 15 const int kMinTextDimension = 4;
16 16
17 TEST(LabelTest, FontProperty) { 17 TEST(LabelTest, FontProperty) {
18 Label label; 18 Label label;
19 std::wstring font_name(L"courier"); 19 std::wstring font_name(L"courier");
20 ChromeFont font = ChromeFont::CreateFont(font_name, 30); 20 gfx::Font font = gfx::Font::CreateFont(font_name, 30);
21 label.SetFont(font); 21 label.SetFont(font);
22 ChromeFont font_used = label.GetFont(); 22 gfx::Font font_used = label.GetFont();
23 EXPECT_STREQ(font_name.c_str(), font_used.FontName().c_str()); 23 EXPECT_STREQ(font_name.c_str(), font_used.FontName().c_str());
24 EXPECT_EQ(30, font_used.FontSize()); 24 EXPECT_EQ(30, font_used.FontSize());
25 } 25 }
26 26
27 TEST(LabelTest, TextProperty) { 27 TEST(LabelTest, TextProperty) {
28 Label label; 28 Label label;
29 std::wstring test_text(L"A random string."); 29 std::wstring test_text(L"A random string.");
30 label.SetText(test_text); 30 label.SetText(test_text);
31 EXPECT_STREQ(test_text.c_str(), label.GetText().c_str()); 31 EXPECT_STREQ(test_text.c_str(), label.GetText().c_str());
32 } 32 }
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 label.CalculateDrawStringParams(&paint_text, &text_bounds, &flags); 432 label.CalculateDrawStringParams(&paint_text, &text_bounds, &flags);
433 EXPECT_STREQ(test_text.c_str(), paint_text.c_str()); 433 EXPECT_STREQ(test_text.c_str(), paint_text.c_str());
434 EXPECT_EQ(center_bounds.x() + border.left(), text_bounds.x()); 434 EXPECT_EQ(center_bounds.x() + border.left(), text_bounds.x());
435 EXPECT_EQ(center_bounds.y() + border.top(), text_bounds.y()); 435 EXPECT_EQ(center_bounds.y() + border.top(), text_bounds.y());
436 EXPECT_EQ(center_bounds.width(), text_bounds.width()); 436 EXPECT_EQ(center_bounds.width(), text_bounds.width());
437 EXPECT_EQ(center_bounds.height(), text_bounds.height()); 437 EXPECT_EQ(center_bounds.height(), text_bounds.height());
438 EXPECT_EQ(ChromeCanvas::MULTI_LINE | ChromeCanvas::TEXT_ALIGN_CENTER, flags); 438 EXPECT_EQ(ChromeCanvas::MULTI_LINE | ChromeCanvas::TEXT_ALIGN_CENTER, flags);
439 } 439 }
440 440
441 } // namespace views 441 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/label.cc ('k') | views/controls/link.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698