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

Side by Side Diff: ui/base/x/events_x_unittest.cc

Issue 11031031: Merge 159810 - Use correct location for Enter/LeaveNotify (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1271/src/
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « ui/base/x/events_x.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 (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
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
OLDNEW
« no previous file with comments | « ui/base/x/events_x.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698