OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <cstring> | 5 #include <cstring> |
6 | 6 |
7 #include <X11/extensions/XInput2.h> | 7 #include <X11/extensions/XInput2.h> |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 | 9 |
10 // Generically-named #defines from Xlib that conflict with symbols in GTest. | 10 // Generically-named #defines from Xlib that conflict with symbols in GTest. |
11 #undef Bool | 11 #undef Bool |
12 #undef None | 12 #undef None |
13 | 13 |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "ui/base/touch/touch_factory_x11.h" | 15 #include "ui/base/touch/touch_factory_x11.h" |
16 #include "ui/base/x/device_data_manager.h" | |
17 #include "ui/events/event.h" | 16 #include "ui/events/event.h" |
18 #include "ui/events/event_constants.h" | 17 #include "ui/events/event_constants.h" |
19 #include "ui/events/event_utils.h" | 18 #include "ui/events/event_utils.h" |
| 19 #include "ui/events/x/device_data_manager.h" |
20 #include "ui/gfx/point.h" | 20 #include "ui/gfx/point.h" |
21 | 21 |
22 namespace ui { | 22 namespace ui { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // Initializes the passed-in Xlib event. | 26 // Initializes the passed-in Xlib event. |
27 void InitButtonEvent(XEvent* event, | 27 void InitButtonEvent(XEvent* event, |
28 bool is_press, | 28 bool is_press, |
29 const gfx::Point& location, | 29 const gfx::Point& location, |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 EXPECT_EQ(ui::ET_TOUCH_RELEASED, ui::EventTypeFromNative(event)); | 326 EXPECT_EQ(ui::ET_TOUCH_RELEASED, ui::EventTypeFromNative(event)); |
327 EXPECT_EQ("200,200", ui::EventLocationFromNative(event).ToString()); | 327 EXPECT_EQ("200,200", ui::EventLocationFromNative(event).ToString()); |
328 EXPECT_EQ(GetTouchId(event), 1); | 328 EXPECT_EQ(GetTouchId(event), 1); |
329 EXPECT_EQ(GetTouchRadiusX(event), 25); | 329 EXPECT_EQ(GetTouchRadiusX(event), 25); |
330 EXPECT_FLOAT_EQ(GetTouchAngle(event), 0.45f); | 330 EXPECT_FLOAT_EQ(GetTouchAngle(event), 0.45f); |
331 EXPECT_FLOAT_EQ(GetTouchForce(event), 0.5f); | 331 EXPECT_FLOAT_EQ(GetTouchForce(event), 0.5f); |
332 DestroyTouchEvent(event); | 332 DestroyTouchEvent(event); |
333 } | 333 } |
334 #endif | 334 #endif |
335 } // namespace ui | 335 } // namespace ui |
OLD | NEW |