diff options
author | Povilas Kanapickas <povilas@radix.lt> | 2020-12-09 22:04:15 +0200 |
---|---|---|
committer | Povilas Kanapickas <povilas@radix.lt> | 2020-12-14 15:35:35 +0200 |
commit | 8205fb0fe7ad87c2a66f41da92ee604ae7af954c (patch) | |
tree | dfd7678f7b44faa7ea1b1838966c48691e792394 | |
parent | b893135353a0ac19c6799ad96fbb25534cddedc6 (diff) |
Reimplement dga tests on top of inputtest device
-rw-r--r-- | tests/server/dga.cpp | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/tests/server/dga.cpp b/tests/server/dga.cpp index c3935b4..cabdaf9 100644 --- a/tests/server/dga.cpp +++ b/tests/server/dga.cpp @@ -30,7 +30,7 @@ #include <tuple> #include "helpers.h" -#include "device-interface.h" +#include "device-inputtest-interface.h" #include "xit-server-input-test.h" #include "xit-event.h" @@ -56,24 +56,31 @@ public: }; class DGAPointerTest : public DGATest, - public DeviceInterface { + public DeviceInputTestInterface { public: virtual void SetUp() { - SetDevice("mice/PIXART-USB-OPTICAL-MOUSE-HWHEEL.desc"); + AddDevice(xorg::testing::inputtest::DeviceType::POINTER); + AddDevice(xorg::testing::inputtest::DeviceType::KEYBOARD); DGATest::SetUp(); } virtual void SetUpConfigAndLog() { config.AddDefaultScreenWithDriver(); - config.AddInputSection("evdev", "--device--", + config.AddInputSection(XORG_INPUTTEST_DRIVER, "--device--", "Option \"CorePointer\" \"on\"\n" - "Option \"GrabDevice\" \"on\"\n" - "Option \"Device\" \"" + dev->GetDeviceNode() + "\""); - /* add default keyboard device to avoid server adding our device again */ - config.AddInputSection("kbd", "kbd-device", - "Option \"CoreKeyboard\" \"on\"\n"); + "Option \"GrabDevice\" \"on\"\n" + + Dev(0).GetOptions()); + /* add default keyboard device */ + config.AddInputSection(XORG_INPUTTEST_DRIVER, "--kbd-device--", + "Option \"CoreKeyboard\" \"on\"\n" + + Dev(1).GetOptions()); config.WriteConfig(); } + + void StartServer() override { + XITServerInputTest::StartServer(); + WaitForDevices(); + } }; TEST_F(DGAPointerTest, StuckPointerButtonDuringGrab) @@ -98,7 +105,7 @@ TEST_F(DGAPointerTest, StuckPointerButtonDuringGrab) XDGAMode *modes = XDGAQueryModes(dpy, DefaultScreen(dpy), &nmodes); ASSERT_GT(nmodes, 0); - dev->PlayOne(EV_KEY, BTN_LEFT, 1, true); + Dev(0).ButtonDown(1); ASSERT_EVENT(XButtonEvent, press, dpy, ButtonPress); @@ -109,7 +116,7 @@ TEST_F(DGAPointerTest, StuckPointerButtonDuringGrab) XAllowEvents(dpy, AsyncPointer, CurrentTime); XFlush(dpy); - dev->PlayOne(EV_KEY, BTN_LEFT, 0, true); + Dev(0).ButtonUp(1); ASSERT_EVENT(XDGAButtonEvent, dga_release, dpy, dga_event_base + ButtonRelease); @@ -127,8 +134,9 @@ TEST_F(DGAPointerTest, StuckPointerButtonDuringGrab) XDGASetMode(dpy, 0, 0); XFlush(dpy); - dev->PlayOne(EV_KEY, BTN_LEFT, 1, true); - dev->PlayOne(EV_KEY, BTN_LEFT, 0, true); + Dev(0).ButtonDown(1); + Dev(0).ButtonUp(1); + ASSERT_EVENT(XButtonEvent, press2, dpy, ButtonPress); ASSERT_EVENT(XButtonEvent, release2, dpy, ButtonRelease); } |