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

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

Issue 95403006: x11: Cleanup how valuators are set for X events in tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years 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/events/x/device_data_manager.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/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.
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 EXPECT_EQ(ui::ET_MOUSE_RELEASED, mouseev.type()); 168 EXPECT_EQ(ui::ET_MOUSE_RELEASED, mouseev.type());
169 EXPECT_EQ(i, mouseev.GetClickCount()); 169 EXPECT_EQ(i, mouseev.GetClickCount());
170 } 170 }
171 } 171 }
172 } 172 }
173 173
174 #if defined(USE_XI2_MT) 174 #if defined(USE_XI2_MT)
175 TEST(EventsXTest, TouchEventBasic) { 175 TEST(EventsXTest, TouchEventBasic) {
176 std::vector<unsigned int> devices; 176 std::vector<unsigned int> devices;
177 devices.push_back(0); 177 devices.push_back(0);
178 ui::SetupTouchDevicesForTest(devices); 178 ui::SetUpTouchDevicesForTest(devices);
179 std::vector<Valuator> valuators; 179 std::vector<Valuator> valuators;
180 180
181 // Init touch begin with tracking id 5, touch id 0. 181 // Init touch begin with tracking id 5, touch id 0.
182 valuators.push_back(Valuator(DeviceDataManager::DT_TOUCH_MAJOR, 20)); 182 valuators.push_back(Valuator(DeviceDataManager::DT_TOUCH_MAJOR, 20));
183 valuators.push_back(Valuator(DeviceDataManager::DT_TOUCH_ORIENTATION, 0.3f)); 183 valuators.push_back(Valuator(DeviceDataManager::DT_TOUCH_ORIENTATION, 0.3f));
184 valuators.push_back(Valuator(DeviceDataManager::DT_TOUCH_PRESSURE, 100)); 184 valuators.push_back(Valuator(DeviceDataManager::DT_TOUCH_PRESSURE, 100));
185 ui::ScopedXI2Event scoped_xevent; 185 ui::ScopedXI2Event scoped_xevent;
186 scoped_xevent.InitTouchEvent( 186 scoped_xevent.InitTouchEvent(
187 0, XI_TouchBegin, 5, gfx::Point(10, 10), valuators); 187 0, XI_TouchBegin, 5, gfx::Point(10, 10), valuators);
188 EXPECT_EQ(ui::ET_TOUCH_PRESSED, ui::EventTypeFromNative(scoped_xevent)); 188 EXPECT_EQ(ui::ET_TOUCH_PRESSED, ui::EventTypeFromNative(scoped_xevent));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 0, XI_TouchEnd, 6, gfx::Point(200, 200), valuators); 239 0, XI_TouchEnd, 6, gfx::Point(200, 200), valuators);
240 EXPECT_EQ(ui::ET_TOUCH_RELEASED, ui::EventTypeFromNative(scoped_xevent)); 240 EXPECT_EQ(ui::ET_TOUCH_RELEASED, ui::EventTypeFromNative(scoped_xevent));
241 EXPECT_EQ("200,200", ui::EventLocationFromNative(scoped_xevent).ToString()); 241 EXPECT_EQ("200,200", ui::EventLocationFromNative(scoped_xevent).ToString());
242 EXPECT_EQ(GetTouchId(scoped_xevent), 1); 242 EXPECT_EQ(GetTouchId(scoped_xevent), 1);
243 EXPECT_EQ(GetTouchRadiusX(scoped_xevent), 25); 243 EXPECT_EQ(GetTouchRadiusX(scoped_xevent), 25);
244 EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.45f); 244 EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.45f);
245 EXPECT_FLOAT_EQ(GetTouchForce(scoped_xevent), 0.5f); 245 EXPECT_FLOAT_EQ(GetTouchForce(scoped_xevent), 0.5f);
246 } 246 }
247 #endif 247 #endif
248 } // namespace ui 248 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/x/device_data_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698