| 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/Xlib.h> | 7 #include <X11/Xlib.h> |
| 8 | 8 |
| 9 // Generically-named #defines from Xlib that conflict with symbols in GTest. | 9 // Generically-named #defines from Xlib that conflict with symbols in GTest. |
| 10 #undef Bool | 10 #undef Bool |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 EXPECT_EQ(ui::ET_MOUSEWHEEL, ui::EventTypeFromNative(&event)); | 105 EXPECT_EQ(ui::ET_MOUSEWHEEL, ui::EventTypeFromNative(&event)); |
| 106 | 106 |
| 107 // We should return ET_UNKNOWN for the release event instead of returning | 107 // We should return ET_UNKNOWN for the release event instead of returning |
| 108 // ET_MOUSEWHEEL; otherwise we'll scroll twice for each scrollwheel step. | 108 // ET_MOUSEWHEEL; otherwise we'll scroll twice for each scrollwheel step. |
| 109 InitButtonEvent(&event, false, location, 4, 0); | 109 InitButtonEvent(&event, false, location, 4, 0); |
| 110 EXPECT_EQ(ui::ET_UNKNOWN, ui::EventTypeFromNative(&event)); | 110 EXPECT_EQ(ui::ET_UNKNOWN, ui::EventTypeFromNative(&event)); |
| 111 | 111 |
| 112 // TODO(derat): Test XInput code. | 112 // TODO(derat): Test XInput code. |
| 113 } | 113 } |
| 114 | 114 |
| 115 TEST(EventsXTest, EnterLeaveEvent) { |
| 116 XEvent event; |
| 117 event.xcrossing.type = EnterNotify; |
| 118 event.xcrossing.x = 10; |
| 119 event.xcrossing.y = 20; |
| 120 event.xcrossing.x_root = 110; |
| 121 event.xcrossing.y_root = 120; |
| 122 |
| 123 EXPECT_EQ(ui::ET_MOUSE_ENTERED, ui::EventTypeFromNative(&event)); |
| 124 EXPECT_EQ("10,20", ui::EventLocationFromNative(&event).ToString()); |
| 125 EXPECT_EQ("110,120", ui::EventSystemLocationFromNative(&event).ToString()); |
| 126 |
| 127 event.xcrossing.type = LeaveNotify; |
| 128 event.xcrossing.x = 30; |
| 129 event.xcrossing.y = 40; |
| 130 event.xcrossing.x_root = 230; |
| 131 event.xcrossing.y_root = 240; |
| 132 EXPECT_EQ(ui::ET_MOUSE_EXITED, ui::EventTypeFromNative(&event)); |
| 133 EXPECT_EQ("30,40", ui::EventLocationFromNative(&event).ToString()); |
| 134 EXPECT_EQ("230,240", ui::EventSystemLocationFromNative(&event).ToString()); |
| 135 } |
| 136 |
| 115 } // namespace ui | 137 } // namespace ui |
| OLD | NEW |