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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 | 478 |
479 // Dragging an item towards its neighbours should not reorder until the drag | 479 // Dragging an item towards its neighbours should not reorder until the drag |
480 // is past the folder drop point. | 480 // is past the folder drop point. |
481 gfx::Point top_right = GetItemTileRectAt(0, 1).CenterPoint(); | 481 gfx::Point top_right = GetItemTileRectAt(0, 1).CenterPoint(); |
482 gfx::Vector2d drag_vector; | 482 gfx::Vector2d drag_vector; |
483 int half_tile_width = | 483 int half_tile_width = |
484 (GetItemTileRectAt(0, 1).x() - GetItemTileRectAt(0, 0).x()) / 2; | 484 (GetItemTileRectAt(0, 1).x() - GetItemTileRectAt(0, 0).x()) / 2; |
485 int tile_height = GetItemTileRectAt(1, 0).y() - GetItemTileRectAt(0, 0).y(); | 485 int tile_height = GetItemTileRectAt(1, 0).y() - GetItemTileRectAt(0, 0).y(); |
486 | 486 |
487 // Drag left but stop before the folder dropping circle. | 487 // Drag left but stop before the folder dropping circle. |
488 drag_vector.set_x(-half_tile_width - 5); | 488 drag_vector.set_x(-half_tile_width - 4); |
489 SimulateDrag(AppsGridView::MOUSE, top_right, top_right + drag_vector); | 489 SimulateDrag(AppsGridView::MOUSE, top_right, top_right + drag_vector); |
490 apps_grid_view_->EndDrag(false); | 490 apps_grid_view_->EndDrag(false); |
491 EXPECT_EQ(std::string("Item 0,Item 1,Item 2,Item 3"), | 491 EXPECT_EQ(std::string("Item 0,Item 1,Item 2,Item 3"), |
492 model_->GetModelContent()); | 492 model_->GetModelContent()); |
493 | 493 |
494 // Drag left, past the folder dropping circle. | 494 // Drag left, past the folder dropping circle. |
495 drag_vector.set_x(-3 * half_tile_width + 5); | 495 drag_vector.set_x(-3 * half_tile_width + 4); |
496 SimulateDrag(AppsGridView::MOUSE, top_right, top_right + drag_vector); | 496 SimulateDrag(AppsGridView::MOUSE, top_right, top_right + drag_vector); |
497 apps_grid_view_->EndDrag(false); | 497 apps_grid_view_->EndDrag(false); |
498 EXPECT_EQ(std::string("Item 1,Item 0,Item 2,Item 3"), | 498 EXPECT_EQ(std::string("Item 1,Item 0,Item 2,Item 3"), |
499 model_->GetModelContent()); | 499 model_->GetModelContent()); |
500 | 500 |
501 // Drag down, between apps 2 and 3. The gap should open up, making space for | 501 // Drag down, between apps 2 and 3. The gap should open up, making space for |
502 // app 0 in the bottom left. | 502 // app 0 in the bottom left. |
503 drag_vector.set_x(-half_tile_width); | 503 drag_vector.set_x(-half_tile_width); |
504 drag_vector.set_y(tile_height); | 504 drag_vector.set_y(tile_height); |
505 SimulateDrag(AppsGridView::MOUSE, top_right, top_right + drag_vector); | 505 SimulateDrag(AppsGridView::MOUSE, top_right, top_right + drag_vector); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 AppListItemView* item_view = GetItemViewAt(0); | 791 AppListItemView* item_view = GetItemViewAt(0); |
792 ASSERT_TRUE(item_view); | 792 ASSERT_TRUE(item_view); |
793 const views::Label* title_label = item_view->title(); | 793 const views::Label* title_label = item_view->title(); |
794 EXPECT_FALSE(title_label->GetTooltipText( | 794 EXPECT_FALSE(title_label->GetTooltipText( |
795 title_label->bounds().CenterPoint(), &actual_tooltip)); | 795 title_label->bounds().CenterPoint(), &actual_tooltip)); |
796 EXPECT_EQ(title, base::UTF16ToUTF8(title_label->text())); | 796 EXPECT_EQ(title, base::UTF16ToUTF8(title_label->text())); |
797 } | 797 } |
798 | 798 |
799 } // namespace test | 799 } // namespace test |
800 } // namespace app_list | 800 } // namespace app_list |
OLD | NEW |