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

Side by Side Diff: ui/views/controls/single_split_view_unittest.cc

Issue 10832282: Replace views::MouseEvent with ui::MouseEvent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | « ui/views/controls/single_split_view.cc ('k') | ui/views/controls/slider.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/logging.h" 5 #include "base/logging.h"
6 #include "testing/gmock/include/gmock/gmock.h" 6 #include "testing/gmock/include/gmock/gmock.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/views/controls/single_split_view.h" 8 #include "ui/views/controls/single_split_view.h"
9 #include "ui/views/controls/single_split_view_listener.h" 9 #include "ui/views/controls/single_split_view_listener.h"
10 10
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 .Times(3); 139 .Times(3);
140 140
141 split.SetBounds(0, 0, 10, 100); 141 split.SetBounds(0, 0, 10, 100);
142 const int kInitialDividerOffset = 33; 142 const int kInitialDividerOffset = 33;
143 const int kMouseOffset = 2; // Mouse offset in the divider. 143 const int kMouseOffset = 2; // Mouse offset in the divider.
144 const int kMouseMoveDelta = 7; 144 const int kMouseMoveDelta = 7;
145 split.set_divider_offset(kInitialDividerOffset); 145 split.set_divider_offset(kInitialDividerOffset);
146 split.Layout(); 146 split.Layout();
147 147
148 // Drag divider to the right, in 2 steps. 148 // Drag divider to the right, in 2 steps.
149 MouseEvent mouse_pressed( 149 gfx::Point press_point(7, kInitialDividerOffset + kMouseOffset);
150 ui::ET_MOUSE_PRESSED, 7, kInitialDividerOffset + kMouseOffset, 0); 150 ui::MouseEvent mouse_pressed(
151 ui::ET_MOUSE_PRESSED, press_point, press_point, 0);
151 ASSERT_TRUE(split.OnMousePressed(mouse_pressed)); 152 ASSERT_TRUE(split.OnMousePressed(mouse_pressed));
152 EXPECT_EQ(kInitialDividerOffset, split.divider_offset()); 153 EXPECT_EQ(kInitialDividerOffset, split.divider_offset());
153 154
154 MouseEvent mouse_dragged_1( 155 gfx::Point drag_1_point(
155 ui::ET_MOUSE_DRAGGED, 5, 156 5, kInitialDividerOffset + kMouseOffset + kMouseMoveDelta);
156 kInitialDividerOffset + kMouseOffset + kMouseMoveDelta, 0); 157 ui::MouseEvent mouse_dragged_1(
158 ui::ET_MOUSE_DRAGGED, drag_1_point, drag_1_point, 0);
157 ASSERT_TRUE(split.OnMouseDragged(mouse_dragged_1)); 159 ASSERT_TRUE(split.OnMouseDragged(mouse_dragged_1));
158 EXPECT_EQ(kInitialDividerOffset + kMouseMoveDelta, split.divider_offset()); 160 EXPECT_EQ(kInitialDividerOffset + kMouseMoveDelta, split.divider_offset());
159 161
160 MouseEvent mouse_dragged_2( 162 gfx::Point drag_2_point(
161 ui::ET_MOUSE_DRAGGED, 6, 163 6, kInitialDividerOffset + kMouseOffset + kMouseMoveDelta * 2);
162 kInitialDividerOffset + kMouseOffset + kMouseMoveDelta * 2, 0); 164 ui::MouseEvent mouse_dragged_2(
165 ui::ET_MOUSE_DRAGGED, drag_2_point, drag_2_point, 0);
163 ASSERT_TRUE(split.OnMouseDragged(mouse_dragged_2)); 166 ASSERT_TRUE(split.OnMouseDragged(mouse_dragged_2));
164 EXPECT_EQ(kInitialDividerOffset + kMouseMoveDelta * 2, 167 EXPECT_EQ(kInitialDividerOffset + kMouseMoveDelta * 2,
165 split.divider_offset()); 168 split.divider_offset());
166 169
167 MouseEvent mouse_released( 170 gfx::Point release_point(
168 ui::ET_MOUSE_RELEASED, 7, 171 7, kInitialDividerOffset + kMouseOffset + kMouseMoveDelta * 2);
169 kInitialDividerOffset + kMouseOffset + kMouseMoveDelta * 2, 0); 172 ui::MouseEvent mouse_released(
173 ui::ET_MOUSE_RELEASED, release_point, release_point, 0);
170 split.OnMouseReleased(mouse_released); 174 split.OnMouseReleased(mouse_released);
171 EXPECT_EQ(kInitialDividerOffset + kMouseMoveDelta * 2, 175 EXPECT_EQ(kInitialDividerOffset + kMouseMoveDelta * 2,
172 split.divider_offset()); 176 split.divider_offset());
173 177
174 // Expect intial offset after a system/user gesture cancels the drag. 178 // Expect intial offset after a system/user gesture cancels the drag.
175 // This shouldn't occur after mouse release, but it's sufficient for testing. 179 // This shouldn't occur after mouse release, but it's sufficient for testing.
176 split.OnMouseCaptureLost(); 180 split.OnMouseCaptureLost();
177 EXPECT_EQ(kInitialDividerOffset, split.divider_offset()); 181 EXPECT_EQ(kInitialDividerOffset, split.divider_offset());
178 } 182 }
179 183
180 } // namespace views 184 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/single_split_view.cc ('k') | ui/views/controls/slider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698