| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/i18n/rtl.h" | 5 #include "base/i18n/rtl.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "ui/base/accessibility/accessible_view_state.h" | 8 #include "ui/base/accessibility/accessible_view_state.h" |
| 9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
| 10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| 11 #include "views/border.h" | 11 #include "views/border.h" |
| 12 #include "views/controls/label.h" | 12 #include "views/controls/label.h" |
| 13 | 13 |
| 14 namespace views { | 14 namespace views { |
| 15 | 15 |
| 16 // All text sizing measurements (width and height) should be greater than this. | 16 // All text sizing measurements (width and height) should be greater than this. |
| 17 const int kMinTextDimension = 4; | 17 const int kMinTextDimension = 4; |
| 18 | 18 |
| 19 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 20 // Courier is failing on linux because it's non scalable. | 20 // Courier is failing on linux because it's non scalable. |
| 21 TEST(LabelTest, FontPropertyCourier) { | 21 TEST(LabelTest, FontPropertyCourier) { |
| 22 Label label; | 22 Label label; |
| 23 string16 font_name(ASCIIToUTF16("courier")); | 23 std::string font_name("courier"); |
| 24 gfx::Font font(font_name, 30); | 24 gfx::Font font(font_name, 30); |
| 25 label.SetFont(font); | 25 label.SetFont(font); |
| 26 gfx::Font font_used = label.font(); | 26 gfx::Font font_used = label.font(); |
| 27 EXPECT_EQ(font_name, font_used.GetFontName()); | 27 EXPECT_EQ(font_name, font_used.GetFontName()); |
| 28 EXPECT_EQ(30, font_used.GetFontSize()); | 28 EXPECT_EQ(30, font_used.GetFontSize()); |
| 29 } | 29 } |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 TEST(LabelTest, FontPropertyArial) { | 32 TEST(LabelTest, FontPropertyArial) { |
| 33 Label label; | 33 Label label; |
| 34 string16 font_name(ASCIIToUTF16("arial")); | 34 std::string font_name("arial"); |
| 35 gfx::Font font(font_name, 30); | 35 gfx::Font font(font_name, 30); |
| 36 label.SetFont(font); | 36 label.SetFont(font); |
| 37 gfx::Font font_used = label.font(); | 37 gfx::Font font_used = label.font(); |
| 38 EXPECT_EQ(font_name, font_used.GetFontName()); | 38 EXPECT_EQ(font_name, font_used.GetFontName()); |
| 39 EXPECT_EQ(30, font_used.GetFontSize()); | 39 EXPECT_EQ(30, font_used.GetFontSize()); |
| 40 } | 40 } |
| 41 | 41 |
| 42 TEST(LabelTest, TextProperty) { | 42 TEST(LabelTest, TextProperty) { |
| 43 Label label; | 43 Label label; |
| 44 string16 test_text(ASCIIToUTF16("A random string.")); | 44 string16 test_text(ASCIIToUTF16("A random string.")); |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 gfx::Canvas::TEXT_ALIGN_LEFT | | 802 gfx::Canvas::TEXT_ALIGN_LEFT | |
| 803 gfx::Canvas::NO_ELLIPSIS, | 803 gfx::Canvas::NO_ELLIPSIS, |
| 804 flags); | 804 flags); |
| 805 #endif | 805 #endif |
| 806 | 806 |
| 807 // Reset Locale | 807 // Reset Locale |
| 808 base::i18n::SetICUDefaultLocale(locale); | 808 base::i18n::SetICUDefaultLocale(locale); |
| 809 } | 809 } |
| 810 | 810 |
| 811 } // namespace views | 811 } // namespace views |
| OLD | NEW |