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

Side by Side Diff: ui/events/blink/blink_event_util_unittest.cc

Issue 2624783002: Fix movementX/Y attributes for touch pointer events (Closed)
Patch Set: Move the logic to InputRouterImpl Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/events/blink/blink_event_util.h" 5 #include "ui/events/blink/blink_event_util.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "third_party/WebKit/public/platform/WebGestureEvent.h" 9 #include "third_party/WebKit/public/platform/WebGestureEvent.h"
10 #include "third_party/WebKit/public/platform/WebInputEvent.h" 10 #include "third_party/WebKit/public/platform/WebInputEvent.h"
(...skipping 10 matching lines...) Expand all
21 CreateWebGestureEvent(details, 21 CreateWebGestureEvent(details,
22 base::TimeTicks(), 22 base::TimeTicks(),
23 gfx::PointF(1.f, 1.f), 23 gfx::PointF(1.f, 1.f),
24 gfx::PointF(1.f, 1.f), 24 gfx::PointF(1.f, 1.f),
25 0, 25 0,
26 0U); 26 0U);
27 EXPECT_FALSE(ScaleWebInputEvent(event, 1.f)); 27 EXPECT_FALSE(ScaleWebInputEvent(event, 1.f));
28 EXPECT_TRUE(ScaleWebInputEvent(event, 2.f)); 28 EXPECT_TRUE(ScaleWebInputEvent(event, 2.f));
29 } 29 }
30 30
31 TEST(BlinkEventUtilTest, TouchEventCoalescing) {
32 blink::WebTouchPoint touchPoint;
33 touchPoint.id = 1;
34 touchPoint.state = blink::WebTouchPoint::StateMoved;
35
36 blink::WebTouchEvent coalesced_event;
37 coalesced_event.setType(blink::WebInputEvent::TouchMove);
38 touchPoint.movementX = 5;
39 touchPoint.movementY = 10;
40 coalesced_event.touches[coalesced_event.touchesLength++] =
41 touchPoint;
42
43 blink::WebTouchEvent event_to_be_coalesced;
44 event_to_be_coalesced.setType(blink::WebInputEvent::TouchMove);
45 touchPoint.movementX = 3;
46 touchPoint.movementY = -4;
47 event_to_be_coalesced.touches[event_to_be_coalesced.touchesLength++] =
48 touchPoint;
49
50 EXPECT_TRUE(CanCoalesce(event_to_be_coalesced, coalesced_event));
51 Coalesce(event_to_be_coalesced, &coalesced_event);
52 EXPECT_EQ(8, coalesced_event.touches[0].movementX);
53 EXPECT_EQ(6, coalesced_event.touches[0].movementY);
54
55 }
56
31 } // namespace ui 57 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698