| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |