Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/l10n_util.h" | 5 #include "app/l10n_util.h" |
| 6 #include "base/i18n/rtl.h" | 6 #include "base/i18n/rtl.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "gfx/canvas.h" | 8 #include "gfx/canvas.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "views/border.h" | 10 #include "views/border.h" |
| 11 #include "views/controls/label.h" | 11 #include "views/controls/label.h" |
| 12 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 | 14 |
| 15 // All text sizing measurements (width and height) should be greater than this. | 15 // All text sizing measurements (width and height) should be greater than this. |
| 16 const int kMinTextDimension = 4; | 16 const int kMinTextDimension = 4; |
| 17 | 17 |
| 18 #if defined(WIN_OS) | 18 #if defined(WIN_OS) |
|
evanm
2011/01/11 21:56:47
This define is totally wrong :<
Avi (use Gerrit)
2011/01/11 22:15:28
Oh wow. Let's trybot this again...
| |
| 19 // Courier is failing on linux because it's non scalable. | 19 // Courier is failing on linux because it's non scalable. |
| 20 TEST(LabelTest, FontPropertyCourier) { | 20 TEST(LabelTest, FontPropertyCourier) { |
| 21 Label label; | 21 Label label; |
| 22 std::wstring font_name(L"courier"); | 22 string16 font_name(ASCIIToUTF16("courier")); |
| 23 gfx::Font font = gfx::Font::CreateFont(font_name, 30); | 23 gfx::Font font = gfx::Font::CreateFont(font_name, 30); |
| 24 label.SetFont(font); | 24 label.SetFont(font); |
| 25 gfx::Font font_used = label.font(); | 25 gfx::Font font_used = label.font(); |
| 26 EXPECT_EQ(font_name, font_used.FontName()); | 26 EXPECT_EQ(font_name, font_used.FontName()); |
| 27 EXPECT_EQ(30, font_used.FontSize()); | 27 EXPECT_EQ(30, font_used.FontSize()); |
| 28 } | 28 } |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 TEST(LabelTest, FontPropertyArial) { | 31 TEST(LabelTest, FontPropertyArial) { |
| 32 Label label; | 32 Label label; |
| 33 std::wstring font_name(L"arial"); | 33 string16 font_name(ASCIIToUTF16("arial")); |
| 34 gfx::Font font(font_name, 30); | 34 gfx::Font font(font_name, 30); |
| 35 label.SetFont(font); | 35 label.SetFont(font); |
| 36 gfx::Font font_used = label.font(); | 36 gfx::Font font_used = label.font(); |
| 37 EXPECT_EQ(font_name, font_used.GetFontName()); | 37 EXPECT_EQ(font_name, font_used.GetFontName()); |
| 38 EXPECT_EQ(30, font_used.GetFontSize()); | 38 EXPECT_EQ(30, font_used.GetFontSize()); |
| 39 } | 39 } |
| 40 | 40 |
| 41 TEST(LabelTest, TextProperty) { | 41 TEST(LabelTest, TextProperty) { |
| 42 Label label; | 42 Label label; |
| 43 std::wstring test_text(L"A random string."); | 43 std::wstring test_text(L"A random string."); |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 807 gfx::Canvas::TEXT_ALIGN_LEFT | | 807 gfx::Canvas::TEXT_ALIGN_LEFT | |
| 808 gfx::Canvas::NO_ELLIPSIS, | 808 gfx::Canvas::NO_ELLIPSIS, |
| 809 flags); | 809 flags); |
| 810 #endif | 810 #endif |
| 811 | 811 |
| 812 // Reset Locale | 812 // Reset Locale |
| 813 base::i18n::SetICUDefaultLocale(locale); | 813 base::i18n::SetICUDefaultLocale(locale); |
| 814 } | 814 } |
| 815 | 815 |
| 816 } // namespace views | 816 } // namespace views |
| OLD | NEW |