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 "ash/wm/workspace/workspace_window_resizer.h" | 5 #include "ash/wm/workspace/workspace_window_resizer.h" |
6 | 6 |
7 #include "ash/ash_constants.h" | 7 #include "ash/ash_constants.h" |
8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 EXPECT_EQ("10,300 200x200", window2_->bounds().ToString()); | 549 EXPECT_EQ("10,300 200x200", window2_->bounds().ToString()); |
550 EXPECT_EQ("20,500 100x100", window3_->bounds().ToString()); | 550 EXPECT_EQ("20,500 100x100", window3_->bounds().ToString()); |
551 | 551 |
552 // 100 up again. | 552 // 100 up again. |
553 resizer->Drag(CalculateDragPoint(*resizer, -10, -100), 0); | 553 resizer->Drag(CalculateDragPoint(*resizer, -10, -100), 0); |
554 EXPECT_EQ("0,0 200x100", window_->bounds().ToString()); | 554 EXPECT_EQ("0,0 200x100", window_->bounds().ToString()); |
555 EXPECT_EQ("10,100 200x266", window2_->bounds().ToString()); | 555 EXPECT_EQ("10,100 200x266", window2_->bounds().ToString()); |
556 EXPECT_EQ("20,366 100x134", window3_->bounds().ToString()); | 556 EXPECT_EQ("20,366 100x134", window3_->bounds().ToString()); |
557 } | 557 } |
558 | 558 |
| 559 // Tests that touch-dragging a window does not lock the mouse cursor |
| 560 // and therefore shows the cursor on a mousemove. |
| 561 TEST_F(WorkspaceWindowResizerTest, MouseMoveWithTouchDrag) { |
| 562 window_->SetBounds(gfx::Rect(0, 300, 400, 300)); |
| 563 window2_->SetBounds(gfx::Rect(400, 200, 100, 200)); |
| 564 |
| 565 Shell* shell = Shell::GetInstance(); |
| 566 aura::test::EventGenerator generator(window_->GetRootWindow()); |
| 567 |
| 568 // The cursor should not be locked initially. |
| 569 EXPECT_FALSE(shell->cursor_manager()->IsCursorLocked()); |
| 570 |
| 571 std::vector<aura::Window*> windows; |
| 572 windows.push_back(window2_.get()); |
| 573 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( |
| 574 window_.get(), gfx::Point(), HTRIGHT, |
| 575 aura::client::WINDOW_MOVE_SOURCE_TOUCH, windows)); |
| 576 ASSERT_TRUE(resizer.get()); |
| 577 |
| 578 // Creating a WorkspaceWindowResizer should not lock the cursor. |
| 579 EXPECT_FALSE(shell->cursor_manager()->IsCursorLocked()); |
| 580 |
| 581 // The cursor should be hidden after touching the screen and |
| 582 // starting a drag. |
| 583 EXPECT_TRUE(shell->cursor_manager()->IsCursorVisible()); |
| 584 generator.PressTouch(); |
| 585 resizer->Drag(CalculateDragPoint(*resizer, 100, 10), 0); |
| 586 EXPECT_FALSE(shell->cursor_manager()->IsCursorVisible()); |
| 587 EXPECT_FALSE(shell->cursor_manager()->IsCursorLocked()); |
| 588 |
| 589 // Moving the mouse should show the cursor. |
| 590 generator.MoveMouseBy(1, 1); |
| 591 EXPECT_TRUE(shell->cursor_manager()->IsCursorVisible()); |
| 592 EXPECT_FALSE(shell->cursor_manager()->IsCursorLocked()); |
| 593 |
| 594 resizer->RevertDrag(); |
| 595 } |
559 | 596 |
560 // Assertions around dragging to the left/right edge of the screen. | 597 // Assertions around dragging to the left/right edge of the screen. |
561 TEST_F(WorkspaceWindowResizerTest, Edge) { | 598 TEST_F(WorkspaceWindowResizerTest, Edge) { |
562 // TODO(varkha): Insets are reset after every drag because of | 599 // TODO(varkha): Insets are reset after every drag because of |
563 // http://crbug.com/292238. | 600 // http://crbug.com/292238. |
564 // Window is wide enough not to get docked right away. | 601 // Window is wide enough not to get docked right away. |
565 window_->SetBounds(gfx::Rect(20, 30, 400, 60)); | 602 window_->SetBounds(gfx::Rect(20, 30, 400, 60)); |
566 wm::WindowState* window_state = wm::GetWindowState(window_.get()); | 603 wm::WindowState* window_state = wm::GetWindowState(window_.get()); |
567 | 604 |
568 { | 605 { |
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1970 RunAnimationTillComplete(phantom_controller->animation_.get()); | 2007 RunAnimationTillComplete(phantom_controller->animation_.get()); |
1971 | 2008 |
1972 // Hide phantom controller. Both widgets should close. | 2009 // Hide phantom controller. Both widgets should close. |
1973 phantom_controller->Hide(); | 2010 phantom_controller->Hide(); |
1974 EXPECT_FALSE(phantom_controller->phantom_widget_); | 2011 EXPECT_FALSE(phantom_controller->phantom_widget_); |
1975 EXPECT_FALSE(phantom_controller->phantom_widget_start_); | 2012 EXPECT_FALSE(phantom_controller->phantom_widget_start_); |
1976 } | 2013 } |
1977 | 2014 |
1978 } // namespace internal | 2015 } // namespace internal |
1979 } // namespace ash | 2016 } // namespace ash |
OLD | NEW |