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

Side by Side Diff: ui/app_list/views/apps_grid_view_unittest.cc

Issue 553753003: Rework app list item drag zones. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fasdaj
Patch Set: Created 6 years, 3 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
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/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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 // This test assumes Folders are enabled. 420 // This test assumes Folders are enabled.
421 EnsureFoldersEnabled(); 421 EnsureFoldersEnabled();
422 422
423 size_t kTotalItems = 2; 423 size_t kTotalItems = 2;
424 model_->PopulateApps(kTotalItems); 424 model_->PopulateApps(kTotalItems);
425 EXPECT_EQ(2u, model_->top_level_item_list()->item_count()); 425 EXPECT_EQ(2u, model_->top_level_item_list()->item_count());
426 EXPECT_EQ(std::string("Item 0,Item 1"), model_->GetModelContent()); 426 EXPECT_EQ(std::string("Item 0,Item 1"), model_->GetModelContent());
427 427
428 gfx::Point from = GetItemTileRectAt(0, 1).CenterPoint(); 428 gfx::Point from = GetItemTileRectAt(0, 1).CenterPoint();
429 int reorder_offset = (GetItemTileRectAt(0, 1).CenterPoint() - 429 int reorder_offset = (GetItemTileRectAt(0, 1).CenterPoint() -
430 GetItemTileRectAt(0, 0).CenterPoint()).Length() - 430 GetItemTileRectAt(0, 0).origin()).Length();
431 kReorderDroppingCircleRadius - kGridIconDimension / 2 +
432 5;
433 gfx::Point to = gfx::Point(from.x() - reorder_offset, from.y()); 431 gfx::Point to = gfx::Point(from.x() - reorder_offset, from.y());
434 432
435 // Dragging item_1 closing to item_0 should leads to re-ordering these two 433 // Dragging item_1 closing to item_0 should leads to re-ordering these two
436 // items. 434 // items.
437 SimulateDrag(AppsGridView::MOUSE, from, to); 435 SimulateDrag(AppsGridView::MOUSE, from, to);
438 apps_grid_view_->EndDrag(false); 436 apps_grid_view_->EndDrag(false);
439 EXPECT_EQ(2u, model_->top_level_item_list()->item_count()); 437 EXPECT_EQ(2u, model_->top_level_item_list()->item_count());
440 EXPECT_EQ(std::string("Item 1,Item 0"), model_->GetModelContent()); 438 EXPECT_EQ(std::string("Item 1,Item 0"), model_->GetModelContent());
441 test_api_->LayoutToIdealBounds(); 439 test_api_->LayoutToIdealBounds();
442 } 440 }
tapted 2014/09/11 08:08:55 I think you need to add more here - at least to co
calamity 2014/09/15 03:26:11 Added a couple. Any other cases you can think of t
tapted 2014/09/15 06:12:53 That's good i think - I think you've got most of t
443 441
444 TEST_F(AppsGridViewTest, MouseDragFolderReorder) { 442 TEST_F(AppsGridViewTest, MouseDragFolderReorder) {
445 EnsureFoldersEnabled(); 443 EnsureFoldersEnabled();
446 444
447 size_t kTotalItems = 2; 445 size_t kTotalItems = 2;
448 model_->CreateAndPopulateFolderWithApps(kTotalItems); 446 model_->CreateAndPopulateFolderWithApps(kTotalItems);
449 model_->PopulateAppWithId(kTotalItems); 447 model_->PopulateAppWithId(kTotalItems);
450 EXPECT_EQ(2u, model_->top_level_item_list()->item_count()); 448 EXPECT_EQ(2u, model_->top_level_item_list()->item_count());
451 EXPECT_EQ(AppListFolderItem::kItemType, 449 EXPECT_EQ(AppListFolderItem::kItemType,
452 model_->top_level_item_list()->item_at(0)->GetItemType()); 450 model_->top_level_item_list()->item_at(0)->GetItemType());
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 AppListItemView* item_view = GetItemViewAt(0); 704 AppListItemView* item_view = GetItemViewAt(0);
707 ASSERT_TRUE(item_view); 705 ASSERT_TRUE(item_view);
708 const views::Label* title_label = item_view->title(); 706 const views::Label* title_label = item_view->title();
709 EXPECT_FALSE(title_label->GetTooltipText( 707 EXPECT_FALSE(title_label->GetTooltipText(
710 title_label->bounds().CenterPoint(), &actual_tooltip)); 708 title_label->bounds().CenterPoint(), &actual_tooltip));
711 EXPECT_EQ(title, base::UTF16ToUTF8(title_label->text())); 709 EXPECT_EQ(title, base::UTF16ToUTF8(title_label->text()));
712 } 710 }
713 711
714 } // namespace test 712 } // namespace test
715 } // namespace app_list 713 } // namespace app_list
OLDNEW
« ui/app_list/views/apps_grid_view.cc ('K') | « ui/app_list/views/apps_grid_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698