Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Side by Side Diff: ui/views/controls/label_unittest.cc

Issue 9837059: Cleanup for views::Label: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/label.cc ('k') | ui/views/controls/message_box_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/views/controls/label.cc ('k') | ui/views/controls/message_box_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698