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

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

Issue 196133012: Fix incorrect use of AXState caused when refactoring two enums into one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename SetStateFlag -> AddStateFlag Created 6 years, 8 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/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) 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 "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/accessibility/ax_view_state.h" 10 #include "ui/accessibility/ax_view_state.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 147
148 TEST(LabelTest, Accessibility) { 148 TEST(LabelTest, Accessibility) {
149 Label label; 149 Label label;
150 base::string16 test_text(ASCIIToUTF16("My special text.")); 150 base::string16 test_text(ASCIIToUTF16("My special text."));
151 label.SetText(test_text); 151 label.SetText(test_text);
152 152
153 ui::AXViewState state; 153 ui::AXViewState state;
154 label.GetAccessibleState(&state); 154 label.GetAccessibleState(&state);
155 EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, state.role); 155 EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, state.role);
156 EXPECT_EQ(test_text, state.name); 156 EXPECT_EQ(test_text, state.name);
157 EXPECT_TRUE(ui::AX_STATE_READ_ONLY & state.state); 157 EXPECT_TRUE(state.HasStateFlag(ui::AX_STATE_READ_ONLY));
158 } 158 }
159 159
160 TEST(LabelTest, SingleLineSizing) { 160 TEST(LabelTest, SingleLineSizing) {
161 Label label; 161 Label label;
162 base::string16 test_text(ASCIIToUTF16("A not so random string in one line.")); 162 base::string16 test_text(ASCIIToUTF16("A not so random string in one line."));
163 label.SetText(test_text); 163 label.SetText(test_text);
164 164
165 // GetPreferredSize 165 // GetPreferredSize
166 gfx::Size required_size = label.GetPreferredSize(); 166 gfx::Size required_size = label.GetPreferredSize();
167 EXPECT_GT(required_size.height(), kMinTextDimension); 167 EXPECT_GT(required_size.height(), kMinTextDimension);
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 EXPECT_FALSE(label.GetTooltipHandlerForPoint(gfx::Point(2, 51))); 913 EXPECT_FALSE(label.GetTooltipHandlerForPoint(gfx::Point(2, 51)));
914 EXPECT_FALSE(label.GetTooltipHandlerForPoint(gfx::Point(-1, 20))); 914 EXPECT_FALSE(label.GetTooltipHandlerForPoint(gfx::Point(-1, 20)));
915 915
916 // GetTooltipHandlerForPoint works should work in child bounds. 916 // GetTooltipHandlerForPoint works should work in child bounds.
917 label.SetBounds(2, 2, 10, 10); 917 label.SetBounds(2, 2, 10, 10);
918 EXPECT_EQ(&label, label.GetTooltipHandlerForPoint(gfx::Point(1, 5))); 918 EXPECT_EQ(&label, label.GetTooltipHandlerForPoint(gfx::Point(1, 5)));
919 EXPECT_FALSE(label.GetTooltipHandlerForPoint(gfx::Point(3, 11))); 919 EXPECT_FALSE(label.GetTooltipHandlerForPoint(gfx::Point(3, 11)));
920 } 920 }
921 921
922 } // namespace views 922 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/label.cc ('k') | ui/views/controls/menu/menu_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698