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 "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 "ui/views/border.h" | 11 #include "ui/views/border.h" |
12 #include "ui/views/controls/label.h" | 12 #include "ui/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) |
msw
2012/04/26 22:14:13
Can't we just make the font name check Win specifi
Alexei Svitkine (slow)
2012/04/26 22:22:29
Yes, I think so.
Alexei Svitkine (slow)
2012/04/27 15:15:27
Done.
| |
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 std::string font_name("courier"); | 23 std::string font_name("courier"); |
24 gfx::Font font(font_name, 30); | 24 // Note: This test is size dependent since Courier does not support all sizes. |
25 gfx::Font font(font_name, 26); | |
25 label.SetFont(font); | 26 label.SetFont(font); |
26 gfx::Font font_used = label.font(); | 27 gfx::Font font_used = label.font(); |
27 EXPECT_EQ(font_name, font_used.GetFontName()); | 28 EXPECT_EQ(font_name, font_used.GetFontName()); |
28 EXPECT_EQ(30, font_used.GetFontSize()); | 29 EXPECT_EQ(26, font_used.GetFontSize()); |
29 } | 30 } |
30 #endif | 31 #endif |
31 | 32 |
32 TEST(LabelTest, FontPropertyArial) { | 33 TEST(LabelTest, FontPropertyArial) { |
33 Label label; | 34 Label label; |
34 std::string font_name("arial"); | 35 std::string font_name("arial"); |
35 gfx::Font font(font_name, 30); | 36 gfx::Font font(font_name, 30); |
36 label.SetFont(font); | 37 label.SetFont(font); |
37 gfx::Font font_used = label.font(); | 38 gfx::Font font_used = label.font(); |
38 EXPECT_EQ(font_name, font_used.GetFontName()); | 39 EXPECT_EQ(font_name, font_used.GetFontName()); |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
848 EXPECT_EQ( | 849 EXPECT_EQ( |
849 0, label.ComputeDrawStringFlags() & gfx::Canvas::NO_SUBPIXEL_RENDERING); | 850 0, label.ComputeDrawStringFlags() & gfx::Canvas::NO_SUBPIXEL_RENDERING); |
850 | 851 |
851 label.SetBackgroundColor(SkColorSetARGB(64, 255, 255, 255)); | 852 label.SetBackgroundColor(SkColorSetARGB(64, 255, 255, 255)); |
852 EXPECT_EQ( | 853 EXPECT_EQ( |
853 gfx::Canvas::NO_SUBPIXEL_RENDERING, | 854 gfx::Canvas::NO_SUBPIXEL_RENDERING, |
854 label.ComputeDrawStringFlags() & gfx::Canvas::NO_SUBPIXEL_RENDERING); | 855 label.ComputeDrawStringFlags() & gfx::Canvas::NO_SUBPIXEL_RENDERING); |
855 } | 856 } |
856 | 857 |
857 } // namespace views | 858 } // namespace views |
OLD | NEW |