diff options
author | simonhong@chromium.org <simonhong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-13 14:42:50 +0000 |
---|---|---|
committer | simonhong@chromium.org <simonhong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-13 14:42:50 +0000 |
commit | 74095f04124d43e21f65692249afea5c30cc25ea (patch) | |
tree | 33ec5f233843f2ed1feede0e0e7d7bd7a3c9da63 /ash/shelf/shelf_view_unittest.cc | |
parent | 210451cc8198a0d3eedfba3b5f0b60dc52e47e2d (diff) | |
download | chromium_src-74095f04124d43e21f65692249afea5c30cc25ea.zip chromium_src-74095f04124d43e21f65692249afea5c30cc25ea.tar.gz chromium_src-74095f04124d43e21f65692249afea5c30cc25ea.tar.bz2 |
[ash] Can't rip off an item from left positioned shelf in secondary monitor
Root window coordinated point is passed to CalculateShelfDistance().
R=skuhne@chromium.org, jamescook@chromium.org
BUG=328226
TEST=ash_unittests --gtest_filter=ShelfViewTest.CheckRipOffFromLeftShelfAlignmentWithMultiMonitor
Review URL: https://codereview.chromium.org/113743002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240646 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/shelf/shelf_view_unittest.cc')
-rw-r--r-- | ash/shelf/shelf_view_unittest.cc | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc index d3e2b1d..ec1468a 100644 --- a/ash/shelf/shelf_view_unittest.cc +++ b/ash/shelf/shelf_view_unittest.cc @@ -29,6 +29,7 @@ #include "ash/test/shell_test_api.h" #include "ash/test/test_shelf_delegate.h" #include "ash/test/test_shelf_item_delegate.h" +#include "ash/wm/coordinate_conversion.h" #include "base/basictypes.h" #include "base/command_line.h" #include "base/compiler_specific.h" @@ -502,7 +503,7 @@ class ShelfViewTest : public AshTestBase { gfx::Point rip_off_point(center_point_of_drag_item.x(), 0); generator.MoveMouseTo(rip_off_point); test_api_for_overflow.RunMessageLoopUntilAnimationsDone(); - ASSERT_TRUE(test_api_for_overflow.IsDraggingShelfItem()); + ASSERT_TRUE(test_api_for_overflow.IsRippedOffFromShelf()); ASSERT_FALSE(test_api_for_overflow.DraggedItemFromOverflowToShelf()); // Move a dragged item into Shelf at |drop_index|. @@ -517,7 +518,7 @@ class ShelfViewTest : public AshTestBase { generator.MoveMouseTo(modified_drop_point); test_api_for_overflow.RunMessageLoopUntilAnimationsDone(); test_api_->RunMessageLoopUntilAnimationsDone(); - ASSERT_TRUE(test_api_for_overflow.IsDraggingShelfItem()); + ASSERT_TRUE(test_api_for_overflow.IsRippedOffFromShelf()); ASSERT_TRUE(test_api_for_overflow.DraggedItemFromOverflowToShelf()); if (cancel) @@ -527,7 +528,7 @@ class ShelfViewTest : public AshTestBase { test_api_for_overflow.RunMessageLoopUntilAnimationsDone(); test_api_->RunMessageLoopUntilAnimationsDone(); - ASSERT_FALSE(test_api_for_overflow.IsDraggingShelfItem()); + ASSERT_FALSE(test_api_for_overflow.IsRippedOffFromShelf()); ASSERT_FALSE(test_api_for_overflow.DraggedItemFromOverflowToShelf()); // Compare pre-stored items' id with newly positioned items' after dragging @@ -1671,6 +1672,47 @@ TEST_F(ShelfViewTest, CheckDragInsertBoundsWithMultiMonitor) { EXPECT_FALSE(drag_reinsert_bounds_in_secondary.Contains(point_in_shelf_view)); } +// Checks the rip an item off from left aligned shelf in secondary monitor. +TEST_F(ShelfViewTest, CheckRipOffFromLeftShelfAlignmentWithMultiMonitor) { + // win8-aura doesn't support multiple display. + if (!SupportsMultipleDisplays()) + return; + + UpdateDisplay("800x600,800x600"); + ASSERT_EQ(2U, Shell::GetAllRootWindows().size()); + + aura::Window* second_root = Shell::GetAllRootWindows()[1]; + + Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_LEFT, second_root); + ASSERT_EQ(SHELF_ALIGNMENT_LEFT, + Shell::GetInstance()->GetShelfAlignment(second_root)); + + // Initially, app list and browser shortcut are added. + EXPECT_EQ(2, model_->item_count()); + int browser_index = model_->GetItemIndexForType(TYPE_BROWSER_SHORTCUT); + EXPECT_GT(browser_index, 0); + + Launcher* secondary_launcher = Launcher::ForWindow(second_root); + internal::ShelfView* shelf_view_for_secondary = + test::LauncherTestAPI(secondary_launcher).shelf_view(); + + ShelfViewTestAPI test_api_for_secondary_shelf_view(shelf_view_for_secondary); + internal::ShelfButton* button = + test_api_for_secondary_shelf_view.GetButton(browser_index); + + // Fetch the start point of dragging. + gfx::Point start_point = button->GetBoundsInScreen().CenterPoint(); + wm::ConvertPointFromScreen(second_root, &start_point); + + aura::test::EventGenerator generator(second_root, start_point); + + // Rip off the browser item. + generator.PressLeftButton(); + generator.MoveMouseTo(start_point.x() + 400, start_point.y()); + test_api_for_secondary_shelf_view.RunMessageLoopUntilAnimationsDone(); + EXPECT_TRUE(test_api_for_secondary_shelf_view.IsRippedOffFromShelf()); +} + // Checks various drag and drop operations from OverflowBubble to Shelf. TEST_F(ShelfViewTest, CheckDragAndDropFromOverflowBubbleToShelf) { // Replace LauncherDelegate. |