kwin/src/wayland/KF5WaylandConfig.cmake.in
Martin Gräßlin 682652714d Introduce a test server
Summary:
The idea of shipping a test server is to have something like Xvfb for
Wayland. To be able to run a test application with a fake Wayland server.

To make this super easy the test server binary is installed into libexec
directory and provides a cmake function to run a test application with
the test server.

The test server takes full control over the process. It's a guiless
application and starts the passed test application once it is fully
set up. The environment is setup to have the test application connect
to the fake server (WAYLAND_SOCKET env variable and QT_QPA_PLATFORM).

When the started application finishes the test server goes down and
exits with the exit value of the test application. This allows a good
integration with ctest.

The test server is a virtual server which supports the following
interfaces:
* Shm
* Compositor
* Shell
* Seat
* DataDeviceManager
* Idle
* SubCompositor
* Output (1280x1024 at 60 Hz with 96 dpi)
* FakeInput

This is sufficient to bring up a QtWayland based application and
allows some basic interactions from a test application (e.g. fake
input).

So far the server fakes a repaint every 16 msec, but does not yet
pass events to the test applications.

To integrate this into an application for testing use:
    find_package(KF5Wayland CONFIG)
    add_executable(myTest myTest.cpp)
    target_link_libraries(myTest Qt5::Gui Qt5::Test)
    kwaylandtest(myTest)

When now running ctest in the build directory the test server gets
started and will start the myTest binary and report the passed/failed
in the expected and normal way.

This way a test case can easily be run against both X11 and Wayland.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1726

Changelog: Virtual framebuffer server for auto tests
2016-06-01 16:15:08 +02:00

12 lines
364 B
CMake

@PACKAGE_INIT@
find_dependency(Qt5Gui @REQUIRED_QT_VERSION@)
include("${CMAKE_CURRENT_LIST_DIR}/KF5WaylandTargets.cmake")
function(kwaylandtest testBinaryName)
add_test(NAME ${testBinaryName}-kwayland-test COMMAND
@CMAKE_INSTALL_FULL_LIBEXECDIR@/org-kde-kf5-kwayland-testserver ${CMAKE_CURRENT_BINARY_DIR}/${testBinaryName}
)
endfunction()