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/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 resizer->Drag(CalculateDragPoint(*resizer, 10, 10), 0); | 600 resizer->Drag(CalculateDragPoint(*resizer, 10, 10), 0); |
601 EXPECT_FALSE(resizer->snap_phantom_window_controller_.get()); | 601 EXPECT_FALSE(resizer->snap_phantom_window_controller_.get()); |
602 EXPECT_FALSE(resizer->drag_phantom_window_controller_.get()); | 602 EXPECT_FALSE(resizer->drag_phantom_window_controller_.get()); |
603 | 603 |
604 // The window spans both root windows. | 604 // The window spans both root windows. |
605 resizer->Drag(CalculateDragPoint(*resizer, 798, 10), 0); | 605 resizer->Drag(CalculateDragPoint(*resizer, 798, 10), 0); |
606 EXPECT_FALSE(resizer->snap_phantom_window_controller_.get()); | 606 EXPECT_FALSE(resizer->snap_phantom_window_controller_.get()); |
607 PhantomWindowController* controller = | 607 PhantomWindowController* controller = |
608 resizer->drag_phantom_window_controller_.get(); | 608 resizer->drag_phantom_window_controller_.get(); |
609 ASSERT_TRUE(controller); | 609 ASSERT_TRUE(controller); |
610 EXPECT_EQ(PhantomWindowController::STYLE_WINDOW, controller->style()); | 610 EXPECT_EQ(PhantomWindowController::STYLE_NONE, controller->style()); |
| 611 EXPECT_EQ(resizer->layer_, controller->layer()); |
611 // |window_| should be opaque since the pointer is still on the primary | 612 // |window_| should be opaque since the pointer is still on the primary |
612 // root window. The phantom should be semi-transparent. | 613 // root window. The phantom should be semi-transparent. |
613 EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity()); | 614 EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity()); |
614 EXPECT_GT(1.0f, controller->GetOpacity()); | 615 EXPECT_GT(1.0f, controller->GetOpacity()); |
615 | 616 |
616 // Enter the pointer to the secondary display. | 617 // Enter the pointer to the secondary display. |
617 resizer->Drag(CalculateDragPoint(*resizer, 0, 610), 0); | 618 resizer->Drag(CalculateDragPoint(*resizer, 0, 610), 0); |
618 EXPECT_FALSE(resizer->snap_phantom_window_controller_.get()); | 619 EXPECT_FALSE(resizer->snap_phantom_window_controller_.get()); |
619 controller = resizer->drag_phantom_window_controller_.get(); | 620 controller = resizer->drag_phantom_window_controller_.get(); |
620 ASSERT_TRUE(controller); | 621 ASSERT_TRUE(controller); |
621 EXPECT_EQ(PhantomWindowController::STYLE_WINDOW, controller->style()); | 622 EXPECT_EQ(PhantomWindowController::STYLE_NONE, controller->style()); |
622 // |window_| should be transparent, and the phantom should be opaque. | 623 // |window_| should be transparent, and the phantom should be opaque. |
623 EXPECT_GT(1.0f, window_->layer()->opacity()); | 624 EXPECT_GT(1.0f, window_->layer()->opacity()); |
624 EXPECT_FLOAT_EQ(1.0f, controller->GetOpacity()); | 625 EXPECT_FLOAT_EQ(1.0f, controller->GetOpacity()); |
625 | 626 |
626 resizer->CompleteDrag(0); | 627 resizer->CompleteDrag(0); |
627 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); | 628 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); |
628 EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity()); | 629 EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity()); |
629 } | 630 } |
630 | 631 |
631 // Do the same test with RevertDrag(). | 632 // Do the same test with RevertDrag(). |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 ASSERT_TRUE(resizer.get()); | 882 ASSERT_TRUE(resizer.get()); |
882 // Ctrl + drag the window to new poistion by adding (10, 12) to its origin, | 883 // Ctrl + drag the window to new poistion by adding (10, 12) to its origin, |
883 // the window should move to the exact position. | 884 // the window should move to the exact position. |
884 resizer->Drag(CalculateDragPoint(*resizer, 10, 12), 0); | 885 resizer->Drag(CalculateDragPoint(*resizer, 10, 12), 0); |
885 resizer->CompleteDrag(ui::EF_CONTROL_DOWN); | 886 resizer->CompleteDrag(ui::EF_CONTROL_DOWN); |
886 EXPECT_EQ("106,124 320x160", window_->bounds().ToString()); | 887 EXPECT_EQ("106,124 320x160", window_->bounds().ToString()); |
887 } | 888 } |
888 | 889 |
889 } // namespace test | 890 } // namespace test |
890 } // namespace ash | 891 } // namespace ash |
OLD | NEW |