diff options
-rw-r--r-- | tests/server/barriers-common.h | 66 | ||||
-rw-r--r-- | tests/server/barriers-devices.cpp | 62 |
2 files changed, 66 insertions, 62 deletions
diff --git a/tests/server/barriers-common.h b/tests/server/barriers-common.h index cfce4d2..383a8b5 100644 --- a/tests/server/barriers-common.h +++ b/tests/server/barriers-common.h @@ -56,4 +56,70 @@ public: } }; +class BarrierDevices : public XITServerInputTest { +public: + std::auto_ptr<xorg::testing::evemu::Device> dev1; + std::auto_ptr<xorg::testing::evemu::Device> dev2; + + int master_id_1; + int master_id_2; + + virtual void SetUp() { + dev1 = std::auto_ptr<xorg::testing::evemu::Device>( + new xorg::testing::evemu::Device( + RECORDINGS_DIR "mice/PIXART-USB-OPTICAL-MOUSE-HWHEEL.desc" + )); + dev2 = std::auto_ptr<xorg::testing::evemu::Device>( + new xorg::testing::evemu::Device( + RECORDINGS_DIR "mice/PIXART-USB-OPTICAL-MOUSE-HWHEEL.desc" + )); + XITServerInputTest::SetUp(); + ConfigureDevices(); + } + + void ConfigureDevices() { + ::Display *dpy = Display(); + int device_id_2; + + XIAnyHierarchyChangeInfo change; + change.add = (XIAddMasterInfo) { + .type = XIAddMaster, + .name = (char *) "New Master", + .send_core = False, + .enable = True + }; + + master_id_1 = VIRTUAL_CORE_POINTER_ID; + + ASSERT_EQ(XIChangeHierarchy(dpy, &change, 1), Success) << "Couldn't add the new master device."; + ASSERT_TRUE(xorg::testing::XServer::WaitForDevice(dpy, "New Master pointer")) << "Didn't get the new master pointer device."; + ASSERT_TRUE(FindInputDeviceByName(dpy, "New Master pointer", &master_id_2)) << "Failed to find the new master pointer."; + ASSERT_TRUE(FindInputDeviceByName(dpy, "--device2--", &device_id_2)) << "Failed to find device2."; + + change.attach = (XIAttachSlaveInfo) { + .type = XIAttachSlave, + .deviceid = device_id_2, + .new_master = master_id_2, + }; + ASSERT_EQ(XIChangeHierarchy(dpy, &change, 1), Success) << "Couldn't attach device2 to the new master pointer."; + } + + virtual void SetUpConfigAndLog() { + config.AddDefaultScreenWithDriver(); + config.AddInputSection("evdev", "--device1--", + "Option \"CorePointer\" \"on\"" + "Option \"AccelerationProfile\" \"-1\"" + "Option \"Device\" \"" + dev1->GetDeviceNode() + "\""); + + config.AddInputSection("evdev", "--device2--", + "Option \"CorePointer\" \"on\"" + "Option \"AccelerationProfile\" \"-1\"" + "Option \"Device\" \"" + dev2->GetDeviceNode() + "\""); + + config.AddInputSection("kbd", "kbd-device", + "Option \"CoreKeyboard\" \"on\"\n"); + config.WriteConfig(); + } +}; + #endif diff --git a/tests/server/barriers-devices.cpp b/tests/server/barriers-devices.cpp index 55ebc3a..3f3464a 100644 --- a/tests/server/barriers-devices.cpp +++ b/tests/server/barriers-devices.cpp @@ -14,68 +14,6 @@ using namespace xorg::testing::evemu; -/* BarrierTest doesn't give us anything useful, so don't - * bother using it. */ -class BarrierDevices : public XITServerInputTest { -public: - std::auto_ptr<xorg::testing::evemu::Device> dev1; - std::auto_ptr<xorg::testing::evemu::Device> dev2; - - int master_id_1; - int master_id_2; - - virtual void SetUp() { - dev1 = std::auto_ptr<Device>(new Device(RECORDINGS_DIR "mice/PIXART-USB-OPTICAL-MOUSE-HWHEEL.desc")); - dev2 = std::auto_ptr<Device>(new Device(RECORDINGS_DIR "mice/PIXART-USB-OPTICAL-MOUSE-HWHEEL.desc")); - XITServerInputTest::SetUp(); - ConfigureDevices(); - } - - void ConfigureDevices() { - ::Display *dpy = Display(); - int device_id_2; - - XIAnyHierarchyChangeInfo change; - change.add = (XIAddMasterInfo) { - .type = XIAddMaster, - .name = (char *) "New Master", - .send_core = False, - .enable = True - }; - - master_id_1 = VIRTUAL_CORE_POINTER_ID; - - ASSERT_EQ(XIChangeHierarchy(dpy, &change, 1), Success) << "Couldn't add the new master device."; - ASSERT_TRUE(xorg::testing::XServer::WaitForDevice(dpy, "New Master pointer")) << "Didn't get the new master pointer device."; - ASSERT_TRUE(FindInputDeviceByName(dpy, "New Master pointer", &master_id_2)) << "Failed to find the new master pointer."; - ASSERT_TRUE(FindInputDeviceByName(dpy, "--device2--", &device_id_2)) << "Failed to find device2."; - - change.attach = (XIAttachSlaveInfo) { - .type = XIAttachSlave, - .deviceid = device_id_2, - .new_master = master_id_2, - }; - ASSERT_EQ(XIChangeHierarchy(dpy, &change, 1), Success) << "Couldn't attach device2 to the new master pointer."; - } - - virtual void SetUpConfigAndLog() { - config.AddDefaultScreenWithDriver(); - config.AddInputSection("evdev", "--device1--", - "Option \"CorePointer\" \"on\"" - "Option \"AccelerationProfile\" \"-1\"" - "Option \"Device\" \"" + dev1->GetDeviceNode() + "\""); - - config.AddInputSection("evdev", "--device2--", - "Option \"CorePointer\" \"on\"" - "Option \"AccelerationProfile\" \"-1\"" - "Option \"Device\" \"" + dev2->GetDeviceNode() + "\""); - - config.AddInputSection("kbd", "kbd-device", - "Option \"CoreKeyboard\" \"on\"\n"); - config.WriteConfig(); - } -}; - static Bool QueryPointerPosition(Display *dpy, int device_id, double *root_x, double *root_y) |