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

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

Issue 2860883003: A11y: Add/refactor methods for manipulating bitfields on AXNodeData. (Closed)
Patch Set: Delete AXNodeData::Init() and clear bitfields in AXNodeData() instead. Created 3 years, 7 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 label()->SetTooltipText(base::string16()); 491 label()->SetTooltipText(base::string16());
492 } 492 }
493 493
494 TEST_F(LabelTest, Accessibility) { 494 TEST_F(LabelTest, Accessibility) {
495 label()->SetText(ASCIIToUTF16("My special text.")); 495 label()->SetText(ASCIIToUTF16("My special text."));
496 496
497 ui::AXNodeData node_data; 497 ui::AXNodeData node_data;
498 label()->GetAccessibleNodeData(&node_data); 498 label()->GetAccessibleNodeData(&node_data);
499 EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, node_data.role); 499 EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, node_data.role);
500 EXPECT_EQ(label()->text(), node_data.GetString16Attribute(ui::AX_ATTR_NAME)); 500 EXPECT_EQ(label()->text(), node_data.GetString16Attribute(ui::AX_ATTR_NAME));
501 EXPECT_TRUE(node_data.HasStateFlag(ui::AX_STATE_READ_ONLY)); 501 EXPECT_TRUE(node_data.HasState(ui::AX_STATE_READ_ONLY));
502 } 502 }
503 503
504 TEST_F(LabelTest, TextChangeWithoutLayout) { 504 TEST_F(LabelTest, TextChangeWithoutLayout) {
505 label()->SetText(ASCIIToUTF16("Example")); 505 label()->SetText(ASCIIToUTF16("Example"));
506 label()->SetBounds(0, 0, 200, 200); 506 label()->SetBounds(0, 0, 200, 200);
507 507
508 gfx::Canvas canvas(gfx::Size(200, 200), 1.0f, true); 508 gfx::Canvas canvas(gfx::Size(200, 200), 1.0f, true);
509 label()->OnPaint(&canvas); 509 label()->OnPaint(&canvas);
510 EXPECT_EQ(1u, label()->lines_.size()); 510 EXPECT_EQ(1u, label()->lines_.size());
511 EXPECT_EQ(ASCIIToUTF16("Example"), label()->lines_[0]->GetDisplayText()); 511 EXPECT_EQ(ASCIIToUTF16("Example"), label()->lines_[0]->GetDisplayText());
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 EXPECT_FALSE(IsMenuCommandEnabled(IDS_APP_SELECT_ALL)); 1188 EXPECT_FALSE(IsMenuCommandEnabled(IDS_APP_SELECT_ALL));
1189 } 1189 }
1190 1190
1191 INSTANTIATE_TEST_CASE_P(, 1191 INSTANTIATE_TEST_CASE_P(,
1192 MDLabelTest, 1192 MDLabelTest,
1193 ::testing::Values(SecondaryUiMode::MD, 1193 ::testing::Values(SecondaryUiMode::MD,
1194 SecondaryUiMode::NON_MD), 1194 SecondaryUiMode::NON_MD),
1195 &SecondaryUiModeToString); 1195 &SecondaryUiModeToString);
1196 1196
1197 } // namespace views 1197 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698