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

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

Issue 6192007: Remove wstring from views. Part 3: Switch accessibility strings to string16.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | « views/controls/label.cc ('k') | views/controls/menu/menu_item_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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/l10n_util.h" 5 #include "app/l10n_util.h"
6 #include "base/i18n/rtl.h" 6 #include "base/i18n/rtl.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "gfx/canvas.h" 8 #include "gfx/canvas.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "views/border.h" 10 #include "views/border.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // Verify that setting the tooltip still shows it. 149 // Verify that setting the tooltip still shows it.
150 label.SetTooltipText(tooltip_text); 150 label.SetTooltipText(tooltip_text);
151 EXPECT_TRUE(label.GetTooltipText(gfx::Point(), &tooltip)); 151 EXPECT_TRUE(label.GetTooltipText(gfx::Point(), &tooltip));
152 EXPECT_EQ(tooltip_text, tooltip); 152 EXPECT_EQ(tooltip_text, tooltip);
153 // Clear out the tooltip. 153 // Clear out the tooltip.
154 label.SetTooltipText(empty_text); 154 label.SetTooltipText(empty_text);
155 } 155 }
156 156
157 TEST(LabelTest, Accessibility) { 157 TEST(LabelTest, Accessibility) {
158 Label label; 158 Label label;
159 std::wstring test_text(L"My special text."); 159 string16 test_text(ASCIIToUTF16("My special text."));
160 label.SetText(test_text); 160 label.SetText(UTF16ToWideHack(test_text));
161 161
162 EXPECT_EQ(AccessibilityTypes::ROLE_STATICTEXT, label.GetAccessibleRole()); 162 EXPECT_EQ(AccessibilityTypes::ROLE_STATICTEXT, label.GetAccessibleRole());
163 163
164 std::wstring name; 164 string16 name;
165 EXPECT_TRUE(label.GetAccessibleName(&name)); 165 EXPECT_TRUE(label.GetAccessibleName(&name));
166 EXPECT_EQ(test_text, name); 166 EXPECT_EQ(test_text, name);
167 167
168 EXPECT_TRUE(AccessibilityTypes::STATE_READONLY & label.GetAccessibleState()); 168 EXPECT_TRUE(AccessibilityTypes::STATE_READONLY & label.GetAccessibleState());
169 } 169 }
170 170
171 TEST(LabelTest, SingleLineSizing) { 171 TEST(LabelTest, SingleLineSizing) {
172 Label label; 172 Label label;
173 std::wstring test_text(L"A not so random string in one line."); 173 std::wstring test_text(L"A not so random string in one line.");
174 label.SetText(test_text); 174 label.SetText(test_text);
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 gfx::Canvas::TEXT_ALIGN_LEFT | 807 gfx::Canvas::TEXT_ALIGN_LEFT |
808 gfx::Canvas::NO_ELLIPSIS, 808 gfx::Canvas::NO_ELLIPSIS,
809 flags); 809 flags);
810 #endif 810 #endif
811 811
812 // Reset Locale 812 // Reset Locale
813 base::i18n::SetICUDefaultLocale(locale); 813 base::i18n::SetICUDefaultLocale(locale);
814 } 814 }
815 815
816 } // namespace views 816 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/label.cc ('k') | views/controls/menu/menu_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698