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

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

Issue 11363177: Don't use drag to corner resizing for unresizable windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Created 8 years, 1 month 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') | ui/aura/client/aura_constants.h » ('j') | 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_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/display/mouse_cursor_event_filter.h" 8 #include "ash/display/mouse_cursor_event_filter.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/screen_ash.h" 10 #include "ash/screen_ash.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/shell_window_ids.h" 12 #include "ash/shell_window_ids.h"
13 #include "ash/test/ash_test_base.h" 13 #include "ash/test/ash_test_base.h"
14 #include "ash/test/cursor_manager_test_api.h" 14 #include "ash/test/cursor_manager_test_api.h"
15 #include "ash/wm/cursor_manager.h" 15 #include "ash/wm/cursor_manager.h"
16 #include "ash/wm/property_util.h" 16 #include "ash/wm/property_util.h"
17 #include "ash/wm/shelf_layout_manager.h" 17 #include "ash/wm/shelf_layout_manager.h"
18 #include "ash/wm/window_util.h" 18 #include "ash/wm/window_util.h"
19 #include "ash/wm/workspace_controller.h" 19 #include "ash/wm/workspace_controller.h"
20 #include "ash/wm/workspace/snap_sizer.h" 20 #include "ash/wm/workspace/snap_sizer.h"
21 #include "ash/wm/workspace/phantom_window_controller.h" 21 #include "ash/wm/workspace/phantom_window_controller.h"
22 #include "base/string_number_conversions.h" 22 #include "base/string_number_conversions.h"
23 #include "base/stringprintf.h" 23 #include "base/stringprintf.h"
24 #include "ui/aura/client/aura_constants.h"
24 #include "ui/aura/root_window.h" 25 #include "ui/aura/root_window.h"
25 #include "ui/aura/test/test_window_delegate.h" 26 #include "ui/aura/test/test_window_delegate.h"
26 #include "ui/base/hit_test.h" 27 #include "ui/base/hit_test.h"
27 #include "ui/gfx/insets.h" 28 #include "ui/gfx/insets.h"
28 #include "ui/gfx/screen.h" 29 #include "ui/gfx/screen.h"
29 #include "ui/views/widget/widget.h" 30 #include "ui/views/widget/widget.h"
30 31
31 namespace ash { 32 namespace ash {
32 namespace internal { 33 namespace internal {
33 namespace { 34 namespace {
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 // With the resolution of 200x600 we will hit in this case the 50% screen 511 // With the resolution of 200x600 we will hit in this case the 50% screen
511 // size setting. 512 // size setting.
512 EXPECT_EQ("100,0 100x" + base::IntToString(bottom), 513 EXPECT_EQ("100,0 100x" + base::IntToString(bottom),
513 window_->bounds().ToString()); 514 window_->bounds().ToString());
514 EXPECT_EQ("800,10 50x60", 515 EXPECT_EQ("800,10 50x60",
515 GetRestoreBoundsInScreen(window_.get())->ToString()); 516 GetRestoreBoundsInScreen(window_.get())->ToString());
516 } 517 }
517 #endif 518 #endif
518 } 519 }
519 520
521 // Check that non resizable windows will not get resized.
522 TEST_F(WorkspaceWindowResizerTest, NonResizableWindows) {
523 window_->SetBounds(gfx::Rect(20, 30, 50, 60));
524 window_->SetProperty(aura::client::kCanResizeKey, false);
525
526 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
527 window_.get(), gfx::Point(), HTCAPTION, empty_windows()));
528 ASSERT_TRUE(resizer.get());
529 resizer->Drag(CalculateDragPoint(*resizer, -20, 0), 0);
530 resizer->CompleteDrag(0);
531 EXPECT_EQ("0,30 50x60", window_->bounds().ToString());
532 }
533
520 // Verifies a window can be moved from the primary display to another. 534 // Verifies a window can be moved from the primary display to another.
521 TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiDisplays) { 535 TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiDisplays) {
522 // The secondary display is logically on the right, but on the system (e.g. X) 536 // The secondary display is logically on the right, but on the system (e.g. X)
523 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. 537 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc.
524 UpdateDisplay("800x600,800x600"); 538 UpdateDisplay("800x600,800x600");
525 shelf_layout_manager()->LayoutShelf(); 539 shelf_layout_manager()->LayoutShelf();
526 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 540 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
527 ASSERT_EQ(2U, root_windows.size()); 541 ASSERT_EQ(2U, root_windows.size());
528 542
529 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), 543 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 // Move it 100 to the bottom. 1460 // Move it 100 to the bottom.
1447 resizer->Drag(CalculateDragPoint(*resizer, 0, 100), 0); 1461 resizer->Drag(CalculateDragPoint(*resizer, 0, 100), 0);
1448 EXPECT_EQ("0,150 400x200", window_->bounds().ToString()); 1462 EXPECT_EQ("0,150 400x200", window_->bounds().ToString());
1449 resizer->CompleteDrag(0); 1463 resizer->CompleteDrag(0);
1450 EXPECT_TRUE(ash::wm::HasUserChangedWindowPositionOrSize(window_.get())); 1464 EXPECT_TRUE(ash::wm::HasUserChangedWindowPositionOrSize(window_.get()));
1451 } 1465 }
1452 } 1466 }
1453 1467
1454 } // namespace internal 1468 } // namespace internal
1455 } // namespace ash 1469 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_window_resizer.cc ('k') | ui/aura/client/aura_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698