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

Side by Side Diff: ui/views/controls/table/table_view_unittest.cc

Issue 2785473003: views::TableView - request focus on tap. (Closed)
Patch Set: rebase Created 3 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
« no previous file with comments | « ui/views/controls/table/table_view.cc ('k') | no next file » | 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/table/table_view.h" 5 #include "ui/views/controls/table/table_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 // No touch on desktop Mac. Tracked in http://crbug.com/445520. 727 // No touch on desktop Mac. Tracked in http://crbug.com/445520.
728 #if !defined(OS_MACOSX) 728 #if !defined(OS_MACOSX)
729 // Verifies selection works by way of a gesture. 729 // Verifies selection works by way of a gesture.
730 TEST_F(TableViewTest, SelectOnTap) { 730 TEST_F(TableViewTest, SelectOnTap) {
731 // Initially no selection. 731 // Initially no selection.
732 EXPECT_EQ("active=-1 anchor=-1 selection=", SelectionStateAsString()); 732 EXPECT_EQ("active=-1 anchor=-1 selection=", SelectionStateAsString());
733 733
734 TableViewObserverImpl observer; 734 TableViewObserverImpl observer;
735 table_->set_observer(&observer); 735 table_->set_observer(&observer);
736 736
737 // Tap on the first row, should select it. 737 // Tap on the first row, should select it and focus the table.
738 EXPECT_FALSE(table_->HasFocus());
738 TapOnRow(0); 739 TapOnRow(0);
740 EXPECT_TRUE(table_->HasFocus());
739 EXPECT_EQ(1, observer.GetChangedCountAndClear()); 741 EXPECT_EQ(1, observer.GetChangedCountAndClear());
740 EXPECT_EQ("active=0 anchor=0 selection=0", SelectionStateAsString()); 742 EXPECT_EQ("active=0 anchor=0 selection=0", SelectionStateAsString());
741 743
742 table_->set_observer(NULL); 744 table_->set_observer(NULL);
743 } 745 }
744 #endif 746 #endif
745 747
746 // Verifies up/down correctly navigates through groups. 748 // Verifies up/down correctly navigates through groups.
747 TEST_F(TableViewTest, KeyUpDown) { 749 TEST_F(TableViewTest, KeyUpDown) {
748 // Configure the grouper so that there are three groups: 750 // Configure the grouper so that there are three groups:
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 new_selection.AddIndexToSelection(0); 1028 new_selection.AddIndexToSelection(0);
1027 new_selection.AddIndexToSelection(1); 1029 new_selection.AddIndexToSelection(1);
1028 new_selection.set_active(0); 1030 new_selection.set_active(0);
1029 new_selection.set_anchor(0); 1031 new_selection.set_anchor(0);
1030 helper_->SetSelectionModel(new_selection); 1032 helper_->SetSelectionModel(new_selection);
1031 model_->RemoveRow(0); 1033 model_->RemoveRow(0);
1032 table_->RequestFocus(); 1034 table_->RequestFocus();
1033 } 1035 }
1034 1036
1035 } // namespace views 1037 } // namespace views
OLDNEW
« no previous file with comments | « 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