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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 } | 231 } |
232 return result; | 232 return result; |
233 } | 233 } |
234 | 234 |
235 void PressKey(ui::KeyboardCode code) { | 235 void PressKey(ui::KeyboardCode code) { |
236 ui::KeyEvent event(ui::ET_KEY_PRESSED, code, ui::EF_NONE); | 236 ui::KeyEvent event(ui::ET_KEY_PRESSED, code, ui::EF_NONE); |
237 table_->OnKeyPressed(event); | 237 table_->OnKeyPressed(event); |
238 } | 238 } |
239 | 239 |
240 protected: | 240 protected: |
241 scoped_ptr<TestTableModel2> model_; | 241 std::unique_ptr<TestTableModel2> model_; |
242 | 242 |
243 // Owned by |parent_|. | 243 // Owned by |parent_|. |
244 TableView* table_; | 244 TableView* table_; |
245 | 245 |
246 scoped_ptr<TableViewTestHelper> helper_; | 246 std::unique_ptr<TableViewTestHelper> helper_; |
247 | 247 |
248 private: | 248 private: |
249 scoped_ptr<View> parent_; | 249 std::unique_ptr<View> parent_; |
250 | 250 |
251 DISALLOW_COPY_AND_ASSIGN(TableViewTest); | 251 DISALLOW_COPY_AND_ASSIGN(TableViewTest); |
252 }; | 252 }; |
253 | 253 |
254 // Verifies GetPaintRegion. | 254 // Verifies GetPaintRegion. |
255 TEST_F(TableViewTest, GetPaintRegion) { | 255 TEST_F(TableViewTest, GetPaintRegion) { |
256 // Two columns should be visible. | 256 // Two columns should be visible. |
257 EXPECT_EQ(2u, helper_->visible_col_count()); | 257 EXPECT_EQ(2u, helper_->visible_col_count()); |
258 | 258 |
259 EXPECT_EQ("rows=0 4 cols=0 2", helper_->GetPaintRegion(table_->bounds())); | 259 EXPECT_EQ("rows=0 4 cols=0 2", helper_->GetPaintRegion(table_->bounds())); |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 new_selection.AddIndexToSelection(0); | 914 new_selection.AddIndexToSelection(0); |
915 new_selection.AddIndexToSelection(1); | 915 new_selection.AddIndexToSelection(1); |
916 new_selection.set_active(0); | 916 new_selection.set_active(0); |
917 new_selection.set_anchor(0); | 917 new_selection.set_anchor(0); |
918 helper_->SetSelectionModel(new_selection); | 918 helper_->SetSelectionModel(new_selection); |
919 model_->RemoveRow(0); | 919 model_->RemoveRow(0); |
920 helper_->OnFocus(); | 920 helper_->OnFocus(); |
921 } | 921 } |
922 | 922 |
923 } // namespace views | 923 } // namespace views |
OLD | NEW |