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

Unified Diff: ui/touch_selection/touch_handle_unittest.cc

Issue 1087893003: Support longpress drag selection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/touch_selection/touch_handle.cc ('k') | ui/touch_selection/touch_selection_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/touch_selection/touch_handle_unittest.cc
diff --git a/ui/touch_selection/touch_handle_unittest.cc b/ui/touch_selection/touch_handle_unittest.cc
index e86c3d3881b245953f17aa8621166e934718b1dc..8e929815157bca518ed896be97dfd1dfac95e529 100644
--- a/ui/touch_selection/touch_handle_unittest.cc
+++ b/ui/touch_selection/touch_handle_unittest.cc
@@ -15,7 +15,7 @@ namespace ui {
namespace {
const int kDefaultTapTimeoutMs = 200;
-const float kDefaultTapSlop = 10.f;
+const double kDefaultTapSlop = 10.;
const float kDefaultDrawableSize = 10.f;
struct MockDrawableData {
@@ -74,20 +74,25 @@ class TouchHandleTest : public testing::Test, public TouchHandleClient {
~TouchHandleTest() override {}
// TouchHandleClient implementation.
- void OnHandleDragBegin(const TouchHandle& handle) override {
+ void OnDragBegin(const TouchSelectionDraggable& handler,
+ const gfx::PointF& drag_position) override {
dragging_ = true;
}
- void OnHandleDragUpdate(const TouchHandle& handle,
- const gfx::PointF& new_position) override {
+ void OnDragUpdate(const TouchSelectionDraggable& handler,
+ const gfx::PointF& drag_position) override {
dragged_ = true;
- drag_position_ = new_position;
+ drag_position_ = drag_position;
}
- void OnHandleDragEnd(const TouchHandle& handle) override {
+ void OnDragEnd(const TouchSelectionDraggable& handler) override {
dragging_ = false;
}
+ bool IsWithinTapSlop(const gfx::Vector2dF& delta) const override {
+ return delta.LengthSquared() < (kDefaultTapSlop * kDefaultTapSlop);
+ }
+
void OnHandleTapped(const TouchHandle& handle) override { tapped_ = true; }
void SetNeedsAnimate() override { needs_animate_ = true; }
@@ -100,8 +105,6 @@ class TouchHandleTest : public testing::Test, public TouchHandleClient {
return base::TimeDelta::FromMilliseconds(kDefaultTapTimeoutMs);
}
- float GetTapSlop() const override { return kDefaultTapSlop; }
-
void Animate(TouchHandle& handle) {
needs_animate_ = false;
base::TimeTicks now = base::TimeTicks::Now();
« no previous file with comments | « ui/touch_selection/touch_handle.cc ('k') | ui/touch_selection/touch_selection_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698