diff options
author | David Edmundson <davidedmundson@kde.org> | 2021-09-11 16:02:43 +0100 |
---|---|---|
committer | David Edmundson <davidedmundson@kde.org> | 2021-12-02 23:35:04 +0000 |
commit | 941ba938f5c2524c2f23a968009cc32bd5648f3d (patch) | |
tree | 6ac5f7c7915895fd163dea573f20a0f24239b502 /tests/auto/client | |
parent | 297fa0d8507b7dc365f9c805d1ab0b0a4e1dd462 (diff) | |
download | qtwayland-941ba938f5c2524c2f23a968009cc32bd5648f3d.tar.gz |
Client: Upgrade Seat support to v7
- Finish implementing support for axis_wheel_tilt. Some code existed
already, hence only debug and unit test are changed
- The unit test is renamed to seat as the only change is new events.
There is nothing deprecated and therefore no need to test backwards
compatibility.
- Set our supported version number to 7
No version bumps of libwayland are needed, our current minimum version
includes wl_seat v7.
Task-number: QTBUG-96258
Change-Id: Ief18bc5cef3fcbd0699dd52ccad513d47c6c010b
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/client')
-rw-r--r-- | tests/auto/client/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/auto/client/datadevicev1/tst_datadevicev1.cpp | 3 | ||||
-rw-r--r-- | tests/auto/client/primaryselectionv1/tst_primaryselectionv1.cpp | 3 | ||||
-rw-r--r-- | tests/auto/client/seat/CMakeLists.txt (renamed from tests/auto/client/seatv5/CMakeLists.txt) | 4 | ||||
-rw-r--r-- | tests/auto/client/seat/tst_seat.cpp (renamed from tests/auto/client/seatv5/tst_seatv5.cpp) | 63 | ||||
-rw-r--r-- | tests/auto/client/shared/coreprotocol.h | 2 |
6 files changed, 41 insertions, 36 deletions
diff --git a/tests/auto/client/CMakeLists.txt b/tests/auto/client/CMakeLists.txt index 167cc607..accac45f 100644 --- a/tests/auto/client/CMakeLists.txt +++ b/tests/auto/client/CMakeLists.txt @@ -11,7 +11,7 @@ add_subdirectory(nooutput) add_subdirectory(output) add_subdirectory(primaryselectionv1) add_subdirectory(seatv4) -add_subdirectory(seatv5) +add_subdirectory(seat) add_subdirectory(surface) add_subdirectory(tabletv2) add_subdirectory(wl_connect) diff --git a/tests/auto/client/datadevicev1/tst_datadevicev1.cpp b/tests/auto/client/datadevicev1/tst_datadevicev1.cpp index 91a479e2..4dbeb7db 100644 --- a/tests/auto/client/datadevicev1/tst_datadevicev1.cpp +++ b/tests/auto/client/datadevicev1/tst_datadevicev1.cpp @@ -66,9 +66,6 @@ private slots: void tst_datadevicev1::initTestCase() { QCOMPOSITOR_TRY_VERIFY(pointer()); - QCOMPOSITOR_TRY_VERIFY(!pointer()->resourceMap().empty()); - QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 5); - QCOMPOSITOR_TRY_VERIFY(keyboard()); QCOMPOSITOR_TRY_VERIFY(dataDevice()); diff --git a/tests/auto/client/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/client/primaryselectionv1/tst_primaryselectionv1.cpp index f7a63d13..0f0c1610 100644 --- a/tests/auto/client/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/client/primaryselectionv1/tst_primaryselectionv1.cpp @@ -268,9 +268,6 @@ private slots: void tst_primaryselectionv1::initTestCase() { QCOMPOSITOR_TRY_VERIFY(pointer()); - QCOMPOSITOR_TRY_VERIFY(!pointer()->resourceMap().empty()); - QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 5); - QCOMPOSITOR_TRY_VERIFY(keyboard()); } diff --git a/tests/auto/client/seatv5/CMakeLists.txt b/tests/auto/client/seat/CMakeLists.txt index f48d8613..fe59acee 100644 --- a/tests/auto/client/seatv5/CMakeLists.txt +++ b/tests/auto/client/seat/CMakeLists.txt @@ -4,9 +4,9 @@ ## tst_seatv5 Test: ##################################################################### -qt_internal_add_test(tst_seatv5 +qt_internal_add_test(tst_seat SOURCES - tst_seatv5.cpp + tst_seat.cpp PUBLIC_LIBRARIES SharedClientTest ) diff --git a/tests/auto/client/seatv5/tst_seatv5.cpp b/tests/auto/client/seat/tst_seat.cpp index 7e59dbdd..b8405eb6 100644 --- a/tests/auto/client/seatv5/tst_seatv5.cpp +++ b/tests/auto/client/seat/tst_seat.cpp @@ -33,9 +33,9 @@ using namespace MockCompositor; -class SeatV5Compositor : public DefaultCompositor { +class SeatCompositor : public DefaultCompositor { public: - explicit SeatV5Compositor() + explicit SeatCompositor() { exec([this] { m_config.autoConfigure = true; @@ -43,13 +43,13 @@ public: removeAll<Seat>(); uint capabilities = MockCompositor::Seat::capability_pointer | MockCompositor::Seat::capability_touch; - int version = 5; + int version = 7; add<Seat>(capabilities, version); }); } }; -class tst_seatv5 : public QObject, private SeatV5Compositor +class tst_seat : public QObject, private SeatCompositor { Q_OBJECT private slots: @@ -65,6 +65,7 @@ private slots: void fingerScroll(); void fingerScrollSlow(); void continuousScroll(); + void wheelDiscreteScroll_data(); void wheelDiscreteScroll(); // Touch tests @@ -76,19 +77,19 @@ private slots: void tapAndMoveInSameFrame(); }; -void tst_seatv5::bindsToSeat() +void tst_seat::bindsToSeat() { QCOMPOSITOR_COMPARE(get<Seat>()->resourceMap().size(), 1); - QCOMPOSITOR_COMPARE(get<Seat>()->resourceMap().first()->version(), 5); + QCOMPOSITOR_COMPARE(get<Seat>()->resourceMap().first()->version(), 7); } -void tst_seatv5::createsPointer() +void tst_seat::createsPointer() { QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().size(), 1); - QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 5); + QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 7); } -void tst_seatv5::setsCursorOnEnter() +void tst_seat::setsCursorOnEnter() { QRasterWindow window; window.resize(64, 64); @@ -104,7 +105,7 @@ void tst_seatv5::setsCursorOnEnter() QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); } -void tst_seatv5::usesEnterSerial() +void tst_seat::usesEnterSerial() { QSignalSpy setCursorSpy(exec([=] { return pointer(); }), &Pointer::setCursor); QRasterWindow window; @@ -166,7 +167,7 @@ public: QList<Event> m_events; }; -void tst_seatv5::simpleAxis_data() +void tst_seat::simpleAxis_data() { QTest::addColumn<uint>("axis"); QTest::addColumn<qreal>("value"); @@ -180,7 +181,7 @@ void tst_seatv5::simpleAxis_data() QTest::newRow("up big") << uint(Pointer::axis_vertical_scroll) << -10.0 << QPoint{0, 120}; } -void tst_seatv5::simpleAxis() +void tst_seat::simpleAxis() { QFETCH(uint, axis); QFETCH(qreal, value); @@ -216,7 +217,7 @@ void tst_seatv5::simpleAxis() // Sending axis_stop is not mandatory when axis source != finger } -void tst_seatv5::fingerScroll() +void tst_seat::fingerScroll() { WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -313,7 +314,7 @@ void tst_seatv5::fingerScroll() } -void tst_seatv5::fingerScrollSlow() +void tst_seat::fingerScrollSlow() { WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -342,17 +343,27 @@ void tst_seatv5::fingerScrollSlow() } QCOMPARE(accumulated.y(), -1); } -void tst_seatv5::wheelDiscreteScroll() + +void tst_seat::wheelDiscreteScroll_data() +{ + QTest::addColumn<uint>("source"); + QTest::newRow("wheel") << uint(Pointer::axis_source_wheel); + QTest::newRow("wheel tilt") << uint(Pointer::axis_source_wheel_tilt); +} + +void tst_seat::wheelDiscreteScroll() { WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + QFETCH(uint, source); + exec([=] { auto *p = pointer(); auto *c = client(); p->sendEnter(xdgToplevel()->surface(), {32, 32}); p->sendFrame(c); - p->sendAxisSource(c, Pointer::axis_source_wheel); + p->sendAxisSource(c, Pointer::axis_source(source)); p->sendAxisDiscrete(c, Pointer::axis_vertical_scroll, 1); // 1 click downwards p->sendAxis(c, Pointer::axis_vertical_scroll, 1.0); p->sendFrame(c); @@ -372,7 +383,7 @@ void tst_seatv5::wheelDiscreteScroll() } } -void tst_seatv5::continuousScroll() +void tst_seat::continuousScroll() { WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -398,10 +409,10 @@ void tst_seatv5::continuousScroll() // Sending axis_stop is not mandatory when axis source != finger } -void tst_seatv5::createsTouch() +void tst_seat::createsTouch() { QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().size(), 1); - QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().first()->version(), 5); + QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().first()->version(), 7); } class TouchWindow : public QRasterWindow { @@ -432,7 +443,7 @@ public: QList<Event> m_events; }; -void tst_seatv5::singleTap() +void tst_seat::singleTap() { TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -463,7 +474,7 @@ void tst_seatv5::singleTap() } } -void tst_seatv5::singleTapFloat() +void tst_seat::singleTapFloat() { TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -494,7 +505,7 @@ void tst_seatv5::singleTapFloat() } } -void tst_seatv5::multiTouch() +void tst_seat::multiTouch() { TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -566,7 +577,7 @@ void tst_seatv5::multiTouch() } } -void tst_seatv5::multiTouchUpAndMotionFrame() +void tst_seat::multiTouchUpAndMotionFrame() { TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -615,7 +626,7 @@ void tst_seatv5::multiTouchUpAndMotionFrame() QVERIFY(window.m_events.empty()); } -void tst_seatv5::tapAndMoveInSameFrame() +void tst_seat::tapAndMoveInSameFrame() { TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -647,5 +658,5 @@ void tst_seatv5::tapAndMoveInSameFrame() QTRY_COMPARE(window.m_events.last().touchPoints.first().state(), QEventPoint::State::Released); } -QCOMPOSITOR_TEST_MAIN(tst_seatv5) -#include "tst_seatv5.moc" +QCOMPOSITOR_TEST_MAIN(tst_seat) +#include "tst_seat.moc" diff --git a/tests/auto/client/shared/coreprotocol.h b/tests/auto/client/shared/coreprotocol.h index e575444c..94481b41 100644 --- a/tests/auto/client/shared/coreprotocol.h +++ b/tests/auto/client/shared/coreprotocol.h @@ -321,7 +321,7 @@ class Seat : public Global, public QtWaylandServer::wl_seat { Q_OBJECT public: - explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch, int version = 5); + explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch, int version = 7); ~Seat() override; void send_capabilities(Resource *resource, uint capabilities) = delete; // Use wrapper instead void send_capabilities(uint capabilities) = delete; // Use wrapper instead |