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

Side by Side Diff: ui/touch_selection/touch_selection_controller_unittest.cc

Issue 1129443006: Increase the slop value for text selection offsets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test Created 5 years, 6 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
« no previous file with comments | « ui/touch_selection/touch_selection_controller.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/touch_selection/touch_selection_controller.h" 5 #include "ui/touch_selection/touch_selection_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 // Start dragging the handle on the small line. 877 // Start dragging the handle on the small line.
878 MockMotionEvent event(MockMotionEvent::ACTION_DOWN, event_time, 878 MockMotionEvent event(MockMotionEvent::ACTION_DOWN, event_time,
879 small_line_rect.x(), small_line_rect.y()); 879 small_line_rect.x(), small_line_rect.y());
880 SetDraggingEnabled(true); 880 SetDraggingEnabled(true);
881 EXPECT_TRUE(controller().WillHandleTouchEvent(event)); 881 EXPECT_TRUE(controller().WillHandleTouchEvent(event));
882 EXPECT_THAT(GetAndResetEvents(), ElementsAre(SELECTION_DRAG_STARTED)); 882 EXPECT_THAT(GetAndResetEvents(), ElementsAre(SELECTION_DRAG_STARTED));
883 // The drag coordinate for large lines should be capped to a reasonable 883 // The drag coordinate for large lines should be capped to a reasonable
884 // offset, allowing seamless transition to neighboring lines with different 884 // offset, allowing seamless transition to neighboring lines with different
885 // sizes. The drag coordinate for small lines should have an offset 885 // sizes. The drag coordinate for small lines should have an offset
886 // commensurate with the small line size. 886 // commensurate with the small line size.
887 EXPECT_EQ(large_line_rect.bottom_left() - gfx::Vector2dF(0, 5.f), 887 EXPECT_EQ(large_line_rect.bottom_left() - gfx::Vector2dF(0, 8.f),
888 GetLastSelectionStart()); 888 GetLastSelectionStart());
889 EXPECT_EQ(small_line_rect.CenterPoint(), GetLastSelectionEnd()); 889 EXPECT_EQ(small_line_rect.CenterPoint(), GetLastSelectionEnd());
890 890
891 small_line_rect += gfx::Vector2dF(25.f, 0); 891 small_line_rect += gfx::Vector2dF(25.f, 0);
892 event = MockMotionEvent(MockMotionEvent::ACTION_MOVE, event_time, 892 event = MockMotionEvent(MockMotionEvent::ACTION_MOVE, event_time,
893 small_line_rect.x(), small_line_rect.y()); 893 small_line_rect.x(), small_line_rect.y());
894 EXPECT_TRUE(controller().WillHandleTouchEvent(event)); 894 EXPECT_TRUE(controller().WillHandleTouchEvent(event));
895 EXPECT_TRUE(GetAndResetSelectionMoved()); 895 EXPECT_TRUE(GetAndResetSelectionMoved());
896 EXPECT_EQ(small_line_rect.CenterPoint(), GetLastSelectionEnd()); 896 EXPECT_EQ(small_line_rect.CenterPoint(), GetLastSelectionEnd());
897 } 897 }
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 ASSERT_THAT(GetAndResetEvents(), ElementsAre(SELECTION_MOVED)); 1257 ASSERT_THAT(GetAndResetEvents(), ElementsAre(SELECTION_MOVED));
1258 EXPECT_EQ(gfx::RectF(6, 5, 44, 10), controller().GetRectBetweenBounds()); 1258 EXPECT_EQ(gfx::RectF(6, 5, 44, 10), controller().GetRectBetweenBounds());
1259 EXPECT_EQ(GetLastEventBoundsRect(), controller().GetRectBetweenBounds()); 1259 EXPECT_EQ(GetLastEventBoundsRect(), controller().GetRectBetweenBounds());
1260 1260
1261 ClearSelection(); 1261 ClearSelection();
1262 ASSERT_THAT(GetAndResetEvents(), ElementsAre(SELECTION_CLEARED)); 1262 ASSERT_THAT(GetAndResetEvents(), ElementsAre(SELECTION_CLEARED));
1263 EXPECT_EQ(gfx::RectF(), controller().GetRectBetweenBounds()); 1263 EXPECT_EQ(gfx::RectF(), controller().GetRectBetweenBounds());
1264 } 1264 }
1265 1265
1266 } // namespace ui 1266 } // namespace ui
OLDNEW
« no previous file with comments | « ui/touch_selection/touch_selection_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698