summaryrefslogtreecommitdiffstats
path: root/tests/auto/client
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2020-04-27 08:51:53 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-04-29 13:51:58 +0200
commit6319bc72e2dc63175ca797ee3042955f852e008f (patch)
treec9c1c71c43394a4cd2f0f6a75df8ba6f3a2550f3 /tests/auto/client
parent00c8a79da0c80616f18329cdfc61338a2c1af7df (diff)
parent28e7d940c42c47cf039522709883ae3de9f4fb88 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts: tests/auto/client/xdgoutput/tst_xdgoutput.cpp Regenerated CMake projects. Removed duplicate wayland source in tests/auto/client/xdgoutput/xdgoutput.pro. It's still referenced via the included shared.pri file. Regenerated the CMake project to adapt to that. Otherwise the CMake project fails to configure due to duplicate rules with a error like the one below CMake Error at src/compositor/Qt6WaylandCompositorMacros.cmake:13 (add_custom_command): Attempt to add a custom rule to output tests/auto/client/xdgoutput/wayland-xdg-output-unstable-v1-server-protocol.h.rule Also use a workaround fix for configuring CMake standalone tests due to regression introduced by dd7e40b1086020f6a054957f4972720cd684 in qtbase. Change-Id: Ib364b851a1fa828c153efbf8653c9e4ef5e618cd
Diffstat (limited to 'tests/auto/client')
-rw-r--r--tests/auto/client/client/tst_client.cpp2
-rw-r--r--tests/auto/client/datadevicev1/.prev_CMakeLists.txt2
-rw-r--r--tests/auto/client/datadevicev1/CMakeLists.txt2
-rw-r--r--tests/auto/client/inputcontext/.prev_CMakeLists.txt2
-rw-r--r--tests/auto/client/inputcontext/CMakeLists.txt2
-rw-r--r--tests/auto/client/nooutput/.prev_CMakeLists.txt2
-rw-r--r--tests/auto/client/nooutput/CMakeLists.txt2
-rw-r--r--tests/auto/client/output/.prev_CMakeLists.txt2
-rw-r--r--tests/auto/client/output/CMakeLists.txt2
-rw-r--r--tests/auto/client/primaryselectionv1/.prev_CMakeLists.txt2
-rw-r--r--tests/auto/client/primaryselectionv1/CMakeLists.txt2
-rw-r--r--tests/auto/client/seatv4/.prev_CMakeLists.txt2
-rw-r--r--tests/auto/client/seatv4/CMakeLists.txt2
-rw-r--r--tests/auto/client/seatv5/.prev_CMakeLists.txt2
-rw-r--r--tests/auto/client/seatv5/CMakeLists.txt2
-rw-r--r--tests/auto/client/shared/coreprotocol.cpp8
-rw-r--r--tests/auto/client/shared/coreprotocol.h1
-rw-r--r--tests/auto/client/shared/shared.pri3
-rw-r--r--tests/auto/client/shared/xdgoutputv1.cpp59
-rw-r--r--tests/auto/client/shared/xdgoutputv1.h88
-rw-r--r--tests/auto/client/surface/.prev_CMakeLists.txt2
-rw-r--r--tests/auto/client/surface/CMakeLists.txt2
-rw-r--r--tests/auto/client/tabletv2/.prev_CMakeLists.txt2
-rw-r--r--tests/auto/client/tabletv2/CMakeLists.txt2
-rw-r--r--tests/auto/client/xdgdecorationv1/.prev_CMakeLists.txt2
-rw-r--r--tests/auto/client/xdgdecorationv1/CMakeLists.txt2
-rw-r--r--tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp38
-rw-r--r--tests/auto/client/xdgoutput/.prev_CMakeLists.txt3
-rw-r--r--tests/auto/client/xdgoutput/CMakeLists.txt3
-rw-r--r--tests/auto/client/xdgoutput/tst_xdgoutput.cpp105
-rw-r--r--tests/auto/client/xdgoutput/xdgoutput.pro3
-rw-r--r--tests/auto/client/xdgshell/.prev_CMakeLists.txt2
-rw-r--r--tests/auto/client/xdgshell/CMakeLists.txt2
33 files changed, 291 insertions, 66 deletions
diff --git a/tests/auto/client/client/tst_client.cpp b/tests/auto/client/client/tst_client.cpp
index 499a93a1d..42e23b54c 100644
--- a/tests/auto/client/client/tst_client.cpp
+++ b/tests/auto/client/client/tst_client.cpp
@@ -149,7 +149,7 @@ public:
: compositor(c)
{
QSocketNotifier *notifier = new QSocketNotifier(compositor->waylandFileDescriptor(), QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)), this, SLOT(processWaylandEvents()));
+ connect(notifier, SIGNAL(activated(QSocketDescriptor)), this, SLOT(processWaylandEvents()));
// connect to the event dispatcher to make sure to flush out the outgoing message queue
connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::awake, this, &tst_WaylandClient::processWaylandEvents);
connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, this, &tst_WaylandClient::processWaylandEvents);
diff --git a/tests/auto/client/datadevicev1/.prev_CMakeLists.txt b/tests/auto/client/datadevicev1/.prev_CMakeLists.txt
index 97dedb855..e835f09d9 100644
--- a/tests/auto/client/datadevicev1/.prev_CMakeLists.txt
+++ b/tests/auto/client/datadevicev1/.prev_CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_datadevicev1
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_datadevicev1.cpp
INCLUDE_DIRECTORIES
@@ -26,5 +27,6 @@ qt6_generate_wayland_protocol_server_sources(tst_datadevicev1
FILES
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/datadevicev1/CMakeLists.txt b/tests/auto/client/datadevicev1/CMakeLists.txt
index e635e33ce..06a56ccfd 100644
--- a/tests/auto/client/datadevicev1/CMakeLists.txt
+++ b/tests/auto/client/datadevicev1/CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_datadevicev1
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_datadevicev1.cpp
INCLUDE_DIRECTORIES
@@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_datadevicev1
FILES
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/inputcontext/.prev_CMakeLists.txt b/tests/auto/client/inputcontext/.prev_CMakeLists.txt
index cf2301e77..c32f2e930 100644
--- a/tests/auto/client/inputcontext/.prev_CMakeLists.txt
+++ b/tests/auto/client/inputcontext/.prev_CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_inputcontext
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_inputcontext.cpp
INCLUDE_DIRECTORIES
@@ -26,5 +27,6 @@ qt6_generate_wayland_protocol_server_sources(tst_inputcontext
FILES
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/inputcontext/CMakeLists.txt b/tests/auto/client/inputcontext/CMakeLists.txt
index f061a7ea2..5eb73b11c 100644
--- a/tests/auto/client/inputcontext/CMakeLists.txt
+++ b/tests/auto/client/inputcontext/CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_inputcontext
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_inputcontext.cpp
INCLUDE_DIRECTORIES
@@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_inputcontext
FILES
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/nooutput/.prev_CMakeLists.txt b/tests/auto/client/nooutput/.prev_CMakeLists.txt
index 3f09f584c..61b43b0f6 100644
--- a/tests/auto/client/nooutput/.prev_CMakeLists.txt
+++ b/tests/auto/client/nooutput/.prev_CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_nooutput
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_nooutput.cpp
INCLUDE_DIRECTORIES
@@ -26,5 +27,6 @@ qt6_generate_wayland_protocol_server_sources(tst_nooutput
FILES
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/nooutput/CMakeLists.txt b/tests/auto/client/nooutput/CMakeLists.txt
index e5110c0c9..f7e9dfec1 100644
--- a/tests/auto/client/nooutput/CMakeLists.txt
+++ b/tests/auto/client/nooutput/CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_nooutput
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_nooutput.cpp
INCLUDE_DIRECTORIES
@@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_nooutput
FILES
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/output/.prev_CMakeLists.txt b/tests/auto/client/output/.prev_CMakeLists.txt
index 09ca5d6d4..7e8e882c5 100644
--- a/tests/auto/client/output/.prev_CMakeLists.txt
+++ b/tests/auto/client/output/.prev_CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_output
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_output.cpp
INCLUDE_DIRECTORIES
@@ -26,5 +27,6 @@ qt6_generate_wayland_protocol_server_sources(tst_output
FILES
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/output/CMakeLists.txt b/tests/auto/client/output/CMakeLists.txt
index 5d2dfbf9d..e4267fadb 100644
--- a/tests/auto/client/output/CMakeLists.txt
+++ b/tests/auto/client/output/CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_output
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_output.cpp
INCLUDE_DIRECTORIES
@@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_output
FILES
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/primaryselectionv1/.prev_CMakeLists.txt b/tests/auto/client/primaryselectionv1/.prev_CMakeLists.txt
index f86e81e12..3d23b446a 100644
--- a/tests/auto/client/primaryselectionv1/.prev_CMakeLists.txt
+++ b/tests/auto/client/primaryselectionv1/.prev_CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_primaryselectionv1
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_primaryselectionv1.cpp
INCLUDE_DIRECTORIES
@@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_primaryselectionv1
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/primaryselectionv1/CMakeLists.txt b/tests/auto/client/primaryselectionv1/CMakeLists.txt
index d101c8b3d..a8f9ae131 100644
--- a/tests/auto/client/primaryselectionv1/CMakeLists.txt
+++ b/tests/auto/client/primaryselectionv1/CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_primaryselectionv1
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_primaryselectionv1.cpp
INCLUDE_DIRECTORIES
@@ -28,5 +29,6 @@ qt6_generate_wayland_protocol_server_sources(tst_primaryselectionv1
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/seatv4/.prev_CMakeLists.txt b/tests/auto/client/seatv4/.prev_CMakeLists.txt
index 9e0e4c37e..d37de1da8 100644
--- a/tests/auto/client/seatv4/.prev_CMakeLists.txt
+++ b/tests/auto/client/seatv4/.prev_CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_seatv4
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_seatv4.cpp
INCLUDE_DIRECTORIES
@@ -26,6 +27,7 @@ qt6_generate_wayland_protocol_server_sources(tst_seatv4
FILES
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/seatv4/CMakeLists.txt b/tests/auto/client/seatv4/CMakeLists.txt
index 36b0c8471..5496bd59f 100644
--- a/tests/auto/client/seatv4/CMakeLists.txt
+++ b/tests/auto/client/seatv4/CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_seatv4
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_seatv4.cpp
INCLUDE_DIRECTORIES
@@ -27,6 +28,7 @@ qt6_generate_wayland_protocol_server_sources(tst_seatv4
FILES
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/seatv5/.prev_CMakeLists.txt b/tests/auto/client/seatv5/.prev_CMakeLists.txt
index 11d615fb2..fa9e5a4eb 100644
--- a/tests/auto/client/seatv5/.prev_CMakeLists.txt
+++ b/tests/auto/client/seatv5/.prev_CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_seatv5
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_seatv5.cpp
INCLUDE_DIRECTORIES
@@ -26,5 +27,6 @@ qt6_generate_wayland_protocol_server_sources(tst_seatv5
FILES
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/seatv5/CMakeLists.txt b/tests/auto/client/seatv5/CMakeLists.txt
index fefdcf8db..67bfc6535 100644
--- a/tests/auto/client/seatv5/CMakeLists.txt
+++ b/tests/auto/client/seatv5/CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_seatv5
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_seatv5.cpp
INCLUDE_DIRECTORIES
@@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_seatv5
FILES
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/shared/coreprotocol.cpp b/tests/auto/client/shared/coreprotocol.cpp
index b0be2cb4e..0d9885216 100644
--- a/tests/auto/client/shared/coreprotocol.cpp
+++ b/tests/auto/client/shared/coreprotocol.cpp
@@ -158,6 +158,14 @@ void Output::sendScale(Resource *resource)
wl_output::send_scale(resource->handle, m_data.scale);
}
+void Output::sendDone(wl_client *client)
+{
+ Q_ASSERT(m_version >= WL_OUTPUT_DONE_SINCE_VERSION);
+ auto resources = resourceMap().values(client);
+ for (auto *r : resources)
+ wl_output::send_done(r->handle);
+}
+
void Output::sendDone()
{
Q_ASSERT(m_version >= WL_OUTPUT_DONE_SINCE_VERSION);
diff --git a/tests/auto/client/shared/coreprotocol.h b/tests/auto/client/shared/coreprotocol.h
index a12d22d36..8d5e2d66d 100644
--- a/tests/auto/client/shared/coreprotocol.h
+++ b/tests/auto/client/shared/coreprotocol.h
@@ -245,6 +245,7 @@ public:
void sendScale(int factor);
void sendScale(Resource *resource); // Sends current scale to only one client
+ void sendDone(wl_client *client);
void sendDone();
int scale() const { return m_data.scale; }
diff --git a/tests/auto/client/shared/shared.pri b/tests/auto/client/shared/shared.pri
index b59cdc481..97202e787 100644
--- a/tests/auto/client/shared/shared.pri
+++ b/tests/auto/client/shared/shared.pri
@@ -4,6 +4,7 @@ QMAKE_USE += wayland-server
WAYLANDSERVERSOURCES += \
$$PWD/../../../../src/3rdparty/protocol/wayland.xml \
+ $$PWD/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml \
$$PWD/../../../../src/3rdparty/protocol/xdg-shell.xml \
$$PWD/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
@@ -14,6 +15,7 @@ HEADERS += \
$$PWD/coreprotocol.h \
$$PWD/datadevice.h \
$$PWD/mockcompositor.h \
+ $$PWD/xdgoutputv1.h \
$$PWD/xdgshell.h \
$$PWD/textinput.h
@@ -22,5 +24,6 @@ SOURCES += \
$$PWD/coreprotocol.cpp \
$$PWD/datadevice.cpp \
$$PWD/mockcompositor.cpp \
+ $$PWD/xdgoutputv1.cpp \
$$PWD/xdgshell.cpp \
$$PWD/textinput.cpp
diff --git a/tests/auto/client/shared/xdgoutputv1.cpp b/tests/auto/client/shared/xdgoutputv1.cpp
new file mode 100644
index 000000000..2b491d2ee
--- /dev/null
+++ b/tests/auto/client/shared/xdgoutputv1.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "xdgoutputv1.h"
+
+namespace MockCompositor {
+
+int XdgOutputV1::s_nextId = 1;
+
+void XdgOutputV1::sendLogicalSize(const QSize &size)
+{
+ m_logicalGeometry.setSize(size);
+ for (auto *resource : resourceMap())
+ zxdg_output_v1::send_logical_size(resource->handle, size.width(), size.height());
+}
+
+void XdgOutputV1::addResource(wl_client *client, int id, int version)
+{
+ auto *resource = add(client, id, version)->handle;
+ zxdg_output_v1::send_logical_size(resource, m_logicalGeometry.width(), m_logicalGeometry.height());
+ send_logical_position(resource, m_logicalGeometry.x(), m_logicalGeometry.y());
+ if (version >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION)
+ send_name(resource, m_name);
+ if (version >= ZXDG_OUTPUT_V1_DESCRIPTION_SINCE_VERSION)
+ send_description(resource, m_description);
+
+ if (version < 3) // zxdg_output_v1.done has been deprecated
+ zxdg_output_v1::send_done(resource);
+ else {
+ m_output->sendDone(client);
+ }
+}
+
+} // namespace MockCompositor
diff --git a/tests/auto/client/shared/xdgoutputv1.h b/tests/auto/client/shared/xdgoutputv1.h
new file mode 100644
index 000000000..85b134500
--- /dev/null
+++ b/tests/auto/client/shared/xdgoutputv1.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MOCKCOMPOSITOR_XDGOUTPUTV1_H
+#define MOCKCOMPOSITOR_XDGOUTPUTV1_H
+
+#include "coreprotocol.h"
+
+#include <qwayland-server-xdg-output-unstable-v1.h>
+
+namespace MockCompositor {
+
+class XdgOutputV1 : public QObject, public QtWaylandServer::zxdg_output_v1
+{
+public:
+ explicit XdgOutputV1(Output *output)
+ : m_output(output)
+ , m_logicalGeometry(m_output->m_data.position, QSize(m_output->m_data.mode.resolution / m_output->m_data.scale))
+ , m_name(QString("WL-%1").arg(s_nextId++))
+ {}
+
+ void send_logical_size(int32_t width, int32_t height) = delete;
+ void sendLogicalSize(const QSize &size);
+
+ void send_done() = delete; // zxdg_output_v1.done has been deprecated (in protocol version 3)
+
+ void addResource(wl_client *client, int id, int version);
+ Output *m_output = nullptr;
+ QRect m_logicalGeometry;
+ QString m_name;
+ QString m_description = "This is an Xdg Output description";
+ static int s_nextId;
+};
+
+class XdgOutputManagerV1 : public Global, public QtWaylandServer::zxdg_output_manager_v1
+{
+ Q_OBJECT
+public:
+ explicit XdgOutputManagerV1(CoreCompositor *compositor, int version = 3)
+ : QtWaylandServer::zxdg_output_manager_v1(compositor->m_display, version)
+ , m_version(version)
+ {}
+ int m_version = 1; // TODO: remove on libwayland upgrade
+ QMap<Output *, XdgOutputV1 *> m_xdgOutputs;
+ XdgOutputV1 *getXdgOutput(Output *output)
+ {
+ if (auto *xdgOutput = m_xdgOutputs.value(output))
+ return xdgOutput;
+ return m_xdgOutputs[output] = new XdgOutputV1(output); // TODO: free memory
+ }
+
+protected:
+ void zxdg_output_manager_v1_get_xdg_output(Resource *resource, uint32_t id, wl_resource *outputResource) override
+ {
+ auto *output = fromResource<Output>(outputResource);
+ auto *xdgOutput = getXdgOutput(output);
+ xdgOutput->addResource(resource->client(), id, resource->version());
+ }
+};
+
+} // namespace MockCompositor
+
+#endif // MOCKCOMPOSITOR_XDGOUTPUTV1_H
diff --git a/tests/auto/client/surface/.prev_CMakeLists.txt b/tests/auto/client/surface/.prev_CMakeLists.txt
index 43d6ec34e..a8eb58dac 100644
--- a/tests/auto/client/surface/.prev_CMakeLists.txt
+++ b/tests/auto/client/surface/.prev_CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_surface
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_surface.cpp
INCLUDE_DIRECTORIES
@@ -26,5 +27,6 @@ qt6_generate_wayland_protocol_server_sources(tst_surface
FILES
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/surface/CMakeLists.txt b/tests/auto/client/surface/CMakeLists.txt
index a1545115e..a3962ddaf 100644
--- a/tests/auto/client/surface/CMakeLists.txt
+++ b/tests/auto/client/surface/CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_surface
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_surface.cpp
INCLUDE_DIRECTORIES
@@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_surface
FILES
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/tabletv2/.prev_CMakeLists.txt b/tests/auto/client/tabletv2/.prev_CMakeLists.txt
index e7fc3f60f..5fecee50a 100644
--- a/tests/auto/client/tabletv2/.prev_CMakeLists.txt
+++ b/tests/auto/client/tabletv2/.prev_CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_tabletv2
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_tabletv2.cpp
INCLUDE_DIRECTORIES
@@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_tabletv2
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/tablet-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/tabletv2/CMakeLists.txt b/tests/auto/client/tabletv2/CMakeLists.txt
index f5a12c554..d039e30dd 100644
--- a/tests/auto/client/tabletv2/CMakeLists.txt
+++ b/tests/auto/client/tabletv2/CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_tabletv2
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_tabletv2.cpp
INCLUDE_DIRECTORIES
@@ -28,5 +29,6 @@ qt6_generate_wayland_protocol_server_sources(tst_tabletv2
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/tablet-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/xdgdecorationv1/.prev_CMakeLists.txt b/tests/auto/client/xdgdecorationv1/.prev_CMakeLists.txt
index 9311070a8..228ad83e0 100644
--- a/tests/auto/client/xdgdecorationv1/.prev_CMakeLists.txt
+++ b/tests/auto/client/xdgdecorationv1/.prev_CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_xdgdecorationv1
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_xdgdecorationv1.cpp
INCLUDE_DIRECTORIES
@@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_xdgdecorationv1
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-decoration-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/xdgdecorationv1/CMakeLists.txt b/tests/auto/client/xdgdecorationv1/CMakeLists.txt
index de067a135..fb0fd06ad 100644
--- a/tests/auto/client/xdgdecorationv1/CMakeLists.txt
+++ b/tests/auto/client/xdgdecorationv1/CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_xdgdecorationv1
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_xdgdecorationv1.cpp
INCLUDE_DIRECTORIES
@@ -28,5 +29,6 @@ qt6_generate_wayland_protocol_server_sources(tst_xdgdecorationv1
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-decoration-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp b/tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp
index cf20a1373..98c0e0446 100644
--- a/tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp
+++ b/tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp
@@ -153,6 +153,8 @@ private slots:
void initTestCase();
void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); }
void clientSidePreferredByCompositor();
+ void initialFramelessWindowHint();
+ void delayedFramelessWindowHint();
};
void tst_xdgdecorationv1::initTestCase()
@@ -182,5 +184,41 @@ void tst_xdgdecorationv1::clientSidePreferredByCompositor()
QTRY_VERIFY(!window.frameMargins().isNull());
}
+void tst_xdgdecorationv1::initialFramelessWindowHint()
+{
+ QRasterWindow window;
+ window.setFlag(Qt::FramelessWindowHint, true);
+ window.show();
+ QCOMPOSITOR_TRY_COMPARE(get<XdgDecorationManagerV1>()->resourceMap().size(), 1);
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+ exec([=]{
+ xdgToplevel()->sendCompleteConfigure();
+ });
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial);
+
+ // The client should not have create a decoration object, because that allows the compositor
+ // to override our decision and add server side decorations to our window.
+ QCOMPOSITOR_TRY_VERIFY(!toplevelDecoration());
+}
+
+void tst_xdgdecorationv1::delayedFramelessWindowHint()
+{
+ QRasterWindow window;
+ window.show();
+ QCOMPOSITOR_TRY_COMPARE(get<XdgDecorationManagerV1>()->resourceMap().size(), 1);
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+ exec([=]{
+ xdgToplevel()->sendCompleteConfigure();
+ });
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial);
+ QCOMPOSITOR_TRY_VERIFY(toplevelDecoration());
+
+ window.setFlag(Qt::FramelessWindowHint, true);
+
+ // The client should now destroy the decoration object, so the compositor is no longer
+ // able to force window decorations
+ QCOMPOSITOR_TRY_VERIFY(!toplevelDecoration());
+}
+
QCOMPOSITOR_TEST_MAIN(tst_xdgdecorationv1)
#include "tst_xdgdecorationv1.moc"
diff --git a/tests/auto/client/xdgoutput/.prev_CMakeLists.txt b/tests/auto/client/xdgoutput/.prev_CMakeLists.txt
index 505c7c050..3fc5aa772 100644
--- a/tests/auto/client/xdgoutput/.prev_CMakeLists.txt
+++ b/tests/auto/client/xdgoutput/.prev_CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_xdgoutput
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_xdgoutput.cpp
INCLUDE_DIRECTORIES
@@ -24,8 +25,8 @@ qt_add_test(tst_xdgoutput
qt6_generate_wayland_protocol_server_sources(tst_xdgoutput
FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/xdgoutput/CMakeLists.txt b/tests/auto/client/xdgoutput/CMakeLists.txt
index e0a4b756e..341624e4a 100644
--- a/tests/auto/client/xdgoutput/CMakeLists.txt
+++ b/tests/auto/client/xdgoutput/CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_xdgoutput
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_xdgoutput.cpp
INCLUDE_DIRECTORIES
@@ -25,8 +26,8 @@ qt_add_test(tst_xdgoutput
qt6_generate_wayland_protocol_server_sources(tst_xdgoutput
FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/xdgoutput/tst_xdgoutput.cpp b/tests/auto/client/xdgoutput/tst_xdgoutput.cpp
index 16e29a3c6..0e5b2c878 100644
--- a/tests/auto/client/xdgoutput/tst_xdgoutput.cpp
+++ b/tests/auto/client/xdgoutput/tst_xdgoutput.cpp
@@ -26,77 +26,21 @@
**
****************************************************************************/
+#include "xdgoutputv1.h"
#include "mockcompositor.h"
+
#include <QtOpenGL/QOpenGLWindow>
#include <QtGui/QRasterWindow>
#include <QtGui/QScreen>
-#include <qwayland-server-xdg-output-unstable-v1.h>
-
using namespace MockCompositor;
-// TODO: move to shared folder?
-class XdgOutputV1 : public QObject, public QtWaylandServer::zxdg_output_v1
-{
-public:
- explicit XdgOutputV1(Output *output)
- : m_output(output)
- , m_logicalGeometry(m_output->m_data.position, QSize(m_output->m_data.mode.resolution / m_output->m_data.scale))
- , m_name(QString("WL-%1").arg(s_nextId++))
- {}
-
- void addResource(wl_client *client, int id, int version)
- {
- auto *resource = add(client, id, version)->handle;
- send_logical_size(resource, m_logicalGeometry.width(), m_logicalGeometry.height());
- send_logical_position(resource, m_logicalGeometry.x(), m_logicalGeometry.y());
- if (version >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION)
- send_name(resource, m_name);
- if (version >= ZXDG_OUTPUT_V1_DESCRIPTION_SINCE_VERSION)
- send_description(resource, m_description);
- send_done(resource);
- }
- Output *m_output = nullptr;
- QRect m_logicalGeometry;
- QString m_name;
- QString m_description = "This is an Xdg Output description";
- static int s_nextId;
-};
-
-int XdgOutputV1::s_nextId = 1;
-
-class XdgOutputManagerV1 : public Global, public QtWaylandServer::zxdg_output_manager_v1
-{
- Q_OBJECT
-public:
- explicit XdgOutputManagerV1(CoreCompositor *compositor, int version = 2)
- : QtWaylandServer::zxdg_output_manager_v1(compositor->m_display, version)
- , m_version(version)
- {}
- int m_version = 1; // TODO: remove on libwayland upgrade
- QMap<Output *, XdgOutputV1 *> m_xdgOutputs;
- XdgOutputV1 *getXdgOutput(Output *output)
- {
- if (auto *xdgOutput = m_xdgOutputs.value(output))
- return xdgOutput;
- return m_xdgOutputs[output] = new XdgOutputV1(output); // TODO: free memory
- }
-
-protected:
- void zxdg_output_manager_v1_get_xdg_output(Resource *resource, uint32_t id, wl_resource *outputResource) override
- {
- auto *output = fromResource<Output>(outputResource);
- auto *xdgOutput = getXdgOutput(output);
- xdgOutput->addResource(resource->client(), id, resource->version());
- }
-};
-
class XdgOutputV1Compositor : public DefaultCompositor {
public:
explicit XdgOutputV1Compositor()
{
exec([this] {
- int version = 2; // version 2 of of unstable-v1
+ int version = 3; // version 3 of of unstable-v1
add<XdgOutputManagerV1>(version);
});
}
@@ -110,11 +54,13 @@ private slots:
void cleanup();
void primaryScreen();
void overrideGeometry();
+ void changeGeometry();
};
void tst_xdgoutput::cleanup()
{
QCOMPOSITOR_COMPARE(getAll<Output>().size(), 1); // Only the default output should be left
+ QTRY_COMPARE(QGuiApplication::screens().size(), 1);
QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage()));
}
@@ -124,7 +70,8 @@ void tst_xdgoutput::primaryScreen()
QCOMPOSITOR_TRY_COMPARE(get<XdgOutputManagerV1>()->resourceMap().size(), 1);
exec([=] {
auto *resource = xdgOutput()->resourceMap().value(client());
- QCOMPARE(resource->version(), 2);
+ QCOMPARE(resource->version(), 3);
+ QCOMPARE(xdgOutput()->m_logicalGeometry.size(), QSize(1920, 1080));
});
auto *s = QGuiApplication::primaryScreen();
QTRY_COMPARE(s->size(), QSize(1920, 1080));
@@ -149,5 +96,43 @@ void tst_xdgoutput::overrideGeometry()
exec([=] { remove(output(1)); });
}
+void tst_xdgoutput::changeGeometry()
+{
+ auto *xdgOutput = exec([=] {
+ auto *output = add<Output>();
+ auto *xdgOutput = get<XdgOutputManagerV1>()->getXdgOutput(output);
+ xdgOutput->m_logicalGeometry = QRect(10, 20, 800, 1200);
+ return xdgOutput;
+ });
+
+ QTRY_COMPARE(QGuiApplication::screens().size(), 2);
+ auto *screen = QGuiApplication::screens()[1];
+ QTRY_COMPARE(screen->size(), QSize(800, 1200));
+
+ exec([=] {
+ xdgOutput->sendLogicalSize(QSize(1024, 768));
+ });
+
+ // Now we want to check that the client doesn't apply the size immediately, but waits for the
+ // done event. If we TRY_COMPARE immediately, we risk that the client just hasn't handled the
+ // logical_size request yet, so we add a screen and verify it on the client side just to give
+ // the client a chance to mess up.
+ exec([=] { add<Output>(); });
+ QTRY_COMPARE(QGuiApplication::screens().size(), 3);
+ exec([=] { remove(output(2)); });
+
+ // The logical_size event should have been handled by now, but state should not have been applied yet.
+ QTRY_COMPARE(screen->size(), QSize(800, 1200));
+
+ exec([=] {
+ xdgOutput->m_output->sendDone();
+ });
+
+ // Finally, the size should change
+ QTRY_COMPARE(screen->size(), QSize(1024, 768));
+
+ exec([=] { remove(output(1)); });
+}
+
QCOMPOSITOR_TEST_MAIN(tst_xdgoutput)
#include "tst_xdgoutput.moc"
diff --git a/tests/auto/client/xdgoutput/xdgoutput.pro b/tests/auto/client/xdgoutput/xdgoutput.pro
index 3cfbb6a76..f65327546 100644
--- a/tests/auto/client/xdgoutput/xdgoutput.pro
+++ b/tests/auto/client/xdgoutput/xdgoutput.pro
@@ -1,8 +1,5 @@
include (../shared/shared.pri)
-WAYLANDSERVERSOURCES += \
- $$PWD/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
-
TARGET = tst_xdgoutput
SOURCES += tst_xdgoutput.cpp
diff --git a/tests/auto/client/xdgshell/.prev_CMakeLists.txt b/tests/auto/client/xdgshell/.prev_CMakeLists.txt
index 65f762107..4faa14f3d 100644
--- a/tests/auto/client/xdgshell/.prev_CMakeLists.txt
+++ b/tests/auto/client/xdgshell/.prev_CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_xdgshell
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_xdgshell.cpp
INCLUDE_DIRECTORIES
@@ -26,5 +27,6 @@ qt6_generate_wayland_protocol_server_sources(tst_xdgshell
FILES
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)
diff --git a/tests/auto/client/xdgshell/CMakeLists.txt b/tests/auto/client/xdgshell/CMakeLists.txt
index cab6c8825..a680575ca 100644
--- a/tests/auto/client/xdgshell/CMakeLists.txt
+++ b/tests/auto/client/xdgshell/CMakeLists.txt
@@ -11,6 +11,7 @@ qt_add_test(tst_xdgshell
../shared/datadevice.cpp ../shared/datadevice.h
../shared/mockcompositor.cpp ../shared/mockcompositor.h
../shared/textinput.cpp ../shared/textinput.h
+ ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h
../shared/xdgshell.cpp ../shared/xdgshell.h
tst_xdgshell.cpp
INCLUDE_DIRECTORIES
@@ -27,5 +28,6 @@ qt6_generate_wayland_protocol_server_sources(tst_xdgshell
FILES
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml
)