| 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/screen_ash.h" | 7 #include "ash/screen_ash.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
| 10 #include "ash/wm/property_util.h" | 10 #include "ash/wm/property_util.h" |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 | 399 |
| 400 // 100 up again. | 400 // 100 up again. |
| 401 resizer->Drag(CalculateDragPoint(*resizer, -10, -100)); | 401 resizer->Drag(CalculateDragPoint(*resizer, -10, -100)); |
| 402 EXPECT_EQ("0,0 200x100", window_->bounds().ToString()); | 402 EXPECT_EQ("0,0 200x100", window_->bounds().ToString()); |
| 403 EXPECT_EQ("10,100 200x270", window2_->bounds().ToString()); | 403 EXPECT_EQ("10,100 200x270", window2_->bounds().ToString()); |
| 404 EXPECT_EQ("20,370 100x130", window3_->bounds().ToString()); | 404 EXPECT_EQ("20,370 100x130", window3_->bounds().ToString()); |
| 405 } | 405 } |
| 406 | 406 |
| 407 // Assertions around dragging to the left/right edge of the screen. | 407 // Assertions around dragging to the left/right edge of the screen. |
| 408 TEST_F(WorkspaceWindowResizerTest, Edge) { | 408 TEST_F(WorkspaceWindowResizerTest, Edge) { |
| 409 int bottom = |
| 410 ScreenAsh::GetUnmaximizedWorkAreaBounds(window_.get()).bottom(); |
| 409 window_->SetBounds(gfx::Rect(20, 30, 50, 60)); | 411 window_->SetBounds(gfx::Rect(20, 30, 50, 60)); |
| 410 { | 412 { |
| 411 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( | 413 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( |
| 412 window_.get(), gfx::Point(), HTCAPTION, 0, empty_windows())); | 414 window_.get(), gfx::Point(), HTCAPTION, 0, empty_windows())); |
| 413 ASSERT_TRUE(resizer.get()); | 415 ASSERT_TRUE(resizer.get()); |
| 414 resizer->Drag(CalculateDragPoint(*resizer, 0, 10)); | 416 resizer->Drag(CalculateDragPoint(*resizer, 0, 10)); |
| 415 resizer->CompleteDrag(); | 417 resizer->CompleteDrag(); |
| 416 EXPECT_EQ("0,0 400x600", window_->bounds().ToString()); | 418 EXPECT_EQ("0,0 400x" + base::IntToString(bottom), |
| 419 window_->bounds().ToString()); |
| 417 ASSERT_TRUE(GetRestoreBounds(window_.get())); | 420 ASSERT_TRUE(GetRestoreBounds(window_.get())); |
| 418 EXPECT_EQ("20,30 50x60", GetRestoreBounds(window_.get())->ToString()); | 421 EXPECT_EQ("20,30 50x60", GetRestoreBounds(window_.get())->ToString()); |
| 419 } | 422 } |
| 420 | 423 |
| 421 // Try the same with the right side. | 424 // Try the same with the right side. |
| 422 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( | 425 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( |
| 423 window_.get(), gfx::Point(), HTCAPTION, 0, empty_windows())); | 426 window_.get(), gfx::Point(), HTCAPTION, 0, empty_windows())); |
| 424 ASSERT_TRUE(resizer.get()); | 427 ASSERT_TRUE(resizer.get()); |
| 425 resizer->Drag(CalculateDragPoint(*resizer, 800, 10)); | 428 resizer->Drag(CalculateDragPoint(*resizer, 800, 10)); |
| 426 resizer->CompleteDrag(); | 429 resizer->CompleteDrag(); |
| 427 EXPECT_EQ("400,0 400x600", window_->bounds().ToString()); | 430 EXPECT_EQ("400,0 400x" + base::IntToString(bottom), |
| 431 window_->bounds().ToString()); |
| 428 ASSERT_TRUE(GetRestoreBounds(window_.get())); | 432 ASSERT_TRUE(GetRestoreBounds(window_.get())); |
| 429 EXPECT_EQ("20,30 50x60", GetRestoreBounds(window_.get())->ToString()); | 433 EXPECT_EQ("20,30 50x60", GetRestoreBounds(window_.get())->ToString()); |
| 430 } | 434 } |
| 431 | 435 |
| 432 // Verifies windows are correctly restacked when reordering multiple windows. | 436 // Verifies windows are correctly restacked when reordering multiple windows. |
| 433 TEST_F(WorkspaceWindowResizerTest, RestackAttached) { | 437 TEST_F(WorkspaceWindowResizerTest, RestackAttached) { |
| 434 window_->SetBounds(gfx::Rect( 0, 0, 200, 300)); | 438 window_->SetBounds(gfx::Rect( 0, 0, 200, 300)); |
| 435 window2_->SetBounds(gfx::Rect(200, 0, 100, 200)); | 439 window2_->SetBounds(gfx::Rect(200, 0, 100, 200)); |
| 436 window3_->SetBounds(gfx::Rect(300, 0, 100, 100)); | 440 window3_->SetBounds(gfx::Rect(300, 0, 100, 100)); |
| 437 | 441 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( | 491 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( |
| 488 window_.get(), gfx::Point(), HTCAPTION, 0, empty_windows())); | 492 window_.get(), gfx::Point(), HTCAPTION, 0, empty_windows())); |
| 489 ASSERT_TRUE(resizer.get()); | 493 ASSERT_TRUE(resizer.get()); |
| 490 resizer->Drag(CalculateDragPoint(*resizer, 0, -600)); | 494 resizer->Drag(CalculateDragPoint(*resizer, 0, -600)); |
| 491 EXPECT_EQ("100,10 300x400", window_->bounds().ToString()); | 495 EXPECT_EQ("100,10 300x400", window_->bounds().ToString()); |
| 492 } | 496 } |
| 493 | 497 |
| 494 } // namespace | 498 } // namespace |
| 495 } // namespace test | 499 } // namespace test |
| 496 } // namespace ash | 500 } // namespace ash |
| OLD | NEW |