| 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/ui/panels/base_panel_browser_test.h" | 8 #include "chrome/browser/ui/panels/base_panel_browser_test.h" |
| 9 #include "chrome/browser/ui/panels/detached_panel_collection.h" | 9 #include "chrome/browser/ui/panels/detached_panel_collection.h" |
| 10 #include "chrome/browser/ui/panels/docked_panel_collection.h" | 10 #include "chrome/browser/ui/panels/docked_panel_collection.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // All the tests here assume using mocked 800x600 display area for the | 25 // All the tests here assume using mocked 800x600 display area for the |
| 26 // primary monitor. Do the check now. | 26 // primary monitor. Do the check now. |
| 27 gfx::Rect primary_display_area = PanelManager::GetInstance()-> | 27 gfx::Rect primary_display_area = PanelManager::GetInstance()-> |
| 28 display_settings_provider()->GetPrimaryDisplayArea(); | 28 display_settings_provider()->GetPrimaryDisplayArea(); |
| 29 DCHECK(primary_display_area.width() == 800); | 29 DCHECK(primary_display_area.width() == 800); |
| 30 DCHECK(primary_display_area.height() == 600); | 30 DCHECK(primary_display_area.height() == 600); |
| 31 } | 31 } |
| 32 | 32 |
| 33 // Drag |panel| from its origin by the offset |delta|. | 33 // Drag |panel| from its origin by the offset |delta|. |
| 34 void DragPanelByDelta(Panel* panel, const gfx::Vector2d& delta) { | 34 void DragPanelByDelta(Panel* panel, const gfx::Vector2d& delta) { |
| 35 scoped_ptr<NativePanelTesting> panel_testing( | 35 std::unique_ptr<NativePanelTesting> panel_testing( |
| 36 CreateNativePanelTesting(panel)); | 36 CreateNativePanelTesting(panel)); |
| 37 gfx::Point mouse_location(panel->GetBounds().origin()); | 37 gfx::Point mouse_location(panel->GetBounds().origin()); |
| 38 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); | 38 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); |
| 39 panel_testing->DragTitlebar(mouse_location + delta); | 39 panel_testing->DragTitlebar(mouse_location + delta); |
| 40 panel_testing->FinishDragTitlebar(); | 40 panel_testing->FinishDragTitlebar(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 // Drag |panel| from its origin to |new_mouse_location|. | 43 // Drag |panel| from its origin to |new_mouse_location|. |
| 44 void DragPanelToMouseLocation(Panel* panel, | 44 void DragPanelToMouseLocation(Panel* panel, |
| 45 const gfx::Point& new_mouse_location) { | 45 const gfx::Point& new_mouse_location) { |
| 46 scoped_ptr<NativePanelTesting> panel_testing( | 46 std::unique_ptr<NativePanelTesting> panel_testing( |
| 47 CreateNativePanelTesting(panel)); | 47 CreateNativePanelTesting(panel)); |
| 48 gfx::Point mouse_location(panel->GetBounds().origin()); | 48 gfx::Point mouse_location(panel->GetBounds().origin()); |
| 49 panel_testing->PressLeftMouseButtonTitlebar(panel->GetBounds().origin()); | 49 panel_testing->PressLeftMouseButtonTitlebar(panel->GetBounds().origin()); |
| 50 panel_testing->DragTitlebar(new_mouse_location); | 50 panel_testing->DragTitlebar(new_mouse_location); |
| 51 panel_testing->FinishDragTitlebar(); | 51 panel_testing->FinishDragTitlebar(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 // Return the bounds of a panel given its initial bounds and the bounds of the | 54 // Return the bounds of a panel given its initial bounds and the bounds of the |
| 55 // panel above it. | 55 // panel above it. |
| 56 static gfx::Rect GetStackedAtBottomPanelBounds( | 56 static gfx::Rect GetStackedAtBottomPanelBounds( |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 return gfx::Vector2d( | 180 return gfx::Vector2d( |
| 181 PanelDragController::GetGluePanelDistanceThresholdForTesting() * 2, 0); | 181 PanelDragController::GetGluePanelDistanceThresholdForTesting() * 2, 0); |
| 182 } | 182 } |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragOneDockedPanel) { | 185 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragOneDockedPanel) { |
| 186 static const int big_delta_x = 70; | 186 static const int big_delta_x = 70; |
| 187 static const int big_delta_y = 30; // Do not exceed the threshold to detach. | 187 static const int big_delta_y = 30; // Do not exceed the threshold to detach. |
| 188 | 188 |
| 189 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 100, 100)); | 189 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 100, 100)); |
| 190 scoped_ptr<NativePanelTesting> panel_testing( | 190 std::unique_ptr<NativePanelTesting> panel_testing( |
| 191 CreateNativePanelTesting(panel)); | 191 CreateNativePanelTesting(panel)); |
| 192 gfx::Rect panel_old_bounds = panel->GetBounds(); | 192 gfx::Rect panel_old_bounds = panel->GetBounds(); |
| 193 | 193 |
| 194 // Drag left. | 194 // Drag left. |
| 195 gfx::Point mouse_location = panel_old_bounds.origin(); | 195 gfx::Point mouse_location = panel_old_bounds.origin(); |
| 196 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); | 196 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); |
| 197 EXPECT_EQ(panel_old_bounds, panel->GetBounds()); | 197 EXPECT_EQ(panel_old_bounds, panel->GetBounds()); |
| 198 | 198 |
| 199 mouse_location.Offset(-big_delta_x, 0); | 199 mouse_location.Offset(-big_delta_x, 0); |
| 200 panel_testing->DragTitlebar(mouse_location); | 200 panel_testing->DragTitlebar(mouse_location); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 EXPECT_EQ(panel_old_bounds, panel->GetBounds()); | 272 EXPECT_EQ(panel_old_bounds, panel->GetBounds()); |
| 273 | 273 |
| 274 PanelManager::GetInstance()->CloseAll(); | 274 PanelManager::GetInstance()->CloseAll(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragTwoDockedPanels) { | 277 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragTwoDockedPanels) { |
| 278 static const gfx::Vector2d small_delta(10, 0); | 278 static const gfx::Vector2d small_delta(10, 0); |
| 279 | 279 |
| 280 Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 100, 100)); | 280 Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 100, 100)); |
| 281 Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 100, 100)); | 281 Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 100, 100)); |
| 282 scoped_ptr<NativePanelTesting> panel1_testing( | 282 std::unique_ptr<NativePanelTesting> panel1_testing( |
| 283 CreateNativePanelTesting(panel1)); | 283 CreateNativePanelTesting(panel1)); |
| 284 scoped_ptr<NativePanelTesting> panel2_testing( | 284 std::unique_ptr<NativePanelTesting> panel2_testing( |
| 285 CreateNativePanelTesting(panel2)); | 285 CreateNativePanelTesting(panel2)); |
| 286 gfx::Point position1 = panel1->GetBounds().origin(); | 286 gfx::Point position1 = panel1->GetBounds().origin(); |
| 287 gfx::Point position2 = panel2->GetBounds().origin(); | 287 gfx::Point position2 = panel2->GetBounds().origin(); |
| 288 | 288 |
| 289 // Drag right panel towards left with small delta. | 289 // Drag right panel towards left with small delta. |
| 290 // Expect no shuffle: P1 P2 | 290 // Expect no shuffle: P1 P2 |
| 291 gfx::Point mouse_location = position1; | 291 gfx::Point mouse_location = position1; |
| 292 panel1_testing->PressLeftMouseButtonTitlebar(mouse_location); | 292 panel1_testing->PressLeftMouseButtonTitlebar(mouse_location); |
| 293 EXPECT_EQ(position1, panel1->GetBounds().origin()); | 293 EXPECT_EQ(position1, panel1->GetBounds().origin()); |
| 294 EXPECT_EQ(position2, panel2->GetBounds().origin()); | 294 EXPECT_EQ(position2, panel2->GetBounds().origin()); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 EXPECT_EQ(position1, panel1->GetBounds().origin()); | 367 EXPECT_EQ(position1, panel1->GetBounds().origin()); |
| 368 EXPECT_EQ(position2, panel2->GetBounds().origin()); | 368 EXPECT_EQ(position2, panel2->GetBounds().origin()); |
| 369 | 369 |
| 370 PanelManager::GetInstance()->CloseAll(); | 370 PanelManager::GetInstance()->CloseAll(); |
| 371 } | 371 } |
| 372 | 372 |
| 373 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragThreeDockedPanels) { | 373 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragThreeDockedPanels) { |
| 374 Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 100, 100)); | 374 Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 100, 100)); |
| 375 Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 100, 100)); | 375 Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 100, 100)); |
| 376 Panel* panel3 = CreateDockedPanel("3", gfx::Rect(0, 0, 100, 100)); | 376 Panel* panel3 = CreateDockedPanel("3", gfx::Rect(0, 0, 100, 100)); |
| 377 scoped_ptr<NativePanelTesting> panel2_testing( | 377 std::unique_ptr<NativePanelTesting> panel2_testing( |
| 378 CreateNativePanelTesting(panel2)); | 378 CreateNativePanelTesting(panel2)); |
| 379 scoped_ptr<NativePanelTesting> panel3_testing( | 379 std::unique_ptr<NativePanelTesting> panel3_testing( |
| 380 CreateNativePanelTesting(panel3)); | 380 CreateNativePanelTesting(panel3)); |
| 381 gfx::Point position1 = panel1->GetBounds().origin(); | 381 gfx::Point position1 = panel1->GetBounds().origin(); |
| 382 gfx::Point position2 = panel2->GetBounds().origin(); | 382 gfx::Point position2 = panel2->GetBounds().origin(); |
| 383 gfx::Point position3 = panel3->GetBounds().origin(); | 383 gfx::Point position3 = panel3->GetBounds().origin(); |
| 384 | 384 |
| 385 // Drag leftmost panel to become the rightmost in 2 drags. Each drag will | 385 // Drag leftmost panel to become the rightmost in 2 drags. Each drag will |
| 386 // shuffle one panel. | 386 // shuffle one panel. |
| 387 // Expect shuffle after 1st drag: P1 P3 P2 | 387 // Expect shuffle after 1st drag: P1 P3 P2 |
| 388 // Expect shuffle after 2nd drag: P3 P1 P2 | 388 // Expect shuffle after 2nd drag: P3 P1 P2 |
| 389 gfx::Point mouse_location = position3; | 389 gfx::Point mouse_location = position3; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 panel3_testing->CancelDragTitlebar(); | 498 panel3_testing->CancelDragTitlebar(); |
| 499 EXPECT_EQ(position2, panel1->GetBounds().origin()); | 499 EXPECT_EQ(position2, panel1->GetBounds().origin()); |
| 500 EXPECT_EQ(position3, panel2->GetBounds().origin()); | 500 EXPECT_EQ(position3, panel2->GetBounds().origin()); |
| 501 EXPECT_EQ(position1, panel3->GetBounds().origin()); | 501 EXPECT_EQ(position1, panel3->GetBounds().origin()); |
| 502 | 502 |
| 503 PanelManager::GetInstance()->CloseAll(); | 503 PanelManager::GetInstance()->CloseAll(); |
| 504 } | 504 } |
| 505 | 505 |
| 506 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragMinimizedPanel) { | 506 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragMinimizedPanel) { |
| 507 Panel* panel = CreatePanel("panel1"); | 507 Panel* panel = CreatePanel("panel1"); |
| 508 scoped_ptr<NativePanelTesting> panel_testing( | 508 std::unique_ptr<NativePanelTesting> panel_testing( |
| 509 CreateNativePanelTesting(panel)); | 509 CreateNativePanelTesting(panel)); |
| 510 | 510 |
| 511 panel->Minimize(); | 511 panel->Minimize(); |
| 512 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); | 512 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); |
| 513 | 513 |
| 514 // Hover over minimized panel to bring up titlebar. | 514 // Hover over minimized panel to bring up titlebar. |
| 515 gfx::Point hover_point(panel->GetBounds().origin()); | 515 gfx::Point hover_point(panel->GetBounds().origin()); |
| 516 MoveMouseAndWaitForExpansionStateChange(panel, hover_point); | 516 MoveMouseAndWaitForExpansionStateChange(panel, hover_point); |
| 517 EXPECT_EQ(Panel::TITLE_ONLY, panel->expansion_state()); | 517 EXPECT_EQ(Panel::TITLE_ONLY, panel->expansion_state()); |
| 518 | 518 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 537 | 537 |
| 538 MoveMouseAndWaitForExpansionStateChange(panel, mouse_location); | 538 MoveMouseAndWaitForExpansionStateChange(panel, mouse_location); |
| 539 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); | 539 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); |
| 540 | 540 |
| 541 panel->Close(); | 541 panel->Close(); |
| 542 } | 542 } |
| 543 | 543 |
| 544 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, | 544 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, |
| 545 DragMinimizedPanelWhileDrawingAttention) { | 545 DragMinimizedPanelWhileDrawingAttention) { |
| 546 Panel* panel = CreatePanel("panel1"); | 546 Panel* panel = CreatePanel("panel1"); |
| 547 scoped_ptr<NativePanelTesting> panel_testing( | 547 std::unique_ptr<NativePanelTesting> panel_testing( |
| 548 CreateNativePanelTesting(panel)); | 548 CreateNativePanelTesting(panel)); |
| 549 CreatePanel("panel2"); | 549 CreatePanel("panel2"); |
| 550 | 550 |
| 551 panel->Minimize(); | 551 panel->Minimize(); |
| 552 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); | 552 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); |
| 553 | 553 |
| 554 panel->FlashFrame(true); | 554 panel->FlashFrame(true); |
| 555 EXPECT_TRUE(panel->IsDrawingAttention()); | 555 EXPECT_TRUE(panel->IsDrawingAttention()); |
| 556 EXPECT_EQ(Panel::TITLE_ONLY, panel->expansion_state()); | 556 EXPECT_EQ(Panel::TITLE_ONLY, panel->expansion_state()); |
| 557 | 557 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 DockedPanelCollection* docked_collection = panel_manager->docked_collection(); | 596 DockedPanelCollection* docked_collection = panel_manager->docked_collection(); |
| 597 | 597 |
| 598 // Create 4 docked panels. | 598 // Create 4 docked panels. |
| 599 // We have: P4 P3 P2 P1 | 599 // We have: P4 P3 P2 P1 |
| 600 Panel* panel1 = CreatePanelWithBounds("Panel1", gfx::Rect(0, 0, 100, 100)); | 600 Panel* panel1 = CreatePanelWithBounds("Panel1", gfx::Rect(0, 0, 100, 100)); |
| 601 Panel* panel2 = CreatePanelWithBounds("Panel2", gfx::Rect(0, 0, 100, 100)); | 601 Panel* panel2 = CreatePanelWithBounds("Panel2", gfx::Rect(0, 0, 100, 100)); |
| 602 Panel* panel3 = CreatePanelWithBounds("Panel3", gfx::Rect(0, 0, 100, 100)); | 602 Panel* panel3 = CreatePanelWithBounds("Panel3", gfx::Rect(0, 0, 100, 100)); |
| 603 Panel* panel4 = CreatePanelWithBounds("Panel4", gfx::Rect(0, 0, 100, 100)); | 603 Panel* panel4 = CreatePanelWithBounds("Panel4", gfx::Rect(0, 0, 100, 100)); |
| 604 ASSERT_EQ(4, docked_collection->num_panels()); | 604 ASSERT_EQ(4, docked_collection->num_panels()); |
| 605 | 605 |
| 606 scoped_ptr<NativePanelTesting> panel1_testing( | 606 std::unique_ptr<NativePanelTesting> panel1_testing( |
| 607 CreateNativePanelTesting(panel1)); | 607 CreateNativePanelTesting(panel1)); |
| 608 gfx::Point position1 = panel1->GetBounds().origin(); | 608 gfx::Point position1 = panel1->GetBounds().origin(); |
| 609 gfx::Point position2 = panel2->GetBounds().origin(); | 609 gfx::Point position2 = panel2->GetBounds().origin(); |
| 610 gfx::Point position3 = panel3->GetBounds().origin(); | 610 gfx::Point position3 = panel3->GetBounds().origin(); |
| 611 gfx::Point position4 = panel4->GetBounds().origin(); | 611 gfx::Point position4 = panel4->GetBounds().origin(); |
| 612 | 612 |
| 613 // Test the scenario: drag a panel, close another panel, cancel the drag. | 613 // Test the scenario: drag a panel, close another panel, cancel the drag. |
| 614 { | 614 { |
| 615 std::vector<Panel*> panels; | 615 std::vector<Panel*> panels; |
| 616 gfx::Point panel1_new_position = position1; | 616 gfx::Point panel1_new_position = position1; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 #if defined(OS_MACOSX) | 767 #if defined(OS_MACOSX) |
| 768 #define MAYBE_DragOneDetachedPanel DISABLED_DragOneDetachedPanel | 768 #define MAYBE_DragOneDetachedPanel DISABLED_DragOneDetachedPanel |
| 769 #else | 769 #else |
| 770 #define MAYBE_DragOneDetachedPanel DragOneDetachedPanel | 770 #define MAYBE_DragOneDetachedPanel DragOneDetachedPanel |
| 771 #endif | 771 #endif |
| 772 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, MAYBE_DragOneDetachedPanel) { | 772 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, MAYBE_DragOneDetachedPanel) { |
| 773 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200)); | 773 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200)); |
| 774 | 774 |
| 775 // Test that the detached panel can be dragged almost anywhere except getting | 775 // Test that the detached panel can be dragged almost anywhere except getting |
| 776 // close to the bottom of the docked area to trigger the attach. | 776 // close to the bottom of the docked area to trigger the attach. |
| 777 scoped_ptr<NativePanelTesting> panel_testing( | 777 std::unique_ptr<NativePanelTesting> panel_testing( |
| 778 CreateNativePanelTesting(panel)); | 778 CreateNativePanelTesting(panel)); |
| 779 gfx::Point origin = panel->GetBounds().origin(); | 779 gfx::Point origin = panel->GetBounds().origin(); |
| 780 | 780 |
| 781 panel_testing->PressLeftMouseButtonTitlebar(origin); | 781 panel_testing->PressLeftMouseButtonTitlebar(origin); |
| 782 EXPECT_EQ(origin, panel->GetBounds().origin()); | 782 EXPECT_EQ(origin, panel->GetBounds().origin()); |
| 783 | 783 |
| 784 origin.Offset(-51, -102); | 784 origin.Offset(-51, -102); |
| 785 panel_testing->DragTitlebar(origin); | 785 panel_testing->DragTitlebar(origin); |
| 786 EXPECT_EQ(origin, panel->GetBounds().origin()); | 786 EXPECT_EQ(origin, panel->GetBounds().origin()); |
| 787 | 787 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 818 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, CloseDetachedPanelOnDrag) { | 818 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, CloseDetachedPanelOnDrag) { |
| 819 PanelManager* panel_manager = PanelManager::GetInstance(); | 819 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 820 PanelDragController* drag_controller = panel_manager->drag_controller(); | 820 PanelDragController* drag_controller = panel_manager->drag_controller(); |
| 821 DetachedPanelCollection* detached_collection = | 821 DetachedPanelCollection* detached_collection = |
| 822 panel_manager->detached_collection(); | 822 panel_manager->detached_collection(); |
| 823 | 823 |
| 824 // Create 1 detached panel. | 824 // Create 1 detached panel. |
| 825 Panel* panel1 = CreateDetachedPanel("1", gfx::Rect(100, 200, 100, 100)); | 825 Panel* panel1 = CreateDetachedPanel("1", gfx::Rect(100, 200, 100, 100)); |
| 826 ASSERT_EQ(1, detached_collection->num_panels()); | 826 ASSERT_EQ(1, detached_collection->num_panels()); |
| 827 | 827 |
| 828 scoped_ptr<NativePanelTesting> panel1_testing( | 828 std::unique_ptr<NativePanelTesting> panel1_testing( |
| 829 CreateNativePanelTesting(panel1)); | 829 CreateNativePanelTesting(panel1)); |
| 830 gfx::Point panel1_old_position = panel1->GetBounds().origin(); | 830 gfx::Point panel1_old_position = panel1->GetBounds().origin(); |
| 831 | 831 |
| 832 // Test the scenario: drag a panel, close another panel, cancel the drag. | 832 // Test the scenario: drag a panel, close another panel, cancel the drag. |
| 833 { | 833 { |
| 834 // Create a panel to be closed. | 834 // Create a panel to be closed. |
| 835 Panel* panel2 = CreateDetachedPanel("2", gfx::Rect(300, 210, 110, 110)); | 835 Panel* panel2 = CreateDetachedPanel("2", gfx::Rect(300, 210, 110, 110)); |
| 836 | 836 |
| 837 // Start dragging a panel. | 837 // Start dragging a panel. |
| 838 panel1_testing->PressLeftMouseButtonTitlebar(panel1->GetBounds().origin()); | 838 panel1_testing->PressLeftMouseButtonTitlebar(panel1->GetBounds().origin()); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 panel_manager->detached_collection(); | 936 panel_manager->detached_collection(); |
| 937 | 937 |
| 938 // Create one docked panel. | 938 // Create one docked panel. |
| 939 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 100, 100)); | 939 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 100, 100)); |
| 940 ASSERT_EQ(1, docked_collection->num_panels()); | 940 ASSERT_EQ(1, docked_collection->num_panels()); |
| 941 ASSERT_EQ(0, detached_collection->num_panels()); | 941 ASSERT_EQ(0, detached_collection->num_panels()); |
| 942 | 942 |
| 943 gfx::Rect panel_old_bounds = panel->GetBounds(); | 943 gfx::Rect panel_old_bounds = panel->GetBounds(); |
| 944 | 944 |
| 945 // Press on title-bar. | 945 // Press on title-bar. |
| 946 scoped_ptr<NativePanelTesting> panel_testing( | 946 std::unique_ptr<NativePanelTesting> panel_testing( |
| 947 CreateNativePanelTesting(panel)); | 947 CreateNativePanelTesting(panel)); |
| 948 gfx::Point mouse_location(panel->GetBounds().origin()); | 948 gfx::Point mouse_location(panel->GetBounds().origin()); |
| 949 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); | 949 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); |
| 950 | 950 |
| 951 // Drag up the panel in a small offset that does not trigger the detach. | 951 // Drag up the panel in a small offset that does not trigger the detach. |
| 952 // Expect that the panel is still docked and only x coordinate of its position | 952 // Expect that the panel is still docked and only x coordinate of its position |
| 953 // is changed. | 953 // is changed. |
| 954 gfx::Vector2d drag_delta_to_remain_docked = GetDragDeltaToRemainDocked(); | 954 gfx::Vector2d drag_delta_to_remain_docked = GetDragDeltaToRemainDocked(); |
| 955 mouse_location = mouse_location + drag_delta_to_remain_docked; | 955 mouse_location = mouse_location + drag_delta_to_remain_docked; |
| 956 panel_testing->DragTitlebar(mouse_location); | 956 panel_testing->DragTitlebar(mouse_location); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 panel_manager->detached_collection(); | 998 panel_manager->detached_collection(); |
| 999 | 999 |
| 1000 // Create one docked panel. | 1000 // Create one docked panel. |
| 1001 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 100, 100)); | 1001 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 100, 100)); |
| 1002 ASSERT_EQ(1, docked_collection->num_panels()); | 1002 ASSERT_EQ(1, docked_collection->num_panels()); |
| 1003 ASSERT_EQ(0, detached_collection->num_panels()); | 1003 ASSERT_EQ(0, detached_collection->num_panels()); |
| 1004 | 1004 |
| 1005 gfx::Rect panel_old_bounds = panel->GetBounds(); | 1005 gfx::Rect panel_old_bounds = panel->GetBounds(); |
| 1006 | 1006 |
| 1007 // Press on title-bar. | 1007 // Press on title-bar. |
| 1008 scoped_ptr<NativePanelTesting> panel_testing( | 1008 std::unique_ptr<NativePanelTesting> panel_testing( |
| 1009 CreateNativePanelTesting(panel)); | 1009 CreateNativePanelTesting(panel)); |
| 1010 gfx::Point mouse_location(panel->GetBounds().origin()); | 1010 gfx::Point mouse_location(panel->GetBounds().origin()); |
| 1011 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); | 1011 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); |
| 1012 | 1012 |
| 1013 // Drag up the panel in a small offset that does not trigger the detach. | 1013 // Drag up the panel in a small offset that does not trigger the detach. |
| 1014 // Expect that the panel is still docked and only x coordinate of its position | 1014 // Expect that the panel is still docked and only x coordinate of its position |
| 1015 // is changed. | 1015 // is changed. |
| 1016 gfx::Vector2d drag_delta_to_remain_docked = GetDragDeltaToRemainDocked(); | 1016 gfx::Vector2d drag_delta_to_remain_docked = GetDragDeltaToRemainDocked(); |
| 1017 mouse_location = mouse_location + drag_delta_to_remain_docked; | 1017 mouse_location = mouse_location + drag_delta_to_remain_docked; |
| 1018 panel_testing->DragTitlebar(mouse_location); | 1018 panel_testing->DragTitlebar(mouse_location); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 | 1061 |
| 1062 // Create one detached panel. | 1062 // Create one detached panel. |
| 1063 Panel* panel = CreateDetachedPanel("1", gfx::Rect(400, 300, 100, 100)); | 1063 Panel* panel = CreateDetachedPanel("1", gfx::Rect(400, 300, 100, 100)); |
| 1064 ASSERT_EQ(0, docked_collection->num_panels()); | 1064 ASSERT_EQ(0, docked_collection->num_panels()); |
| 1065 ASSERT_EQ(1, detached_collection->num_panels()); | 1065 ASSERT_EQ(1, detached_collection->num_panels()); |
| 1066 EXPECT_EQ(PanelCollection::DETACHED, panel->collection()->type()); | 1066 EXPECT_EQ(PanelCollection::DETACHED, panel->collection()->type()); |
| 1067 | 1067 |
| 1068 gfx::Rect panel_old_bounds = panel->GetBounds(); | 1068 gfx::Rect panel_old_bounds = panel->GetBounds(); |
| 1069 | 1069 |
| 1070 // Press on title-bar. | 1070 // Press on title-bar. |
| 1071 scoped_ptr<NativePanelTesting> panel_testing( | 1071 std::unique_ptr<NativePanelTesting> panel_testing( |
| 1072 CreateNativePanelTesting(panel)); | 1072 CreateNativePanelTesting(panel)); |
| 1073 gfx::Point mouse_location(panel->GetBounds().origin()); | 1073 gfx::Point mouse_location(panel->GetBounds().origin()); |
| 1074 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); | 1074 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); |
| 1075 | 1075 |
| 1076 // Drag down the panel but not close enough to the bottom of work area. | 1076 // Drag down the panel but not close enough to the bottom of work area. |
| 1077 // Expect that the panel is still detached. | 1077 // Expect that the panel is still detached. |
| 1078 gfx::Vector2d drag_delta_to_remain_detached = | 1078 gfx::Vector2d drag_delta_to_remain_detached = |
| 1079 GetDragDeltaToRemainDetached(panel); | 1079 GetDragDeltaToRemainDetached(panel); |
| 1080 mouse_location = mouse_location + drag_delta_to_remain_detached; | 1080 mouse_location = mouse_location + drag_delta_to_remain_detached; |
| 1081 panel_testing->DragTitlebar(mouse_location); | 1081 panel_testing->DragTitlebar(mouse_location); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 | 1127 |
| 1128 // Create one detached panel. | 1128 // Create one detached panel. |
| 1129 Panel* panel = CreateDetachedPanel("1", gfx::Rect(400, 300, 100, 100)); | 1129 Panel* panel = CreateDetachedPanel("1", gfx::Rect(400, 300, 100, 100)); |
| 1130 ASSERT_EQ(0, docked_collection->num_panels()); | 1130 ASSERT_EQ(0, docked_collection->num_panels()); |
| 1131 ASSERT_EQ(1, detached_collection->num_panels()); | 1131 ASSERT_EQ(1, detached_collection->num_panels()); |
| 1132 EXPECT_EQ(PanelCollection::DETACHED, panel->collection()->type()); | 1132 EXPECT_EQ(PanelCollection::DETACHED, panel->collection()->type()); |
| 1133 | 1133 |
| 1134 gfx::Rect panel_old_bounds = panel->GetBounds(); | 1134 gfx::Rect panel_old_bounds = panel->GetBounds(); |
| 1135 | 1135 |
| 1136 // Press on title-bar. | 1136 // Press on title-bar. |
| 1137 scoped_ptr<NativePanelTesting> panel_testing( | 1137 std::unique_ptr<NativePanelTesting> panel_testing( |
| 1138 CreateNativePanelTesting(panel)); | 1138 CreateNativePanelTesting(panel)); |
| 1139 gfx::Point mouse_location(panel->GetBounds().origin()); | 1139 gfx::Point mouse_location(panel->GetBounds().origin()); |
| 1140 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); | 1140 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); |
| 1141 | 1141 |
| 1142 // Drag down the panel but not close enough to the bottom of work area. | 1142 // Drag down the panel but not close enough to the bottom of work area. |
| 1143 // Expect that the panel is still detached. | 1143 // Expect that the panel is still detached. |
| 1144 gfx::Vector2d drag_delta_to_remain_detached = | 1144 gfx::Vector2d drag_delta_to_remain_detached = |
| 1145 GetDragDeltaToRemainDetached(panel); | 1145 GetDragDeltaToRemainDetached(panel); |
| 1146 mouse_location = mouse_location + drag_delta_to_remain_detached; | 1146 mouse_location = mouse_location + drag_delta_to_remain_detached; |
| 1147 panel_testing->DragTitlebar(mouse_location); | 1147 panel_testing->DragTitlebar(mouse_location); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1182 panel_manager->detached_collection(); | 1182 panel_manager->detached_collection(); |
| 1183 | 1183 |
| 1184 // Create one docked panel. | 1184 // Create one docked panel. |
| 1185 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 100, 100)); | 1185 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 100, 100)); |
| 1186 ASSERT_EQ(1, docked_collection->num_panels()); | 1186 ASSERT_EQ(1, docked_collection->num_panels()); |
| 1187 ASSERT_EQ(0, detached_collection->num_panels()); | 1187 ASSERT_EQ(0, detached_collection->num_panels()); |
| 1188 | 1188 |
| 1189 gfx::Rect panel_old_bounds = panel->GetBounds(); | 1189 gfx::Rect panel_old_bounds = panel->GetBounds(); |
| 1190 | 1190 |
| 1191 // Press on title-bar. | 1191 // Press on title-bar. |
| 1192 scoped_ptr<NativePanelTesting> panel_testing( | 1192 std::unique_ptr<NativePanelTesting> panel_testing( |
| 1193 CreateNativePanelTesting(panel)); | 1193 CreateNativePanelTesting(panel)); |
| 1194 gfx::Point mouse_location(panel->GetBounds().origin()); | 1194 gfx::Point mouse_location(panel->GetBounds().origin()); |
| 1195 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); | 1195 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); |
| 1196 | 1196 |
| 1197 // Drag up the panel to trigger the detach. | 1197 // Drag up the panel to trigger the detach. |
| 1198 // Expect that the panel is previewed as detached. | 1198 // Expect that the panel is previewed as detached. |
| 1199 gfx::Vector2d drag_delta_to_detach = GetDragDeltaToDetach(); | 1199 gfx::Vector2d drag_delta_to_detach = GetDragDeltaToDetach(); |
| 1200 mouse_location = mouse_location + drag_delta_to_detach; | 1200 mouse_location = mouse_location + drag_delta_to_detach; |
| 1201 panel_testing->DragTitlebar(mouse_location); | 1201 panel_testing->DragTitlebar(mouse_location); |
| 1202 ASSERT_EQ(0, docked_collection->num_panels()); | 1202 ASSERT_EQ(0, docked_collection->num_panels()); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1535 Panel* panel2 = CreateDetachedPanel("2", gfx::Rect(100, 100, 150, 150)); | 1535 Panel* panel2 = CreateDetachedPanel("2", gfx::Rect(100, 100, 150, 150)); |
| 1536 ASSERT_EQ(2, detached_collection->num_panels()); | 1536 ASSERT_EQ(2, detached_collection->num_panels()); |
| 1537 ASSERT_EQ(0, panel_manager->num_stacks()); | 1537 ASSERT_EQ(0, panel_manager->num_stacks()); |
| 1538 EXPECT_EQ(PanelCollection::DETACHED, panel1->collection()->type()); | 1538 EXPECT_EQ(PanelCollection::DETACHED, panel1->collection()->type()); |
| 1539 EXPECT_EQ(PanelCollection::DETACHED, panel2->collection()->type()); | 1539 EXPECT_EQ(PanelCollection::DETACHED, panel2->collection()->type()); |
| 1540 | 1540 |
| 1541 gfx::Rect panel1_old_bounds = panel1->GetBounds(); | 1541 gfx::Rect panel1_old_bounds = panel1->GetBounds(); |
| 1542 gfx::Rect panel2_old_bounds = panel2->GetBounds(); | 1542 gfx::Rect panel2_old_bounds = panel2->GetBounds(); |
| 1543 | 1543 |
| 1544 // Press on title-bar of P2. | 1544 // Press on title-bar of P2. |
| 1545 scoped_ptr<NativePanelTesting> panel2_testing( | 1545 std::unique_ptr<NativePanelTesting> panel2_testing( |
| 1546 CreateNativePanelTesting(panel2)); | 1546 CreateNativePanelTesting(panel2)); |
| 1547 gfx::Point mouse_location(panel2->GetBounds().origin()); | 1547 gfx::Point mouse_location(panel2->GetBounds().origin()); |
| 1548 gfx::Point original_mouse_location = mouse_location; | 1548 gfx::Point original_mouse_location = mouse_location; |
| 1549 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location); | 1549 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location); |
| 1550 | 1550 |
| 1551 // Drag P2 close to the bottom of P1 to trigger the stacking. Expect: | 1551 // Drag P2 close to the bottom of P1 to trigger the stacking. Expect: |
| 1552 // 1) P1 and P2 form a stack. | 1552 // 1) P1 and P2 form a stack. |
| 1553 // 2) P2 jumps vertcially to align to the bottom edge of P1. | 1553 // 2) P2 jumps vertcially to align to the bottom edge of P1. |
| 1554 // 3) P2 moves horizontally by the dragging delta. | 1554 // 3) P2 moves horizontally by the dragging delta. |
| 1555 // 4) The width of P2 remains unchanged. | 1555 // 4) The width of P2 remains unchanged. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 Panel* panel2 = CreateDetachedPanel("2", gfx::Rect(100, 200, 150, 150)); | 1642 Panel* panel2 = CreateDetachedPanel("2", gfx::Rect(100, 200, 150, 150)); |
| 1643 ASSERT_EQ(2, detached_collection->num_panels()); | 1643 ASSERT_EQ(2, detached_collection->num_panels()); |
| 1644 ASSERT_EQ(0, panel_manager->num_stacks()); | 1644 ASSERT_EQ(0, panel_manager->num_stacks()); |
| 1645 EXPECT_EQ(PanelCollection::DETACHED, panel1->collection()->type()); | 1645 EXPECT_EQ(PanelCollection::DETACHED, panel1->collection()->type()); |
| 1646 EXPECT_EQ(PanelCollection::DETACHED, panel2->collection()->type()); | 1646 EXPECT_EQ(PanelCollection::DETACHED, panel2->collection()->type()); |
| 1647 | 1647 |
| 1648 gfx::Rect panel1_old_bounds = panel1->GetBounds(); | 1648 gfx::Rect panel1_old_bounds = panel1->GetBounds(); |
| 1649 gfx::Rect panel2_old_bounds = panel2->GetBounds(); | 1649 gfx::Rect panel2_old_bounds = panel2->GetBounds(); |
| 1650 | 1650 |
| 1651 // Press on title-bar of P2. | 1651 // Press on title-bar of P2. |
| 1652 scoped_ptr<NativePanelTesting> panel2_testing( | 1652 std::unique_ptr<NativePanelTesting> panel2_testing( |
| 1653 CreateNativePanelTesting(panel2)); | 1653 CreateNativePanelTesting(panel2)); |
| 1654 gfx::Point mouse_location(panel2->GetBounds().origin()); | 1654 gfx::Point mouse_location(panel2->GetBounds().origin()); |
| 1655 gfx::Point original_mouse_location = mouse_location; | 1655 gfx::Point original_mouse_location = mouse_location; |
| 1656 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location); | 1656 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location); |
| 1657 | 1657 |
| 1658 // Drag P2 close to the top of P1 to trigger the stacking. Expect: | 1658 // Drag P2 close to the top of P1 to trigger the stacking. Expect: |
| 1659 // 1) P2 and P1 form a stack. | 1659 // 1) P2 and P1 form a stack. |
| 1660 // 2) P2 jumps vertcially to align to the top edge of P1. | 1660 // 2) P2 jumps vertcially to align to the top edge of P1. |
| 1661 // 3) P2 moves horizontally by the dragging delta. | 1661 // 3) P2 moves horizontally by the dragging delta. |
| 1662 // 4) The width of both P1 and P2 remains unchanged. | 1662 // 4) The width of both P1 and P2 remains unchanged. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1750 Panel* panel2 = CreateDetachedPanel("2", gfx::Rect(100, 100, 150, 150)); | 1750 Panel* panel2 = CreateDetachedPanel("2", gfx::Rect(100, 100, 150, 150)); |
| 1751 ASSERT_EQ(2, detached_collection->num_panels()); | 1751 ASSERT_EQ(2, detached_collection->num_panels()); |
| 1752 ASSERT_EQ(0, panel_manager->num_stacks()); | 1752 ASSERT_EQ(0, panel_manager->num_stacks()); |
| 1753 EXPECT_EQ(PanelCollection::DETACHED, panel1->collection()->type()); | 1753 EXPECT_EQ(PanelCollection::DETACHED, panel1->collection()->type()); |
| 1754 EXPECT_EQ(PanelCollection::DETACHED, panel2->collection()->type()); | 1754 EXPECT_EQ(PanelCollection::DETACHED, panel2->collection()->type()); |
| 1755 | 1755 |
| 1756 gfx::Rect panel1_old_bounds = panel1->GetBounds(); | 1756 gfx::Rect panel1_old_bounds = panel1->GetBounds(); |
| 1757 gfx::Rect panel2_old_bounds = panel2->GetBounds(); | 1757 gfx::Rect panel2_old_bounds = panel2->GetBounds(); |
| 1758 | 1758 |
| 1759 // Press on title-bar. | 1759 // Press on title-bar. |
| 1760 scoped_ptr<NativePanelTesting> panel2_testing( | 1760 std::unique_ptr<NativePanelTesting> panel2_testing( |
| 1761 CreateNativePanelTesting(panel2)); | 1761 CreateNativePanelTesting(panel2)); |
| 1762 gfx::Point mouse_location(panel2->GetBounds().origin()); | 1762 gfx::Point mouse_location(panel2->GetBounds().origin()); |
| 1763 gfx::Point original_mouse_location = mouse_location; | 1763 gfx::Point original_mouse_location = mouse_location; |
| 1764 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location); | 1764 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location); |
| 1765 | 1765 |
| 1766 // Drag P2 close to the bottom of P1 to trigger the stacking. | 1766 // Drag P2 close to the bottom of P1 to trigger the stacking. |
| 1767 // Expect that P2 stacks to P1 and P2's width remains unchanged. | 1767 // Expect that P2 stacks to P1 and P2's width remains unchanged. |
| 1768 gfx::Vector2d drag_delta_to_stack = | 1768 gfx::Vector2d drag_delta_to_stack = |
| 1769 GetDragDeltaToStackToBottom(panel2, panel1); | 1769 GetDragDeltaToStackToBottom(panel2, panel1); |
| 1770 mouse_location = mouse_location + drag_delta_to_stack; | 1770 mouse_location = mouse_location + drag_delta_to_stack; |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2193 EXPECT_EQ(stack, panel2->stack()); | 2193 EXPECT_EQ(stack, panel2->stack()); |
| 2194 | 2194 |
| 2195 gfx::Rect panel1_expected_bounds(panel1_initial_bounds); | 2195 gfx::Rect panel1_expected_bounds(panel1_initial_bounds); |
| 2196 EXPECT_EQ(panel1_expected_bounds, panel1->GetBounds()); | 2196 EXPECT_EQ(panel1_expected_bounds, panel1->GetBounds()); |
| 2197 gfx::Rect panel2_expected_bounds = GetStackedAtBottomPanelBounds( | 2197 gfx::Rect panel2_expected_bounds = GetStackedAtBottomPanelBounds( |
| 2198 panel2_initial_bounds, panel1_expected_bounds); | 2198 panel2_initial_bounds, panel1_expected_bounds); |
| 2199 EXPECT_EQ(panel2_expected_bounds, panel2->GetBounds()); | 2199 EXPECT_EQ(panel2_expected_bounds, panel2->GetBounds()); |
| 2200 gfx::Rect panel2_old_bounds = panel2_expected_bounds; | 2200 gfx::Rect panel2_old_bounds = panel2_expected_bounds; |
| 2201 | 2201 |
| 2202 // Press on title-bar. | 2202 // Press on title-bar. |
| 2203 scoped_ptr<NativePanelTesting> panel2_testing( | 2203 std::unique_ptr<NativePanelTesting> panel2_testing( |
| 2204 CreateNativePanelTesting(panel2)); | 2204 CreateNativePanelTesting(panel2)); |
| 2205 gfx::Point mouse_location(panel2->GetBounds().origin()); | 2205 gfx::Point mouse_location(panel2->GetBounds().origin()); |
| 2206 gfx::Point original_mouse_location = mouse_location; | 2206 gfx::Point original_mouse_location = mouse_location; |
| 2207 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location); | 2207 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location); |
| 2208 | 2208 |
| 2209 // Drag P2 away from the bottom of P1 to trigger the unstacking. | 2209 // Drag P2 away from the bottom of P1 to trigger the unstacking. |
| 2210 // Expect that P1 and P2 get detached. | 2210 // Expect that P1 and P2 get detached. |
| 2211 gfx::Vector2d drag_delta_to_unstack = | 2211 gfx::Vector2d drag_delta_to_unstack = |
| 2212 GetDragDeltaToUnstackFromBottom(panel2, panel1); | 2212 GetDragDeltaToUnstackFromBottom(panel2, panel1); |
| 2213 mouse_location = mouse_location + drag_delta_to_unstack; | 2213 mouse_location = mouse_location + drag_delta_to_unstack; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2282 EXPECT_EQ(stack, panel2->stack()); | 2282 EXPECT_EQ(stack, panel2->stack()); |
| 2283 | 2283 |
| 2284 gfx::Rect panel1_expected_bounds(panel1_initial_bounds); | 2284 gfx::Rect panel1_expected_bounds(panel1_initial_bounds); |
| 2285 EXPECT_EQ(panel1_expected_bounds, panel1->GetBounds()); | 2285 EXPECT_EQ(panel1_expected_bounds, panel1->GetBounds()); |
| 2286 gfx::Rect panel2_expected_bounds = GetStackedAtBottomPanelBounds( | 2286 gfx::Rect panel2_expected_bounds = GetStackedAtBottomPanelBounds( |
| 2287 panel2_initial_bounds, panel1_expected_bounds); | 2287 panel2_initial_bounds, panel1_expected_bounds); |
| 2288 EXPECT_EQ(panel2_expected_bounds, panel2->GetBounds()); | 2288 EXPECT_EQ(panel2_expected_bounds, panel2->GetBounds()); |
| 2289 gfx::Rect panel2_old_bounds = panel2->GetBounds(); | 2289 gfx::Rect panel2_old_bounds = panel2->GetBounds(); |
| 2290 | 2290 |
| 2291 // Press on title-bar. | 2291 // Press on title-bar. |
| 2292 scoped_ptr<NativePanelTesting> panel2_testing( | 2292 std::unique_ptr<NativePanelTesting> panel2_testing( |
| 2293 CreateNativePanelTesting(panel2)); | 2293 CreateNativePanelTesting(panel2)); |
| 2294 gfx::Point mouse_location(panel2->GetBounds().origin()); | 2294 gfx::Point mouse_location(panel2->GetBounds().origin()); |
| 2295 gfx::Point original_mouse_location = mouse_location; | 2295 gfx::Point original_mouse_location = mouse_location; |
| 2296 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location); | 2296 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location); |
| 2297 | 2297 |
| 2298 // Drag P2 away from the bottom of P1 to trigger the unstacking. | 2298 // Drag P2 away from the bottom of P1 to trigger the unstacking. |
| 2299 // Expect that P1 and P2 get detached. | 2299 // Expect that P1 and P2 get detached. |
| 2300 gfx::Vector2d drag_delta_to_unstack = | 2300 gfx::Vector2d drag_delta_to_unstack = |
| 2301 GetDragDeltaToUnstackFromBottom(panel2, panel1); | 2301 GetDragDeltaToUnstackFromBottom(panel2, panel1); |
| 2302 mouse_location = mouse_location + drag_delta_to_unstack; | 2302 mouse_location = mouse_location + drag_delta_to_unstack; |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2599 gfx::Rect panel2_initial_bounds = gfx::Rect(100, 100, 100, 250); | 2599 gfx::Rect panel2_initial_bounds = gfx::Rect(100, 100, 100, 250); |
| 2600 Panel* panel2 = CreateDetachedPanel("2", panel2_initial_bounds); | 2600 Panel* panel2 = CreateDetachedPanel("2", panel2_initial_bounds); |
| 2601 ASSERT_EQ(2, detached_collection->num_panels()); | 2601 ASSERT_EQ(2, detached_collection->num_panels()); |
| 2602 | 2602 |
| 2603 gfx::Rect panel1_expected_bounds(panel1_initial_bounds); | 2603 gfx::Rect panel1_expected_bounds(panel1_initial_bounds); |
| 2604 EXPECT_EQ(panel1_expected_bounds, panel1->GetBounds()); | 2604 EXPECT_EQ(panel1_expected_bounds, panel1->GetBounds()); |
| 2605 gfx::Rect panel2_expected_bounds(panel2_initial_bounds); | 2605 gfx::Rect panel2_expected_bounds(panel2_initial_bounds); |
| 2606 EXPECT_EQ(panel2_expected_bounds, panel2->GetBounds()); | 2606 EXPECT_EQ(panel2_expected_bounds, panel2->GetBounds()); |
| 2607 | 2607 |
| 2608 // Press on title-bar. | 2608 // Press on title-bar. |
| 2609 scoped_ptr<NativePanelTesting> panel2_testing( | 2609 std::unique_ptr<NativePanelTesting> panel2_testing( |
| 2610 CreateNativePanelTesting(panel2)); | 2610 CreateNativePanelTesting(panel2)); |
| 2611 gfx::Point mouse_location(panel2->GetBounds().origin()); | 2611 gfx::Point mouse_location(panel2->GetBounds().origin()); |
| 2612 gfx::Point original_mouse_location = mouse_location; | 2612 gfx::Point original_mouse_location = mouse_location; |
| 2613 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location); | 2613 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location); |
| 2614 | 2614 |
| 2615 // Drag P2 close to the left of P1 to trigger the snapping. | 2615 // Drag P2 close to the left of P1 to trigger the snapping. |
| 2616 gfx::Vector2d drag_delta_to_snap = GetDragDeltaToSnapToLeft(panel2, panel1); | 2616 gfx::Vector2d drag_delta_to_snap = GetDragDeltaToSnapToLeft(panel2, panel1); |
| 2617 mouse_location = mouse_location + drag_delta_to_snap; | 2617 mouse_location = mouse_location + drag_delta_to_snap; |
| 2618 panel2_testing->DragTitlebar(mouse_location); | 2618 panel2_testing->DragTitlebar(mouse_location); |
| 2619 ASSERT_EQ(2, detached_collection->num_panels()); | 2619 ASSERT_EQ(2, detached_collection->num_panels()); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2675 gfx::Rect panel2_initial_bounds = gfx::Rect(300, 100, 200, 250); | 2675 gfx::Rect panel2_initial_bounds = gfx::Rect(300, 100, 200, 250); |
| 2676 Panel* panel2 = CreateDetachedPanel("2", panel2_initial_bounds); | 2676 Panel* panel2 = CreateDetachedPanel("2", panel2_initial_bounds); |
| 2677 ASSERT_EQ(2, detached_collection->num_panels()); | 2677 ASSERT_EQ(2, detached_collection->num_panels()); |
| 2678 | 2678 |
| 2679 gfx::Rect panel1_expected_bounds(panel1_initial_bounds); | 2679 gfx::Rect panel1_expected_bounds(panel1_initial_bounds); |
| 2680 EXPECT_EQ(panel1_expected_bounds, panel1->GetBounds()); | 2680 EXPECT_EQ(panel1_expected_bounds, panel1->GetBounds()); |
| 2681 gfx::Rect panel2_expected_bounds(panel2_initial_bounds); | 2681 gfx::Rect panel2_expected_bounds(panel2_initial_bounds); |
| 2682 EXPECT_EQ(panel2_expected_bounds, panel2->GetBounds()); | 2682 EXPECT_EQ(panel2_expected_bounds, panel2->GetBounds()); |
| 2683 | 2683 |
| 2684 // Press on title-bar. | 2684 // Press on title-bar. |
| 2685 scoped_ptr<NativePanelTesting> panel2_testing( | 2685 std::unique_ptr<NativePanelTesting> panel2_testing( |
| 2686 CreateNativePanelTesting(panel2)); | 2686 CreateNativePanelTesting(panel2)); |
| 2687 gfx::Point mouse_location(panel2->GetBounds().origin()); | 2687 gfx::Point mouse_location(panel2->GetBounds().origin()); |
| 2688 gfx::Point original_mouse_location = mouse_location; | 2688 gfx::Point original_mouse_location = mouse_location; |
| 2689 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location); | 2689 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location); |
| 2690 | 2690 |
| 2691 // Drag P1 close to the right of P2 to trigger the snapping. | 2691 // Drag P1 close to the right of P2 to trigger the snapping. |
| 2692 gfx::Vector2d drag_delta_to_snap = GetDragDeltaToSnapToRight(panel2, panel1); | 2692 gfx::Vector2d drag_delta_to_snap = GetDragDeltaToSnapToRight(panel2, panel1); |
| 2693 mouse_location = mouse_location + drag_delta_to_snap; | 2693 mouse_location = mouse_location + drag_delta_to_snap; |
| 2694 panel2_testing->DragTitlebar(mouse_location); | 2694 panel2_testing->DragTitlebar(mouse_location); |
| 2695 ASSERT_EQ(2, detached_collection->num_panels()); | 2695 ASSERT_EQ(2, detached_collection->num_panels()); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2749 gfx::Rect panel2_initial_bounds = gfx::Rect(100, 100, 100, 250); | 2749 gfx::Rect panel2_initial_bounds = gfx::Rect(100, 100, 100, 250); |
| 2750 Panel* panel2 = CreateDetachedPanel("2", panel2_initial_bounds); | 2750 Panel* panel2 = CreateDetachedPanel("2", panel2_initial_bounds); |
| 2751 ASSERT_EQ(2, detached_collection->num_panels()); | 2751 ASSERT_EQ(2, detached_collection->num_panels()); |
| 2752 | 2752 |
| 2753 gfx::Rect panel1_expected_bounds(panel1_initial_bounds); | 2753 gfx::Rect panel1_expected_bounds(panel1_initial_bounds); |
| 2754 EXPECT_EQ(panel1_expected_bounds, panel1->GetBounds()); | 2754 EXPECT_EQ(panel1_expected_bounds, panel1->GetBounds()); |
| 2755 gfx::Rect panel2_expected_bounds(panel2_initial_bounds); | 2755 gfx::Rect panel2_expected_bounds(panel2_initial_bounds); |
| 2756 EXPECT_EQ(panel2_expected_bounds, panel2->GetBounds()); | 2756 EXPECT_EQ(panel2_expected_bounds, panel2->GetBounds()); |
| 2757 | 2757 |
| 2758 // Press on title-bar. | 2758 // Press on title-bar. |
| 2759 scoped_ptr<NativePanelTesting> panel2_testing( | 2759 std::unique_ptr<NativePanelTesting> panel2_testing( |
| 2760 CreateNativePanelTesting(panel2)); | 2760 CreateNativePanelTesting(panel2)); |
| 2761 gfx::Point mouse_location(panel2->GetBounds().origin()); | 2761 gfx::Point mouse_location(panel2->GetBounds().origin()); |
| 2762 gfx::Point original_mouse_location = mouse_location; | 2762 gfx::Point original_mouse_location = mouse_location; |
| 2763 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location); | 2763 panel2_testing->PressLeftMouseButtonTitlebar(mouse_location); |
| 2764 | 2764 |
| 2765 // Drag P2 close to the left of P1 to trigger the snapping. | 2765 // Drag P2 close to the left of P1 to trigger the snapping. |
| 2766 gfx::Vector2d drag_delta_to_snap = GetDragDeltaToSnapToLeft(panel2, panel1); | 2766 gfx::Vector2d drag_delta_to_snap = GetDragDeltaToSnapToLeft(panel2, panel1); |
| 2767 mouse_location = mouse_location + drag_delta_to_snap; | 2767 mouse_location = mouse_location + drag_delta_to_snap; |
| 2768 panel2_testing->DragTitlebar(mouse_location); | 2768 panel2_testing->DragTitlebar(mouse_location); |
| 2769 ASSERT_EQ(2, detached_collection->num_panels()); | 2769 ASSERT_EQ(2, detached_collection->num_panels()); |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3088 expected_x = secondary_work_area.x(); | 3088 expected_x = secondary_work_area.x(); |
| 3089 panel1_expected_bounds.set_x(expected_x); | 3089 panel1_expected_bounds.set_x(expected_x); |
| 3090 panel1_expected_bounds.set_y(secondary_work_area.y()); | 3090 panel1_expected_bounds.set_y(secondary_work_area.y()); |
| 3091 EXPECT_EQ(panel1_expected_bounds, panel1->GetBounds()); | 3091 EXPECT_EQ(panel1_expected_bounds, panel1->GetBounds()); |
| 3092 panel2_expected_bounds.set_x(expected_x); | 3092 panel2_expected_bounds.set_x(expected_x); |
| 3093 panel2_expected_bounds.set_y(panel1_expected_bounds.bottom()); | 3093 panel2_expected_bounds.set_y(panel1_expected_bounds.bottom()); |
| 3094 EXPECT_EQ(panel2_expected_bounds, panel2->GetBounds()); | 3094 EXPECT_EQ(panel2_expected_bounds, panel2->GetBounds()); |
| 3095 | 3095 |
| 3096 panel_manager->CloseAll(); | 3096 panel_manager->CloseAll(); |
| 3097 } | 3097 } |
| OLD | NEW |