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

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

Issue 289283015: Extract touchscreen device management into a generic manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 6 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
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/extensions/XInput2.h> 7 #include <X11/extensions/XInput2.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 #include <X11/Xutil.h> 9 #include <X11/Xutil.h>
10 #include <X11/XKBlib.h> 10 #include <X11/XKBlib.h>
11 11
12 // Generically-named #defines from Xlib that conflict with symbols in GTest. 12 // Generically-named #defines from Xlib that conflict with symbols in GTest.
13 #undef Bool 13 #undef Bool
14 #undef None 14 #undef None
15 15
16 #include "base/at_exit.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 #include "ui/events/event.h" 18 #include "ui/events/event.h"
18 #include "ui/events/event_constants.h" 19 #include "ui/events/event_constants.h"
19 #include "ui/events/event_utils.h" 20 #include "ui/events/event_utils.h"
20 #include "ui/events/test/events_test_utils_x11.h" 21 #include "ui/events/test/events_test_utils_x11.h"
22 #include "ui/events/x/device_data_manager_x11.h"
21 #include "ui/gfx/point.h" 23 #include "ui/gfx/point.h"
22 24
23 namespace ui { 25 namespace ui {
24 26
25 namespace { 27 namespace {
26 28
27 // Initializes the passed-in Xlib event. 29 // Initializes the passed-in Xlib event.
28 void InitButtonEvent(XEvent* event, 30 void InitButtonEvent(XEvent* event,
29 bool is_press, 31 bool is_press,
30 const gfx::Point& location, 32 const gfx::Point& location,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 if (x_keycode) { 70 if (x_keycode) {
69 InitKeyEvent(display, &event, true, x_keycode, 0); 71 InitKeyEvent(display, &event, true, x_keycode, 0);
70 ui::KeyEvent ui_key_event(&event, false); 72 ui::KeyEvent ui_key_event(&event, false);
71 return (ui_key_event.flags() & ui::EF_FUNCTION_KEY); 73 return (ui_key_event.flags() & ui::EF_FUNCTION_KEY);
72 } 74 }
73 return true; 75 return true;
74 } 76 }
75 77
76 } // namespace 78 } // namespace
77 79
78 TEST(EventsXTest, ButtonEvents) { 80 class EventsXTest : public testing::Test {
81 public:
82 EventsXTest() {}
83 virtual ~EventsXTest() {}
84
85 virtual void SetUp() OVERRIDE {
86 // Object registers itself with AtExitManager so we don't have to keep track
87 // of it.
88 new DeviceDataManagerX11();
89 }
90 private:
91 base::ShadowingAtExitManager at_exit_;
92
93 DISALLOW_COPY_AND_ASSIGN(EventsXTest);
94 };
95
96 TEST_F(EventsXTest, ButtonEvents) {
79 XEvent event; 97 XEvent event;
80 gfx::Point location(5, 10); 98 gfx::Point location(5, 10);
81 gfx::Vector2d offset; 99 gfx::Vector2d offset;
82 100
83 InitButtonEvent(&event, true, location, 1, 0); 101 InitButtonEvent(&event, true, location, 1, 0);
84 EXPECT_EQ(ui::ET_MOUSE_PRESSED, ui::EventTypeFromNative(&event)); 102 EXPECT_EQ(ui::ET_MOUSE_PRESSED, ui::EventTypeFromNative(&event));
85 EXPECT_EQ(ui::EF_LEFT_MOUSE_BUTTON, ui::EventFlagsFromNative(&event)); 103 EXPECT_EQ(ui::EF_LEFT_MOUSE_BUTTON, ui::EventFlagsFromNative(&event));
86 EXPECT_EQ(location, ui::EventLocationFromNative(&event)); 104 EXPECT_EQ(location, ui::EventLocationFromNative(&event));
87 105
88 InitButtonEvent(&event, true, location, 2, Button1Mask | ShiftMask); 106 InitButtonEvent(&event, true, location, 2, Button1Mask | ShiftMask);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 EXPECT_EQ(ui::ET_MOUSEWHEEL, ui::EventTypeFromNative(&event)); 147 EXPECT_EQ(ui::ET_MOUSEWHEEL, ui::EventTypeFromNative(&event));
130 EXPECT_EQ(0, ui::EventFlagsFromNative(&event)); 148 EXPECT_EQ(0, ui::EventFlagsFromNative(&event));
131 EXPECT_EQ(location, ui::EventLocationFromNative(&event)); 149 EXPECT_EQ(location, ui::EventLocationFromNative(&event));
132 offset = ui::GetMouseWheelOffset(&event); 150 offset = ui::GetMouseWheelOffset(&event);
133 EXPECT_EQ(0, offset.y()); 151 EXPECT_EQ(0, offset.y());
134 EXPECT_LT(offset.x(), 0); 152 EXPECT_LT(offset.x(), 0);
135 153
136 // TODO(derat): Test XInput code. 154 // TODO(derat): Test XInput code.
137 } 155 }
138 156
139 TEST(EventsXTest, AvoidExtraEventsOnWheelRelease) { 157 TEST_F(EventsXTest, AvoidExtraEventsOnWheelRelease) {
140 XEvent event; 158 XEvent event;
141 gfx::Point location(5, 10); 159 gfx::Point location(5, 10);
142 160
143 InitButtonEvent(&event, true, location, 4, 0); 161 InitButtonEvent(&event, true, location, 4, 0);
144 EXPECT_EQ(ui::ET_MOUSEWHEEL, ui::EventTypeFromNative(&event)); 162 EXPECT_EQ(ui::ET_MOUSEWHEEL, ui::EventTypeFromNative(&event));
145 163
146 // We should return ET_UNKNOWN for the release event instead of returning 164 // We should return ET_UNKNOWN for the release event instead of returning
147 // ET_MOUSEWHEEL; otherwise we'll scroll twice for each scrollwheel step. 165 // ET_MOUSEWHEEL; otherwise we'll scroll twice for each scrollwheel step.
148 InitButtonEvent(&event, false, location, 4, 0); 166 InitButtonEvent(&event, false, location, 4, 0);
149 EXPECT_EQ(ui::ET_UNKNOWN, ui::EventTypeFromNative(&event)); 167 EXPECT_EQ(ui::ET_UNKNOWN, ui::EventTypeFromNative(&event));
150 168
151 // TODO(derat): Test XInput code. 169 // TODO(derat): Test XInput code.
152 } 170 }
153 171
154 TEST(EventsXTest, EnterLeaveEvent) { 172 TEST_F(EventsXTest, EnterLeaveEvent) {
155 XEvent event; 173 XEvent event;
156 event.xcrossing.type = EnterNotify; 174 event.xcrossing.type = EnterNotify;
157 event.xcrossing.x = 10; 175 event.xcrossing.x = 10;
158 event.xcrossing.y = 20; 176 event.xcrossing.y = 20;
159 event.xcrossing.x_root = 110; 177 event.xcrossing.x_root = 110;
160 event.xcrossing.y_root = 120; 178 event.xcrossing.y_root = 120;
161 179
162 // Mouse enter events are converted to mouse move events to be consistent with 180 // Mouse enter events are converted to mouse move events to be consistent with
163 // the way views handle mouse enter. See comments for EnterNotify case in 181 // the way views handle mouse enter. See comments for EnterNotify case in
164 // ui::EventTypeFromNative for more details. 182 // ui::EventTypeFromNative for more details.
165 EXPECT_EQ(ui::ET_MOUSE_MOVED, ui::EventTypeFromNative(&event)); 183 EXPECT_EQ(ui::ET_MOUSE_MOVED, ui::EventTypeFromNative(&event));
166 EXPECT_EQ("10,20", ui::EventLocationFromNative(&event).ToString()); 184 EXPECT_EQ("10,20", ui::EventLocationFromNative(&event).ToString());
167 EXPECT_EQ("110,120", ui::EventSystemLocationFromNative(&event).ToString()); 185 EXPECT_EQ("110,120", ui::EventSystemLocationFromNative(&event).ToString());
168 186
169 event.xcrossing.type = LeaveNotify; 187 event.xcrossing.type = LeaveNotify;
170 event.xcrossing.x = 30; 188 event.xcrossing.x = 30;
171 event.xcrossing.y = 40; 189 event.xcrossing.y = 40;
172 event.xcrossing.x_root = 230; 190 event.xcrossing.x_root = 230;
173 event.xcrossing.y_root = 240; 191 event.xcrossing.y_root = 240;
174 EXPECT_EQ(ui::ET_MOUSE_EXITED, ui::EventTypeFromNative(&event)); 192 EXPECT_EQ(ui::ET_MOUSE_EXITED, ui::EventTypeFromNative(&event));
175 EXPECT_EQ("30,40", ui::EventLocationFromNative(&event).ToString()); 193 EXPECT_EQ("30,40", ui::EventLocationFromNative(&event).ToString());
176 EXPECT_EQ("230,240", ui::EventSystemLocationFromNative(&event).ToString()); 194 EXPECT_EQ("230,240", ui::EventSystemLocationFromNative(&event).ToString());
177 } 195 }
178 196
179 TEST(EventsXTest, ClickCount) { 197 TEST_F(EventsXTest, ClickCount) {
180 XEvent event; 198 XEvent event;
181 gfx::Point location(5, 10); 199 gfx::Point location(5, 10);
182 200
183 for (int i = 1; i <= 3; ++i) { 201 for (int i = 1; i <= 3; ++i) {
184 InitButtonEvent(&event, true, location, 1, 0); 202 InitButtonEvent(&event, true, location, 1, 0);
185 { 203 {
186 MouseEvent mouseev(&event); 204 MouseEvent mouseev(&event);
187 EXPECT_EQ(ui::ET_MOUSE_PRESSED, mouseev.type()); 205 EXPECT_EQ(ui::ET_MOUSE_PRESSED, mouseev.type());
188 EXPECT_EQ(i, mouseev.GetClickCount()); 206 EXPECT_EQ(i, mouseev.GetClickCount());
189 } 207 }
190 208
191 InitButtonEvent(&event, false, location, 1, 0); 209 InitButtonEvent(&event, false, location, 1, 0);
192 { 210 {
193 MouseEvent mouseev(&event); 211 MouseEvent mouseev(&event);
194 EXPECT_EQ(ui::ET_MOUSE_RELEASED, mouseev.type()); 212 EXPECT_EQ(ui::ET_MOUSE_RELEASED, mouseev.type());
195 EXPECT_EQ(i, mouseev.GetClickCount()); 213 EXPECT_EQ(i, mouseev.GetClickCount());
196 } 214 }
197 } 215 }
198 } 216 }
199 217
200 #if defined(USE_XI2_MT) 218 #if defined(USE_XI2_MT)
201 TEST(EventsXTest, TouchEventBasic) { 219 TEST_F(EventsXTest, TouchEventBasic) {
202 std::vector<unsigned int> devices; 220 std::vector<unsigned int> devices;
203 devices.push_back(0); 221 devices.push_back(0);
204 ui::SetUpTouchDevicesForTest(devices); 222 ui::SetUpTouchDevicesForTest(devices);
205 std::vector<Valuator> valuators; 223 std::vector<Valuator> valuators;
206 224
207 // Init touch begin with tracking id 5, touch id 0. 225 // Init touch begin with tracking id 5, touch id 0.
208 valuators.push_back(Valuator(DeviceDataManager::DT_TOUCH_MAJOR, 20)); 226 valuators.push_back(Valuator(DeviceDataManagerX11::DT_TOUCH_MAJOR, 20));
209 valuators.push_back(Valuator(DeviceDataManager::DT_TOUCH_ORIENTATION, 0.3f)); 227 valuators.push_back(
210 valuators.push_back(Valuator(DeviceDataManager::DT_TOUCH_PRESSURE, 100)); 228 Valuator(DeviceDataManagerX11::DT_TOUCH_ORIENTATION, 0.3f));
229 valuators.push_back(Valuator(DeviceDataManagerX11::DT_TOUCH_PRESSURE, 100));
211 ui::ScopedXI2Event scoped_xevent; 230 ui::ScopedXI2Event scoped_xevent;
212 scoped_xevent.InitTouchEvent( 231 scoped_xevent.InitTouchEvent(
213 0, XI_TouchBegin, 5, gfx::Point(10, 10), valuators); 232 0, XI_TouchBegin, 5, gfx::Point(10, 10), valuators);
214 EXPECT_EQ(ui::ET_TOUCH_PRESSED, ui::EventTypeFromNative(scoped_xevent)); 233 EXPECT_EQ(ui::ET_TOUCH_PRESSED, ui::EventTypeFromNative(scoped_xevent));
215 EXPECT_EQ("10,10", ui::EventLocationFromNative(scoped_xevent).ToString()); 234 EXPECT_EQ("10,10", ui::EventLocationFromNative(scoped_xevent).ToString());
216 EXPECT_EQ(GetTouchId(scoped_xevent), 0); 235 EXPECT_EQ(GetTouchId(scoped_xevent), 0);
217 EXPECT_EQ(GetTouchRadiusX(scoped_xevent), 10); 236 EXPECT_EQ(GetTouchRadiusX(scoped_xevent), 10);
218 EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.15f); 237 EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.15f);
219 EXPECT_FLOAT_EQ(GetTouchForce(scoped_xevent), 0.1f); 238 EXPECT_FLOAT_EQ(GetTouchForce(scoped_xevent), 0.1f);
220 239
221 // Touch update, with new orientation info. 240 // Touch update, with new orientation info.
222 valuators.clear(); 241 valuators.clear();
223 valuators.push_back(Valuator(DeviceDataManager::DT_TOUCH_ORIENTATION, 0.5f)); 242 valuators.push_back(
243 Valuator(DeviceDataManagerX11::DT_TOUCH_ORIENTATION, 0.5f));
224 scoped_xevent.InitTouchEvent( 244 scoped_xevent.InitTouchEvent(
225 0, XI_TouchUpdate, 5, gfx::Point(20, 20), valuators); 245 0, XI_TouchUpdate, 5, gfx::Point(20, 20), valuators);
226 EXPECT_EQ(ui::ET_TOUCH_MOVED, ui::EventTypeFromNative(scoped_xevent)); 246 EXPECT_EQ(ui::ET_TOUCH_MOVED, ui::EventTypeFromNative(scoped_xevent));
227 EXPECT_EQ("20,20", ui::EventLocationFromNative(scoped_xevent).ToString()); 247 EXPECT_EQ("20,20", ui::EventLocationFromNative(scoped_xevent).ToString());
228 EXPECT_EQ(GetTouchId(scoped_xevent), 0); 248 EXPECT_EQ(GetTouchId(scoped_xevent), 0);
229 EXPECT_EQ(GetTouchRadiusX(scoped_xevent), 10); 249 EXPECT_EQ(GetTouchRadiusX(scoped_xevent), 10);
230 EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.25f); 250 EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.25f);
231 EXPECT_FLOAT_EQ(GetTouchForce(scoped_xevent), 0.1f); 251 EXPECT_FLOAT_EQ(GetTouchForce(scoped_xevent), 0.1f);
232 252
233 // Another touch with tracking id 6, touch id 1. 253 // Another touch with tracking id 6, touch id 1.
234 valuators.clear(); 254 valuators.clear();
235 valuators.push_back(Valuator(DeviceDataManager::DT_TOUCH_MAJOR, 100)); 255 valuators.push_back(Valuator(DeviceDataManagerX11::DT_TOUCH_MAJOR, 100));
236 valuators.push_back(Valuator(DeviceDataManager::DT_TOUCH_ORIENTATION, 0.9f)); 256 valuators.push_back(Valuator(
237 valuators.push_back(Valuator(DeviceDataManager::DT_TOUCH_PRESSURE, 500)); 257 DeviceDataManagerX11::DT_TOUCH_ORIENTATION, 0.9f));
258 valuators.push_back(Valuator(DeviceDataManagerX11::DT_TOUCH_PRESSURE, 500));
238 scoped_xevent.InitTouchEvent( 259 scoped_xevent.InitTouchEvent(
239 0, XI_TouchBegin, 6, gfx::Point(200, 200), valuators); 260 0, XI_TouchBegin, 6, gfx::Point(200, 200), valuators);
240 EXPECT_EQ(ui::ET_TOUCH_PRESSED, ui::EventTypeFromNative(scoped_xevent)); 261 EXPECT_EQ(ui::ET_TOUCH_PRESSED, ui::EventTypeFromNative(scoped_xevent));
241 EXPECT_EQ("200,200", ui::EventLocationFromNative(scoped_xevent).ToString()); 262 EXPECT_EQ("200,200", ui::EventLocationFromNative(scoped_xevent).ToString());
242 EXPECT_EQ(GetTouchId(scoped_xevent), 1); 263 EXPECT_EQ(GetTouchId(scoped_xevent), 1);
243 EXPECT_EQ(GetTouchRadiusX(scoped_xevent), 50); 264 EXPECT_EQ(GetTouchRadiusX(scoped_xevent), 50);
244 EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.45f); 265 EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.45f);
245 EXPECT_FLOAT_EQ(GetTouchForce(scoped_xevent), 0.5f); 266 EXPECT_FLOAT_EQ(GetTouchForce(scoped_xevent), 0.5f);
246 267
247 // Touch with tracking id 5 should have old radius/angle value and new pressue 268 // Touch with tracking id 5 should have old radius/angle value and new pressue
248 // value. 269 // value.
249 valuators.clear(); 270 valuators.clear();
250 valuators.push_back(Valuator(DeviceDataManager::DT_TOUCH_PRESSURE, 50)); 271 valuators.push_back(Valuator(DeviceDataManagerX11::DT_TOUCH_PRESSURE, 50));
251 scoped_xevent.InitTouchEvent( 272 scoped_xevent.InitTouchEvent(
252 0, XI_TouchEnd, 5, gfx::Point(30, 30), valuators); 273 0, XI_TouchEnd, 5, gfx::Point(30, 30), valuators);
253 EXPECT_EQ(ui::ET_TOUCH_RELEASED, ui::EventTypeFromNative(scoped_xevent)); 274 EXPECT_EQ(ui::ET_TOUCH_RELEASED, ui::EventTypeFromNative(scoped_xevent));
254 EXPECT_EQ("30,30", ui::EventLocationFromNative(scoped_xevent).ToString()); 275 EXPECT_EQ("30,30", ui::EventLocationFromNative(scoped_xevent).ToString());
255 EXPECT_EQ(GetTouchId(scoped_xevent), 0); 276 EXPECT_EQ(GetTouchId(scoped_xevent), 0);
256 EXPECT_EQ(GetTouchRadiusX(scoped_xevent), 10); 277 EXPECT_EQ(GetTouchRadiusX(scoped_xevent), 10);
257 EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.25f); 278 EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.25f);
258 EXPECT_FLOAT_EQ(GetTouchForce(scoped_xevent), 0.05f); 279 EXPECT_FLOAT_EQ(GetTouchForce(scoped_xevent), 0.05f);
259 280
260 // Touch with tracking id 6 should have old angle/pressure value and new 281 // Touch with tracking id 6 should have old angle/pressure value and new
261 // radius value. 282 // radius value.
262 valuators.clear(); 283 valuators.clear();
263 valuators.push_back(Valuator(DeviceDataManager::DT_TOUCH_MAJOR, 50)); 284 valuators.push_back(Valuator(DeviceDataManagerX11::DT_TOUCH_MAJOR, 50));
264 scoped_xevent.InitTouchEvent( 285 scoped_xevent.InitTouchEvent(
265 0, XI_TouchEnd, 6, gfx::Point(200, 200), valuators); 286 0, XI_TouchEnd, 6, gfx::Point(200, 200), valuators);
266 EXPECT_EQ(ui::ET_TOUCH_RELEASED, ui::EventTypeFromNative(scoped_xevent)); 287 EXPECT_EQ(ui::ET_TOUCH_RELEASED, ui::EventTypeFromNative(scoped_xevent));
267 EXPECT_EQ("200,200", ui::EventLocationFromNative(scoped_xevent).ToString()); 288 EXPECT_EQ("200,200", ui::EventLocationFromNative(scoped_xevent).ToString());
268 EXPECT_EQ(GetTouchId(scoped_xevent), 1); 289 EXPECT_EQ(GetTouchId(scoped_xevent), 1);
269 EXPECT_EQ(GetTouchRadiusX(scoped_xevent), 25); 290 EXPECT_EQ(GetTouchRadiusX(scoped_xevent), 25);
270 EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.45f); 291 EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.45f);
271 EXPECT_FLOAT_EQ(GetTouchForce(scoped_xevent), 0.5f); 292 EXPECT_FLOAT_EQ(GetTouchForce(scoped_xevent), 0.5f);
272 } 293 }
273 #endif 294 #endif
274 295
275 TEST(EventsXTest, NumpadKeyEvents) { 296 TEST_F(EventsXTest, NumpadKeyEvents) {
276 XEvent event; 297 XEvent event;
277 Display* display = gfx::GetXDisplay(); 298 Display* display = gfx::GetXDisplay();
278 299
279 struct { 300 struct {
280 bool is_numpad_key; 301 bool is_numpad_key;
281 int x_keysym; 302 int x_keysym;
282 ui::KeyboardCode ui_keycode; 303 ui::KeyboardCode ui_keycode;
283 } keys[] = { 304 } keys[] = {
284 // XK_KP_Space and XK_KP_Equal are the extrema in the conventional 305 // XK_KP_Space and XK_KP_Equal are the extrema in the conventional
285 // keysymdef.h numbering. 306 // keysymdef.h numbering.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 InitKeyEvent(display, &event, true, x_keycode, 0); 398 InitKeyEvent(display, &event, true, x_keycode, 0);
378 // int keysym = XLookupKeysym(&event.xkey, 0); 399 // int keysym = XLookupKeysym(&event.xkey, 0);
379 // if (keysym) { 400 // if (keysym) {
380 ui::KeyEvent ui_key_event(&event, false); 401 ui::KeyEvent ui_key_event(&event, false);
381 EXPECT_EQ(keys[k].is_numpad_key ? ui::EF_NUMPAD_KEY : 0, 402 EXPECT_EQ(keys[k].is_numpad_key ? ui::EF_NUMPAD_KEY : 0,
382 ui_key_event.flags() & ui::EF_NUMPAD_KEY); 403 ui_key_event.flags() & ui::EF_NUMPAD_KEY);
383 } 404 }
384 } 405 }
385 } 406 }
386 407
387 TEST(EventsXTest, FunctionKeyEvents) { 408 TEST_F(EventsXTest, FunctionKeyEvents) {
388 Display* display = gfx::GetXDisplay(); 409 Display* display = gfx::GetXDisplay();
389 410
390 // Min function key code minus 1. 411 // Min function key code minus 1.
391 EXPECT_FALSE(HasFunctionKeyFlagSetIfSupported(display, XK_F1 - 1)); 412 EXPECT_FALSE(HasFunctionKeyFlagSetIfSupported(display, XK_F1 - 1));
392 // All function keys. 413 // All function keys.
393 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F1)); 414 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F1));
394 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F2)); 415 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F2));
395 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F3)); 416 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F3));
396 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F4)); 417 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F4));
397 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F5)); 418 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F5));
(...skipping 25 matching lines...) Expand all
423 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F31)); 444 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F31));
424 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F32)); 445 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F32));
425 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F33)); 446 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F33));
426 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F34)); 447 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F34));
427 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F35)); 448 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F35));
428 // Max function key code plus 1. 449 // Max function key code plus 1.
429 EXPECT_FALSE(HasFunctionKeyFlagSetIfSupported(display, XK_F35 + 1)); 450 EXPECT_FALSE(HasFunctionKeyFlagSetIfSupported(display, XK_F35 + 1));
430 } 451 }
431 452
432 } // namespace ui 453 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698