Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: ash/wm/workspace/workspace_window_resizer_unittest.cc

Issue 424463002: Makes a window that has been resized to maximized bounds, then maximized and then restored shrink (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Maximizes a window that has been resized to maximized bounds (added a test) Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/workspace/workspace_window_resizer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_manager.h" 7 #include "ash/display/display_manager.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_util.h" 9 #include "ash/screen_util.h"
10 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 EXPECT_EQ("0,50 400x300", window_->bounds().ToString()); 413 EXPECT_EQ("0,50 400x300", window_->bounds().ToString());
414 EXPECT_EQ("0,350 200x100", window2_->bounds().ToString()); 414 EXPECT_EQ("0,350 200x100", window2_->bounds().ToString());
415 415
416 // Revert and make sure everything moves back. 416 // Revert and make sure everything moves back.
417 resizer->Drag(CalculateDragPoint(*resizer, 800, 20), 0); 417 resizer->Drag(CalculateDragPoint(*resizer, 800, 20), 0);
418 resizer->RevertDrag(); 418 resizer->RevertDrag();
419 EXPECT_EQ("0,50 400x200", window_->bounds().ToString()); 419 EXPECT_EQ("0,50 400x200", window_->bounds().ToString());
420 EXPECT_EQ("0,250 200x100", window2_->bounds().ToString()); 420 EXPECT_EQ("0,250 200x100", window2_->bounds().ToString());
421 } 421 }
422 422
423 // Tests that resizing a window to maximized bounds (or even close to them with
424 // magnetism) maximizes the window.
425 TEST_F(WorkspaceWindowResizerTest, WindowResizedToMaximizedBoundsIsMaximized) {
426 window_->SetBounds(gfx::Rect(100, 200, 20, 30));
427 window_->SetProperty(aura::client::kCanMaximizeKey, true);
428 {
oshima 2014/07/29 17:00:36 can you add comment what this is doing? (resize th
varkha 2014/07/29 22:19:43 Done.
429 scoped_ptr<WindowResizer> resizer(CreateResizerForTest(
430 window_.get(), gfx::Point(), HTTOPLEFT));
431 ASSERT_TRUE(resizer.get());
432 resizer->Drag(CalculateDragPoint(*resizer, -100 + 2, -200 + 2), 0);
433 resizer->CompleteDrag();
434 }
435 gfx::Rect maximized_bounds = ScreenUtil::GetMaximizedWindowBoundsInParent(
436 window_.get());
437 {
438 scoped_ptr<WindowResizer> resizer(CreateResizerForTest(
oshima 2014/07/29 17:00:36 and here.
varkha 2014/07/29 22:19:43 Done.
439 window_.get(), gfx::Point(), HTBOTTOMRIGHT));
440 ASSERT_TRUE(resizer.get());
441 gfx::Rect bounds = window_->bounds();
442 resizer->Drag(
443 CalculateDragPoint(*resizer,
444 maximized_bounds.right() - bounds.right() - 2,
445 maximized_bounds.bottom() - bounds.bottom() - 2), 0);
446 resizer->CompleteDrag();
447 }
448 EXPECT_EQ(maximized_bounds.ToString(), window_->bounds().ToString());
449 wm::WindowState* window_state = wm::GetWindowState(window_.get());
450 EXPECT_TRUE(window_state->IsMaximized());
451 ASSERT_TRUE(window_state->HasRestoreBounds());
452 EXPECT_EQ("0,0 120x230", window_state->GetRestoreBoundsInScreen().ToString());
453 }
oshima 2014/07/29 17:00:36 can you also add the case where you create the win
varkha 2014/07/29 22:19:43 Done.
454
423 #if defined(OS_WIN) 455 #if defined(OS_WIN)
424 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962 456 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962
425 #define MAYBE_AttachedResize_BOTTOM_3 DISABLED_AttachedResize_BOTTOM_3 457 #define MAYBE_AttachedResize_BOTTOM_3 DISABLED_AttachedResize_BOTTOM_3
426 #else 458 #else
427 #define MAYBE_AttachedResize_BOTTOM_3 AttachedResize_BOTTOM_3 459 #define MAYBE_AttachedResize_BOTTOM_3 AttachedResize_BOTTOM_3
428 #endif 460 #endif
429 461
430 // Assertions around attached window resize dragging from the bottom with 3 462 // Assertions around attached window resize dragging from the bottom with 3
431 // windows. 463 // windows.
432 TEST_F(WorkspaceWindowResizerTest, MAYBE_AttachedResize_BOTTOM_3) { 464 TEST_F(WorkspaceWindowResizerTest, MAYBE_AttachedResize_BOTTOM_3) {
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 // Drag even more to snap to the edge. 1894 // Drag even more to snap to the edge.
1863 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), 1895 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40),
1864 gfx::Point(400, kRootHeight - 25), 1896 gfx::Point(400, kRootHeight - 25),
1865 base::TimeDelta::FromMilliseconds(10), 1897 base::TimeDelta::FromMilliseconds(10),
1866 5); 1898 5);
1867 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), 1899 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(),
1868 touch_resize_window_->bounds().ToString()); 1900 touch_resize_window_->bounds().ToString());
1869 } 1901 }
1870 1902
1871 } // namespace ash 1903 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_window_resizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698