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

Unified Diff: ui/views/controls/table/table_view_unittest.cc

Issue 2769243002: Adjust initial activation/focus Task Manager/Views TableView. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/table/table_view_unittest.cc
diff --git a/ui/views/controls/table/table_view_unittest.cc b/ui/views/controls/table/table_view_unittest.cc
index d72345c69be3b05b8091f9cbc9739b6697405dda..9bbc97b6a278d024c77f2beb6002d60b2d8780e7 100644
--- a/ui/views/controls/table/table_view_unittest.cc
+++ b/ui/views/controls/table/table_view_unittest.cc
@@ -1023,4 +1023,19 @@ TEST_F(TableViewTest, FocusAfterRemovingAnchor) {
helper_->OnFocus();
}
+// Tests that focusing the table will activate the first row, but only if
+// there's no active row.
+TEST_F(TableViewTest, InitialFocusActivatesFirstRow) {
+ EXPECT_EQ(-1, table_->selection_model().active());
+ helper_->OnFocus();
+ EXPECT_EQ(0, table_->selection_model().active());
+
+ ui::ListSelectionModel new_selection;
+ new_selection.set_active(1);
+ helper_->SetSelectionModel(new_selection);
+ EXPECT_EQ(1, table_->selection_model().active());
+ helper_->OnFocus();
+ EXPECT_EQ(1, table_->selection_model().active());
+}
+
} // namespace views
« ui/views/controls/table/table_view.cc ('K') | « ui/views/controls/table/table_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698