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

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: Wrap ForwardTouchEventWithLatencyInfo to always reset points 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
« no previous file with comments | « ui/events/blink/blink_event_util.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 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 touch_point;
33 touch_point.id = 1;
34 touch_point.state = blink::WebTouchPoint::StateMoved;
35
36 blink::WebTouchEvent coalesced_event;
37 coalesced_event.setType(blink::WebInputEvent::TouchMove);
38 touch_point.movementX = 5;
39 touch_point.movementY = 10;
40 coalesced_event.touches[coalesced_event.touchesLength++] = touch_point;
41
42 blink::WebTouchEvent event_to_be_coalesced;
43 event_to_be_coalesced.setType(blink::WebInputEvent::TouchMove);
44 touch_point.movementX = 3;
45 touch_point.movementY = -4;
46 event_to_be_coalesced.touches[event_to_be_coalesced.touchesLength++] =
47 touch_point;
48
49 EXPECT_TRUE(CanCoalesce(event_to_be_coalesced, coalesced_event));
50 Coalesce(event_to_be_coalesced, &coalesced_event);
51 EXPECT_EQ(8, coalesced_event.touches[0].movementX);
52 EXPECT_EQ(6, coalesced_event.touches[0].movementY);
53 }
54
31 } // namespace ui 55 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/blink/blink_event_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698