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

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

Issue 23471004: Only support left/right maximizing at 50% width when the --ash-enable-alternate-caption-button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
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/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_controller.h" 9 #include "ash/display/display_controller.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 window_.get(), gfx::Point(), HTCAPTION, 1134 window_.get(), gfx::Point(), HTCAPTION,
1135 aura::client::WINDOW_MOVE_SOURCE_MOUSE, empty_windows())); 1135 aura::client::WINDOW_MOVE_SOURCE_MOUSE, empty_windows()));
1136 ASSERT_TRUE(resizer.get()); 1136 ASSERT_TRUE(resizer.get());
1137 // Ctrl + drag the window to new poistion by adding (10, 12) to its origin, 1137 // Ctrl + drag the window to new poistion by adding (10, 12) to its origin,
1138 // the window should move to the exact position. 1138 // the window should move to the exact position.
1139 resizer->Drag(CalculateDragPoint(*resizer, 10, 12), 0); 1139 resizer->Drag(CalculateDragPoint(*resizer, 10, 12), 0);
1140 resizer->CompleteDrag(ui::EF_CONTROL_DOWN); 1140 resizer->CompleteDrag(ui::EF_CONTROL_DOWN);
1141 EXPECT_EQ("106,124 320x160", window_->bounds().ToString()); 1141 EXPECT_EQ("106,124 320x160", window_->bounds().ToString());
1142 } 1142 }
1143 1143
1144 // Check that only usable sizes get returned by the resizer.
1145 TEST_F(WorkspaceWindowResizerTest, TestProperSizerResolutions) {
1146 // Check that we have the correct work area resolution which fits our
1147 // expected test result.
1148 gfx::Rect work_area(ScreenAsh::GetDisplayWorkAreaBoundsInParent(
1149 window_.get()));
1150 EXPECT_EQ(800, work_area.width());
1151
1152 window_->SetBounds(gfx::Rect(96, 112, 320, 160));
1153 scoped_ptr<SnapSizer> resizer(new SnapSizer(
1154 window_.get(),
1155 gfx::Point(),
1156 SnapSizer::LEFT_EDGE,
1157 SnapSizer::OTHER_INPUT));
1158 ASSERT_TRUE(resizer.get());
1159 shelf_layout_manager()->SetAutoHideBehavior(
1160 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
1161
1162 // Check that the list is declining and contains elements of the
1163 // ideal size list [1280, 1024, 768, 640] as well as 50% and 90% the work
1164 // area.
1165 gfx::Rect rect = resizer->GetTargetBoundsForSize(0);
1166 EXPECT_EQ("0,0 720x597", rect.ToString());
1167 rect = resizer->GetTargetBoundsForSize(1);
1168 EXPECT_EQ("0,0 640x597", rect.ToString());
1169 rect = resizer->GetTargetBoundsForSize(2);
1170 EXPECT_EQ("0,0 400x597", rect.ToString());
1171 shelf_layout_manager()->SetAutoHideBehavior(
1172 SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
1173 rect = resizer->GetTargetBoundsForSize(0);
1174 EXPECT_EQ("0,0 720x553", rect.ToString());
1175 rect = resizer->GetTargetBoundsForSize(1);
1176 EXPECT_EQ("0,0 640x553", rect.ToString());
1177 rect = resizer->GetTargetBoundsForSize(2);
1178 EXPECT_EQ("0,0 400x553", rect.ToString());
1179 }
1180
1181 // Verifies that a dragged window will restore to its pre-maximized size. 1144 // Verifies that a dragged window will restore to its pre-maximized size.
1182 TEST_F(WorkspaceWindowResizerTest, RestoreToPreMaximizeCoordinates) { 1145 TEST_F(WorkspaceWindowResizerTest, RestoreToPreMaximizeCoordinates) {
1183 window_->SetBounds(gfx::Rect(0, 0, 1000, 1000)); 1146 window_->SetBounds(gfx::Rect(0, 0, 1000, 1000));
1184 SetRestoreBoundsInScreen(window_.get(), gfx::Rect(96, 112, 320, 160)); 1147 SetRestoreBoundsInScreen(window_.get(), gfx::Rect(96, 112, 320, 160));
1185 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( 1148 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
1186 window_.get(), gfx::Point(), HTCAPTION, 1149 window_.get(), gfx::Point(), HTCAPTION,
1187 aura::client::WINDOW_MOVE_SOURCE_MOUSE, empty_windows())); 1150 aura::client::WINDOW_MOVE_SOURCE_MOUSE, empty_windows()));
1188 ASSERT_TRUE(resizer.get()); 1151 ASSERT_TRUE(resizer.get());
1189 // Drag the window to new position by adding (10, 10) to original point, 1152 // Drag the window to new position by adding (10, 10) to original point,
1190 // the window should get restored. 1153 // the window should get restored.
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
1969 RunAnimationTillComplete(phantom_controller->animation_.get()); 1932 RunAnimationTillComplete(phantom_controller->animation_.get());
1970 1933
1971 // Hide phantom controller. Both widgets should close. 1934 // Hide phantom controller. Both widgets should close.
1972 phantom_controller->Hide(); 1935 phantom_controller->Hide();
1973 EXPECT_FALSE(phantom_controller->phantom_widget_); 1936 EXPECT_FALSE(phantom_controller->phantom_widget_);
1974 EXPECT_FALSE(phantom_controller->phantom_widget_start_); 1937 EXPECT_FALSE(phantom_controller->phantom_widget_start_);
1975 } 1938 }
1976 1939
1977 } // namespace internal 1940 } // namespace internal
1978 } // namespace ash 1941 } // namespace ash
OLDNEW
« ash/wm/workspace/snap_sizer_unittest.cc ('K') | « ash/wm/workspace/snap_sizer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698