summaryrefslogtreecommitdiffstats
path: root/tests/auto/client/shared/coreprotocol.h
Commit message (Collapse)AuthorAgeFilesLines
* Correct license for test filesLucie Gérard2024-04-041-1/+1
| | | | | | | | | | | According to QUIP-18 [1], all test files should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Task-number: QTBUG-121787 Change-Id: I35b93ca5f2fd27685eda4aafda48c24925c0c56f Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Include what you need: <QPointer>Marc Mutz2023-10-131-0/+2
| | | | | | | | | | | | | | | | | | | | | | | All these TUs relied on transitive includes of qpointer.h, maybe to a large extent via qevent.h, though, given that qevent.h is more or less the only public QtBase header that includes qpointer.h, something else seems to be at play here. Said qevent.h actually needs QPointer in-name-only, so a forward declaration would suffice. Prepare for qevent.h dropping the include. The algorithm I used was: If the TU mentions 'passiveGrabbers', the name of the QEvent function that returns QPointers, and the TU doesn't have qpointer.h included explicitly, include it. That may produce False Positives, but better safe than sorry. Otherwise, in src/, add an include to all source and header files which mention QPointer. Exception: if foo.h of a foo.cpp already includes it, don't include again. Task-number: QTBUG-117670 Change-Id: I8eb00fbd2df16300b0cbfc4157612a45c72ac12c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* client: Implement QWheelEvent::invertedDavid Edmundson2023-09-291-1/+2
| | | | | | | | | | | | | | | "Natural scrolling" is a setting that makes trackpads act in the inverse; moving up moves content down to mimic behavior of touchscreens. However not all scroll events are used for scrolling, so it can be useful to know the real direction. This was exposed in QWheelEvent it just needs plumbing. Change-Id: I050b8b3e55796beff33badb7c073c0b93589294e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
* tests: Cleanup cursor role objectsDavid Edmundson2023-05-231-1/+2
| | | | | | | They should have the same lifetime as the underlying surface Change-Id: I35ad0377a506a4e18e7d4f37691189f636ae54bf Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* client: Force a roundtrip when an XdgOutput is not ready yetMarco Martin2023-02-271-0/+3
| | | | | | | | | | | | Is possible that the server sends a surface_enter before all the information of the XdgOutput have been processed by the client. in this case the associated QScreen doesn't exist yet, causing a QWindow::SetScreen(nullptr), which will fall back to QGuiApplication::primaryScreen(), having the QWindow being assigned the wrong screen Change-Id: I923d5d3a35484deafa6f0572f79c16c27b1f87f0 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Client: Add support for high-resolution scrollingVlad Zahorodnii2022-10-261-1/+2
| | | | | | | | | | | | | | | With wl_pointer version 8, the axis_discrete event is replaced with the axis_value120 event. The main difference between axis_discrete and axis_value120 is that the latter carries scroll deltas that can be fractions of 120, e.g. 30, etc. See also https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/72 Change-Id: I4f724ead7ba146dde6d8975fa4edfcfca761769d Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-101-1/+1
| | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: Ia64c6615ee81f7ad5d0658449b0ee347c3db8c29 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Client: clear focus on touch cancelDavid Edmundson2022-09-051-0/+1
| | | | | | | | | | | | | | When we get a touch_cancel event all touches should be treated as lifted. The next frame call focus is set, with no pending touch points but without having gone through touch_up. We call mPendingTouchPoints.last() without guards even though it is potentially now empty. Change-Id: I3719f9507c5d397d8641692271d878076b7c23b8 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-101-27/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I106d3a5d1a7b96250380b6f51a48f3b19d10e4d9 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Client: Upgrade Seat support to v7David Edmundson2021-12-021-1/+1
| | | | | | | | | | | | | | | | | | | - 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>
* tests: port tst_client to use shared folderLiang Qi2021-10-061-7/+47
| | | | | | | | | instead of shared_old Task-number: QTBUG-96440 Change-Id: I1f9e04841b432937e47ed337b05fe96b2e0662fc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Address WlCompositor::compositor_create_region in testsAleix Pol2020-10-201-3/+2
| | | | | | | | It was not properly marked as override and would not get called. Pick-to: 5.15 Change-Id: Ib80c916c65534ddff918ac06bbe52d88e19d9ff4 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Implement CoreProtocol::compositor_create_regionAleix Pol2020-10-151-0/+21
| | | | | | | | Otherwise tests using it crash. Pick-to: 5.15 Change-Id: Id2ce98ed7c975144728be7566e20b6ea08fa9150 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Use wl_surface.damage_buffer on the client sidePaul Olav Tvete2020-07-071-1/+1
| | | | | | | | | Prefer the newer, recommended damage_buffer when the compositor supports it. Fixes: QTBUG-74929 Change-Id: I9107966910b616a666931404a7b41bfac14c22c0 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Use QList instead of QVectorJarek Kobus2020-06-081-13/+13
| | | | | | Task-number: QTBUG-84469 Change-Id: I4bc7b2eb2913fc828f09f96e21480b76cabf8656 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Client tests for xdg-output unstable v1 version 3Johan Klokkhammer Helsing2020-02-271-0/+1
| | | | | | Change-Id: If6d7547c14dfaf06532a83ab2fbda4d0198837dc Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Liang Qi2019-11-051-1/+24
|\ | | | | | | | | | | | | | | Conflicts: src/client/qwaylanddisplay.cpp src/client/qwaylandwindow.cpp Change-Id: I30ddf5305b3087b93cf4d6e562fd0146dea61cc0
| * Add basic client test for subsurfacesJohan Klokkhammer Helsing2019-11-041-1/+24
| | | | | | | | | | Change-Id: I1ef21287933a2afccad989f47e4fe59329b6f537 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Add client test for multi touch motionJohan Klokkhammer Helsing2019-09-171-0/+1
| | | | | | | | | | | | | | | | | | Make sure touchPoint order doesn't change even though the compositor event order does. Task-number: QTBUG-77014 Change-Id: If6b8a930344836ca52cc12fe7f29c8ac863d81ba Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Client tests: Add test for a simple wl_touch tapJohan Klokkhammer Helsing2019-08-271-0/+4
| | | | | | | | | | Change-Id: I35aec950da0ac0d10cf1fa0c4bc1f56ba232cf89 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Client tests: Add touch infrastructure and simple testJohan Klokkhammer Helsing2019-08-271-2/+14
| | | | | | | | | | | | | | | | | | | | This doesn't test much, but adds the infrastructure needed for more thorough tests later on. More or less exactly matches the mocking for wl_keyboard and wl_pointer. Change-Id: I563bb9be7ccaaf0aa83611e84d051cc307455ccb Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Client tests: Upgrade tests to wl_seat v5Johan Klokkhammer Helsing2019-08-261-1/+1
| | | | | | | | | | | | | | | | | | This means that pointer events need to be followed by frame events. wl_seat version 4 is tested by the "tst_seatv4" autotest. Change-Id: Ifa8e6d6edc998853be7cd901003e619029fc6f68 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Client: Implement primary-selection-unstable-v1Johan Klokkhammer Helsing2019-05-101-1/+2
| | | | | | | | | | | | | | | | | | [ChangeLog][QPA plugin] Added support for middle mouse pasting through the primary-selection-unstable-v1 protocol. Fixes: QTBUG-66008 Change-Id: I7c8fb9aa2c856f5b6794aeab1ee75d80cad05dcd Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Merge remote-tracking branch 'qt/5.13' into devPaul Olav Tvete2019-03-211-4/+2
|\| | | | | | | Change-Id: I3dc204fcaa71c01a80b0c622443012eb07964431
| * Client: Add test for wl_data_offer leaksJohan Klokkhammer Helsing2019-02-201-3/+0
| | | | | | | | | | | | | | | | | | | | | | Also refactors the mocking code for data device manager and implements its isClean method to verify there are no leaks after each test. MockCompositor::DataDevice now persists across get_data_device requests. Task-number: QTBUG-73825 Change-Id: Ib5866e0c54d021e12557f9a96f27950010f2611b Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
| * Client: Refactor cursors and fix various bugsJohan Klokkhammer Helsing2019-02-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is mostly a cleanup to prepare for implementations of xcursor-configuration, but also fixes a couple of issues. Most of the logic has now been moved out of QWaylandDisplay and QWaylandCursor and into QWaylandInputDevice and QWaylandInputDevice::Pointer. QWaylandDisplay now only contains mechanisms for avoiding loading the same theme multiple times. There is now only one setCursor method on QWaylandInputDevice, accepting a QCursor and storing its values so changing scale factor doesn't require calling setCursor again. QWaylandInputDevice::Pointer::updateCursor() is called instead. Cursor buffer scale is now set according to enter/leave events of the cursor surface itself instead of the current window, this fixes incorrect buffer scales for cursors on windows that span multiple outputs. The window buffer scale can still be passed into the seat as a fallback until the first enter event is received. This also fixes a bug where the QWaylandBuffer of a bitmap cursor could be deleted while it was being used as a cursor. [ChangeLog][QPA plugin] Fixed a bug where the DPI of bitmap cursors were not sent to the compositor, leading to the compositor incorrectly scaling the cursor up or down. [ChangeLog][QPA plugin] Fixed a bug where bitmap cursor hotspots were off when the screen scale factor was different from the bitmap cursor device pixel ratio. Task-number: QTBUG-68571 Change-Id: I747a47ffff01b7b5f6a0ede3552ab37884c4fa60 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Client: Implement wl_pointer version 5Robin Burchell2019-03-141-0/+4
|/ | | | | | | | | | | | | | | | | | | Version 5 adds frame events, which groups multiple pointer events together, enabling diagonal scrolling, leave and enter without an intermediate state, and together with the new axis_source, axis_discrete and axis_stop also adds what needed to differentiate between wheel events and touchpad scrolling. This patch adds scroll phases and pixel deltas to QWaylandInputDevice, and makes sure handleWheelEvent is called accordingly. [ChangeLog][QPA plugin] Pixel delta is now set for mouse scrolling events if originating from an appropriate device such as a touch pad (requires compositor support for wl_seat version 5 or later). Fixes: QTBUG-69876 Fixes: QTBUG-63720 Change-Id: I094a1ef0365893bee135cae7e6df89fafdafa2f2 Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
* Client xdg-shell: Add test for tooltips on popupsv5.13.0-alpha1Johan Klokkhammer Helsing2019-02-061-0/+3
| | | | | | | | This used to cause protocol errors. Task-number: QTBUG-71734 Change-Id: Ic937210fc42c93f1d411fb0fb4f269de01f07b5b Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Add client test for data deviceJohan Klokkhammer Helsing2019-01-301-0/+4
| | | | | Change-Id: Id89ec40a3f484808385401829a09a43781a1bed7 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Client tests: Add simple test for keyboard pressJohan Klokkhammer Helsing2019-01-301-1/+17
| | | | | Change-Id: Ib28be5277af9145834c7808f993c747e21845616 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Client: Add wl_output testsJohan Klokkhammer Helsing2019-01-171-5/+44
| | | | | | | | | Also removes overlapping old tests and adds a (currently failing) test for QTBUG-72828. Task-number: QTBUG-72828 Change-Id: Id93d5872ed1c4f181935c1e493e9d8d0ae9cfaf3 Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
* Create a new type of mock compositor for client testsJohan Klokkhammer Helsing2018-12-111-0/+313
There are a number of issues with the current client testing: - Adding new compositor functionality is cumbersome (need to add compositor send method, command, implementation, not to mention creating new wrapper objects. - Customizing available globals and their versions is not possible and would be hard to implement. I.e. how to test that functionality works with old and new versions of an interface? Handle globals being destroyed. We did this with wl_output, but it was painfully cumbersome. - Hard to verify that the compositor state is clean between tests. It is currently done in some tests, but requires boiler plate code which needs to be added and maintained for each test. - In general lots of boiler-plate for new tests. (We have to have separate tests as long as Qt has global/static state. I.e. if one shell extension has been initialized, we can't deinitialize and initialize another one, so tests have to be separate.) - Dispatching server events tied to the client event loop sometimes makes it hard to write tests without deadlocks. - Abstraction, encapsulation and automatic behavior that can't be disabled makes it hard to test low-level functionality like surface exposure. So, in an attempt to mitigate these issues, I wrote a new testing framework. - Compositor dispatch is running continuously in it's own thread, access to compositor state is guarded by a mutex on the compositor, locking this will make dispatching stop, so the test can safely access internals. Although a bit cumbersome at first this makes it much easier to directly use server protocol commands from the test itself, i.e. no need to create commands for every single thing we want to test. - The CoreCompositor::exec template method can accept a lambda that will be run with dispatching stopped. It can also return a value, conveniently letting us safely extract or modify compositor state from tests. - This framework also takes full advantage of the qtwaylandscanner, using wrapper classes for everything, reducing boiler plate considerably. - The compositor parts are designed to do as little as possible automatically, but still provide easy ways to enable common functionality, like releasing buffers automatically, configuring shell surfaces etc. - Compositor globals are pluggable, use add<GlobalClass>() and remove<GlobalClass>() to add new global interfaces. I.e. easy to create a compositor with or without data_device_manager for instance. - DefaultCompositor provides a sensible default set of functionality and convenience methods for most test-cases. Custom ones can still be made by inheriting from CoreCompositor directly instead or by removing or adding globals to DefaultCompositor. - Globals have an isClean() method. Implement it to verify that the client didn't leave any objects lying around from the previous test. CoreCompositor::isClean calls isClean on the globals so a single call is all that's needed. In short, we've traded mock compositor encapsulation and thread safety guarantees for less boiler-plate, easier and more convenient access to internals. Anything accessing compositor state should go into a exec() call, or through the wrapper macros QCOMPOSITOR_VERIFY and QCOMPOSITOR_COMPARE (or the TRY versions). I've also tried to make the compositor print warnings if compositor state is accessed in an unsafe way. The mock compositor is currently built once per test due to CI limitations (same thing as with the old tests). Change-Id: Ia3feb80ce175d3814292b7f4768a0cc719f8b0e8 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>