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" |
(...skipping 25 matching lines...) Expand all Loading... |
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.")); |
45 label.SetText(test_text); | 45 label.SetText(test_text); |
46 EXPECT_EQ(test_text, label.GetText()); | 46 EXPECT_EQ(test_text, label.text()); |
47 } | 47 } |
48 | 48 |
49 TEST(LabelTest, UrlProperty) { | 49 TEST(LabelTest, UrlProperty) { |
50 Label label; | 50 Label label; |
51 std::string my_url("http://www.orkut.com/some/Random/path"); | 51 std::string my_url("http://www.orkut.com/some/Random/path"); |
52 GURL url(my_url); | 52 GURL url(my_url); |
53 label.SetURL(url); | 53 label.SetURL(url); |
54 EXPECT_EQ(my_url, label.GetURL().spec()); | 54 EXPECT_EQ(UTF8ToUTF16(my_url), label.text()); |
55 EXPECT_EQ(UTF8ToUTF16(my_url), label.GetText()); | |
56 } | 55 } |
57 | 56 |
58 TEST(LabelTest, ColorProperty) { | 57 TEST(LabelTest, ColorProperty) { |
59 Label label; | 58 Label label; |
60 SkColor color = SkColorSetARGB(20, 40, 10, 5); | 59 SkColor color = SkColorSetARGB(20, 40, 10, 5); |
61 label.SetAutoColorReadabilityEnabled(false); | 60 label.SetAutoColorReadabilityEnabled(false); |
62 label.SetEnabledColor(color); | 61 label.SetEnabledColor(color); |
63 EXPECT_EQ(color, label.enabled_color()); | 62 EXPECT_EQ(color, label.enabled_color()); |
64 } | 63 } |
65 | 64 |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 EXPECT_EQ( | 848 EXPECT_EQ( |
850 0, label.ComputeDrawStringFlags() & gfx::Canvas::NO_SUBPIXEL_RENDERING); | 849 0, label.ComputeDrawStringFlags() & gfx::Canvas::NO_SUBPIXEL_RENDERING); |
851 | 850 |
852 label.SetBackgroundColor(SkColorSetARGB(64, 255, 255, 255)); | 851 label.SetBackgroundColor(SkColorSetARGB(64, 255, 255, 255)); |
853 EXPECT_EQ( | 852 EXPECT_EQ( |
854 gfx::Canvas::NO_SUBPIXEL_RENDERING, | 853 gfx::Canvas::NO_SUBPIXEL_RENDERING, |
855 label.ComputeDrawStringFlags() & gfx::Canvas::NO_SUBPIXEL_RENDERING); | 854 label.ComputeDrawStringFlags() & gfx::Canvas::NO_SUBPIXEL_RENDERING); |
856 } | 855 } |
857 | 856 |
858 } // namespace views | 857 } // namespace views |
OLD | NEW |