| OLD | NEW |
| 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 "ui/views/controls/label.h" | 5 #include "ui/views/controls/label.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // All text sizing measurements (width and height) should be greater than this. | 46 // All text sizing measurements (width and height) should be greater than this. |
| 47 const int kMinTextDimension = 4; | 47 const int kMinTextDimension = 4; |
| 48 | 48 |
| 49 // A test utility function to set the application default text direction. | 49 // A test utility function to set the application default text direction. |
| 50 void SetRTL(bool rtl) { | 50 void SetRTL(bool rtl) { |
| 51 // Override the current locale/direction. | 51 // Override the current locale/direction. |
| 52 base::i18n::SetICUDefaultLocale(rtl ? "he" : "en"); | 52 base::i18n::SetICUDefaultLocale(rtl ? "he" : "en"); |
| 53 EXPECT_EQ(rtl, base::i18n::IsRTL()); | 53 EXPECT_EQ(rtl, base::i18n::IsRTL()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 TEST_F(LabelTest, FontPropertySymbol) { | 56 // Crashes on Linux only. http://crbug.com/612406 |
| 57 #if defined(OS_LINUX) |
| 58 #define MAYBE_FontPropertySymbol DISABLED_FontPropertySymbol |
| 59 #else |
| 60 #define MAYBE_FontPropertySymbol FontPropertySymbol |
| 61 #endif |
| 62 TEST_F(LabelTest, MAYBE_FontPropertySymbol) { |
| 57 Label label; | 63 Label label; |
| 58 std::string font_name("symbol"); | 64 std::string font_name("symbol"); |
| 59 gfx::Font font(font_name, 26); | 65 gfx::Font font(font_name, 26); |
| 60 label.SetFontList(gfx::FontList(font)); | 66 label.SetFontList(gfx::FontList(font)); |
| 61 gfx::Font font_used = label.font_list().GetPrimaryFont(); | 67 gfx::Font font_used = label.font_list().GetPrimaryFont(); |
| 62 EXPECT_EQ(font_name, font_used.GetFontName()); | 68 EXPECT_EQ(font_name, font_used.GetFontName()); |
| 63 EXPECT_EQ(26, font_used.GetFontSize()); | 69 EXPECT_EQ(26, font_used.GetFontSize()); |
| 64 } | 70 } |
| 65 | 71 |
| 66 TEST_F(LabelTest, FontPropertyArial) { | 72 TEST_F(LabelTest, FontPropertyArial) { |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 label()->SetFocusBehavior(View::FocusBehavior::ALWAYS); | 656 label()->SetFocusBehavior(View::FocusBehavior::ALWAYS); |
| 651 label()->RequestFocus(); | 657 label()->RequestFocus(); |
| 652 label()->SizeToPreferredSize(); | 658 label()->SizeToPreferredSize(); |
| 653 | 659 |
| 654 gfx::Rect focus_bounds = label()->GetFocusBounds(); | 660 gfx::Rect focus_bounds = label()->GetFocusBounds(); |
| 655 EXPECT_FALSE(focus_bounds.IsEmpty()); | 661 EXPECT_FALSE(focus_bounds.IsEmpty()); |
| 656 EXPECT_LT(label()->font_list().GetHeight(), focus_bounds.height()); | 662 EXPECT_LT(label()->font_list().GetHeight(), focus_bounds.height()); |
| 657 } | 663 } |
| 658 | 664 |
| 659 } // namespace views | 665 } // namespace views |
| OLD | NEW |