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

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

Issue 2823133002: Clean up some ash constants. (Closed)
Patch Set: ditto Created 3 years, 8 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
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/public/cpp/config.h" 7 #include "ash/public/cpp/config.h"
8 #include "ash/public/cpp/shell_window_ids.h" 8 #include "ash/public/cpp/shell_window_ids.h"
9 #include "ash/screen_util.h" 9 #include "ash/screen_util.h"
10 #include "ash/shelf/shelf_constants.h" 10 #include "ash/shelf/shelf_constants.h"
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 EXPECT_EQ("465,112 320x160", window_->bounds().ToString()); 1018 EXPECT_EQ("465,112 320x160", window_->bounds().ToString());
1019 resizer->Drag(CalculateDragPoint(*resizer, distance_to_right - 7, 0), 0); 1019 resizer->Drag(CalculateDragPoint(*resizer, distance_to_right - 7, 0), 0);
1020 EXPECT_EQ("480,112 320x160", window_->bounds().ToString()); 1020 EXPECT_EQ("480,112 320x160", window_->bounds().ToString());
1021 resizer->Drag(CalculateDragPoint(*resizer, distance_to_right + 15, 0), 0); 1021 resizer->Drag(CalculateDragPoint(*resizer, distance_to_right + 15, 0), 0);
1022 EXPECT_EQ("480,112 320x160", window_->bounds().ToString()); 1022 EXPECT_EQ("480,112 320x160", window_->bounds().ToString());
1023 resizer->Drag(CalculateDragPoint(*resizer, distance_to_right + 32, 0), 0); 1023 resizer->Drag(CalculateDragPoint(*resizer, distance_to_right + 32, 0), 0);
1024 EXPECT_EQ("512,112 320x160", window_->bounds().ToString()); 1024 EXPECT_EQ("512,112 320x160", window_->bounds().ToString());
1025 resizer->Drag(CalculateDragPoint(*resizer, distance_to_right + 33, 0), 0); 1025 resizer->Drag(CalculateDragPoint(*resizer, distance_to_right + 33, 0), 0);
1026 EXPECT_EQ("513,112 320x160", window_->bounds().ToString()); 1026 EXPECT_EQ("513,112 320x160", window_->bounds().ToString());
1027 1027
1028 int auto_hidden_shelf_height = GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE);
1029
1030 // And the bottom should snap too. 1028 // And the bottom should snap too.
1031 resizer->Drag( 1029 resizer->Drag(CalculateDragPoint(*resizer, 0, distance_to_bottom - 7), 0);
1032 CalculateDragPoint(*resizer, 0,
1033 distance_to_bottom - auto_hidden_shelf_height - 7),
1034 0);
1035 EXPECT_EQ(gfx::Rect(96, 440, 320, 160).ToString(), 1030 EXPECT_EQ(gfx::Rect(96, 440, 320, 160).ToString(),
1036 window_->bounds().ToString()); 1031 window_->bounds().ToString());
1037 resizer->Drag( 1032 resizer->Drag(CalculateDragPoint(*resizer, 0, distance_to_bottom + 15), 0);
1038 CalculateDragPoint(*resizer, 0,
1039 distance_to_bottom - auto_hidden_shelf_height + 15),
1040 0);
1041 EXPECT_EQ(gfx::Rect(96, 440, 320, 160).ToString(), 1033 EXPECT_EQ(gfx::Rect(96, 440, 320, 160).ToString(),
1042 window_->bounds().ToString()); 1034 window_->bounds().ToString());
1043 resizer->Drag(CalculateDragPoint(*resizer, 0, distance_to_bottom - 2 + 32), 1035 resizer->Drag(CalculateDragPoint(*resizer, 0, distance_to_bottom - 2 + 32),
1044 0); 1036 0);
1045 EXPECT_EQ("96,470 320x160", window_->bounds().ToString()); 1037 EXPECT_EQ("96,470 320x160", window_->bounds().ToString());
1046 resizer->Drag(CalculateDragPoint(*resizer, 0, distance_to_bottom - 2 + 33), 1038 resizer->Drag(CalculateDragPoint(*resizer, 0, distance_to_bottom - 2 + 33),
1047 0); 1039 0);
1048 EXPECT_EQ("96,471 320x160", window_->bounds().ToString()); 1040 EXPECT_EQ("96,471 320x160", window_->bounds().ToString());
1049 1041
1050 // And the top should snap too. 1042 // And the top should snap too.
1051 resizer->Drag(CalculateDragPoint(*resizer, 0, -distance_to_top + 20), 0); 1043 resizer->Drag(CalculateDragPoint(*resizer, 0, -distance_to_top + 20), 0);
1052 EXPECT_EQ("96,20 320x160", window_->bounds().ToString()); 1044 EXPECT_EQ("96,20 320x160", window_->bounds().ToString());
1053 resizer->Drag(CalculateDragPoint(*resizer, 0, -distance_to_top + 7), 0); 1045 resizer->Drag(CalculateDragPoint(*resizer, 0, -distance_to_top + 7), 0);
1054 EXPECT_EQ("96,0 320x160", window_->bounds().ToString()); 1046 EXPECT_EQ("96,0 320x160", window_->bounds().ToString());
1055 1047
1056 // And bottom/left should snap too. 1048 // And bottom/left should snap too.
1057 resizer->Drag( 1049 resizer->Drag(CalculateDragPoint(*resizer, 7 - distance_to_left,
1058 CalculateDragPoint(*resizer, 7 - distance_to_left, 1050 distance_to_bottom - 7),
1059 distance_to_bottom - auto_hidden_shelf_height - 7), 1051 0);
1060 0);
1061 EXPECT_EQ(gfx::Rect(0, 440, 320, 160).ToString(), 1052 EXPECT_EQ(gfx::Rect(0, 440, 320, 160).ToString(),
1062 window_->bounds().ToString()); 1053 window_->bounds().ToString());
1063 resizer->Drag( 1054 resizer->Drag(CalculateDragPoint(*resizer, -15 - distance_to_left,
1064 CalculateDragPoint(*resizer, -15 - distance_to_left, 1055 distance_to_bottom + 15),
1065 distance_to_bottom - auto_hidden_shelf_height + 15), 1056 0);
1066 0);
1067 EXPECT_EQ(gfx::Rect(0, 440, 320, 160).ToString(), 1057 EXPECT_EQ(gfx::Rect(0, 440, 320, 160).ToString(),
1068 window_->bounds().ToString()); 1058 window_->bounds().ToString());
1069 // should move past snap points. 1059 // should move past snap points.
1070 resizer->Drag(CalculateDragPoint(*resizer, -32 - distance_to_left, 1060 resizer->Drag(CalculateDragPoint(*resizer, -32 - distance_to_left,
1071 distance_to_bottom - 2 + 32), 1061 distance_to_bottom - 2 + 32),
1072 0); 1062 0);
1073 EXPECT_EQ("-32,470 320x160", window_->bounds().ToString()); 1063 EXPECT_EQ("-32,470 320x160", window_->bounds().ToString());
1074 resizer->Drag(CalculateDragPoint(*resizer, -33 - distance_to_left, 1064 resizer->Drag(CalculateDragPoint(*resizer, -33 - distance_to_left,
1075 distance_to_bottom - 2 + 33), 1065 distance_to_bottom - 2 + 33),
1076 0); 1066 0);
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 touch_resize_window_->bounds().ToString()); 1855 touch_resize_window_->bounds().ToString());
1866 // Drag even more to snap to the edge. 1856 // Drag even more to snap to the edge.
1867 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), 1857 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40),
1868 gfx::Point(400, kRootHeight - 25), 1858 gfx::Point(400, kRootHeight - 25),
1869 base::TimeDelta::FromMilliseconds(10), 5); 1859 base::TimeDelta::FromMilliseconds(10), 5);
1870 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), 1860 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(),
1871 touch_resize_window_->bounds().ToString()); 1861 touch_resize_window_->bounds().ToString());
1872 } 1862 }
1873 1863
1874 } // namespace ash 1864 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager_unittest.cc ('k') | chrome/browser/ui/apps/chrome_app_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698