diff options
author | Mikko Levonmaa <mikko.levonmaa@lge.com> | 2014-03-31 11:25:33 -0700 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-29 19:18:07 +0200 |
commit | 9fbaf51eccf668a938f4c9a466cc4595195920f3 (patch) | |
tree | 3f92bf1b113686bc3ccbe05a01eaadb3fd8c305c /tests | |
parent | addf250d9f9a55738f798309d8867b30db896aa0 (diff) | |
download | qtwayland-9fbaf51eccf668a938f4c9a466cc4595195920f3.tar.gz |
Support configurable capabilities for input devices
Change-Id: I070f7daec8fb13a7db838b3d0c67e8aebc790a6c
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/compositor/compositor.pro | 12 | ||||
-rw-r--r-- | tests/auto/compositor/tst_compositor.cpp | 23 |
2 files changed, 34 insertions, 1 deletions
diff --git a/tests/auto/compositor/compositor.pro b/tests/auto/compositor/compositor.pro index 1da1ba25..d049b17a 100644 --- a/tests/auto/compositor/compositor.pro +++ b/tests/auto/compositor/compositor.pro @@ -2,7 +2,7 @@ CONFIG += testcase link_pkgconfig TARGET = tst_compositor QT += testlib -QT += core-private gui-private compositor +QT += core-private gui-private compositor compositor-private !contains(QT_CONFIG, no-pkg-config) { PKGCONFIG += wayland-client wayland-server @@ -10,5 +10,15 @@ QT += core-private gui-private compositor LIBS += -lwayland-client -lwayland-server } +config_xkbcommon { + !contains(QT_CONFIG, no-pkg-config) { + PKGCONFIG_PRIVATE += xkbcommon + } else { + LIBS_PRIVATE += -lxkbcommon + } +} else { + DEFINES += QT_NO_WAYLAND_XKB +} + SOURCES += tst_compositor.cpp testcompositor.cpp mockclient.cpp HEADERS += testcompositor.h mockclient.h diff --git a/tests/auto/compositor/tst_compositor.cpp b/tests/auto/compositor/tst_compositor.cpp index 99f08a4e..803f280b 100644 --- a/tests/auto/compositor/tst_compositor.cpp +++ b/tests/auto/compositor/tst_compositor.cpp @@ -46,6 +46,8 @@ #include <QtTest/QtTest> +#include <QtCompositor/private/qwlinputdevice_p.h> + class tst_WaylandCompositor : public QObject { Q_OBJECT @@ -56,6 +58,7 @@ public: } private slots: + void inputDeviceCapabilities(); void singleClient(); void multipleClients(); void geometry(); @@ -240,5 +243,25 @@ void tst_WaylandCompositor::frameCallback() wl_surface_destroy(surface); } +void tst_WaylandCompositor::inputDeviceCapabilities() +{ + TestCompositor compositor; + QtWayland::InputDevice dev(NULL, compositor.handle(), QWaylandInputDevice::Pointer); + + QTRY_VERIFY(dev.pointerDevice()); + QTRY_VERIFY(!dev.keyboardDevice()); + QTRY_VERIFY(!dev.touchDevice()); + + dev.setCapabilities(QWaylandInputDevice::Keyboard | QWaylandInputDevice::Touch); + QTRY_VERIFY(!dev.pointerDevice()); + QTRY_VERIFY(dev.keyboardDevice()); + QTRY_VERIFY(dev.touchDevice()); + + // Test that existing devices do not change when another is removed + QtWayland::Keyboard *k = dev.keyboardDevice(); + dev.setCapabilities(QWaylandInputDevice::Keyboard); + QTRY_COMPARE(k, dev.keyboardDevice()); +} + #include <tst_compositor.moc> QTEST_MAIN(tst_WaylandCompositor); |