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/app_list/views/apps_grid_view.h" | 5 #include "ui/app_list/views/apps_grid_view.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 SimulateDrag(AppsGridView::MOUSE, from, to); | 401 SimulateDrag(AppsGridView::MOUSE, from, to); |
402 apps_grid_view_->EndDrag(false); | 402 apps_grid_view_->EndDrag(false); |
403 EXPECT_EQ(2u, model_->top_level_item_list()->item_count()); | 403 EXPECT_EQ(2u, model_->top_level_item_list()->item_count()); |
404 EXPECT_EQ(folder_item->id(), model_->top_level_item_list()->item_at(0)->id()); | 404 EXPECT_EQ(folder_item->id(), model_->top_level_item_list()->item_at(0)->id()); |
405 EXPECT_EQ(kMaxFolderItems, folder_item->ChildItemCount()); | 405 EXPECT_EQ(kMaxFolderItems, folder_item->ChildItemCount()); |
406 EXPECT_EQ(model_->GetItemName(kMaxFolderItems), | 406 EXPECT_EQ(model_->GetItemName(kMaxFolderItems), |
407 model_->top_level_item_list()->item_at(1)->id()); | 407 model_->top_level_item_list()->item_at(1)->id()); |
408 test_api_->LayoutToIdealBounds(); | 408 test_api_->LayoutToIdealBounds(); |
409 | 409 |
410 // Dragging the last item over the folder, the folder won't accept the new | 410 // Dragging the last item over the folder, the folder won't accept the new |
411 // item, instead, it will re-order the items. | 411 // item. |
412 SimulateDrag(AppsGridView::MOUSE, from, to); | 412 SimulateDrag(AppsGridView::MOUSE, from, to); |
413 apps_grid_view_->EndDrag(false); | 413 apps_grid_view_->EndDrag(false); |
414 EXPECT_EQ(2u, model_->top_level_item_list()->item_count()); | 414 EXPECT_EQ(2u, model_->top_level_item_list()->item_count()); |
415 EXPECT_EQ(model_->GetItemName(kMaxFolderItems), | |
416 model_->top_level_item_list()->item_at(0)->id()); | |
417 EXPECT_EQ(folder_item->id(), model_->top_level_item_list()->item_at(1)->id()); | |
418 EXPECT_EQ(kMaxFolderItems, folder_item->ChildItemCount()); | 415 EXPECT_EQ(kMaxFolderItems, folder_item->ChildItemCount()); |
419 test_api_->LayoutToIdealBounds(); | 416 test_api_->LayoutToIdealBounds(); |
420 } | 417 } |
421 | 418 |
422 TEST_F(AppsGridViewTest, MouseDragItemReorder) { | 419 TEST_F(AppsGridViewTest, MouseDragItemReorder) { |
423 // This test assumes Folders are enabled. | 420 // This test assumes Folders are enabled. |
424 EnsureFoldersEnabled(); | 421 EnsureFoldersEnabled(); |
425 | 422 |
426 size_t kTotalItems = 2; | 423 size_t kTotalItems = 2; |
427 model_->PopulateApps(kTotalItems); | 424 model_->PopulateApps(kTotalItems); |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 AppListItemView* item_view = GetItemViewAt(0); | 706 AppListItemView* item_view = GetItemViewAt(0); |
710 ASSERT_TRUE(item_view); | 707 ASSERT_TRUE(item_view); |
711 const views::Label* title_label = item_view->title(); | 708 const views::Label* title_label = item_view->title(); |
712 EXPECT_FALSE(title_label->GetTooltipText( | 709 EXPECT_FALSE(title_label->GetTooltipText( |
713 title_label->bounds().CenterPoint(), &actual_tooltip)); | 710 title_label->bounds().CenterPoint(), &actual_tooltip)); |
714 EXPECT_EQ(title, base::UTF16ToUTF8(title_label->text())); | 711 EXPECT_EQ(title, base::UTF16ToUTF8(title_label->text())); |
715 } | 712 } |
716 | 713 |
717 } // namespace test | 714 } // namespace test |
718 } // namespace app_list | 715 } // namespace app_list |
OLD | NEW |