[autotest/integration] Introduce a Test helper library to have less code duplication
Summary: A new namespace KWin::Test is added which provides a few helper functions. It makes it easy to setup a KWayland client connection with the base set to be able to create a Surface and flags to create additional interfaces. This replaces the KWayland connection dance in init() methods. For cleanup() there is also a dedicated helper function. In addition there are helper functions to: * render a surface * create a surface * create a shell surface * flush the wayland client connection * access to the created interfaces - for compatibility with existing code The idea is to extend this Test library also for other common use cases like creating an X11 connection and X11 windows, etc. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel, kwin Tags: #plasma_on_wayland, #kwin Differential Revision: https://phabricator.kde.org/D2053icc-effect-5.14.5
parent
1f2b47a83b
commit
513878e20d
|
@ -2,7 +2,7 @@ add_definitions(-DKWINBACKENDPATH="${CMAKE_BINARY_DIR}/plugins/platforms/virtual
|
|||
add_definitions(-DKWINQPAPATH="${CMAKE_BINARY_DIR}/plugins/qpa/")
|
||||
add_subdirectory(helper)
|
||||
|
||||
add_library(KWinIntegrationTestFramework STATIC kwin_wayland_test.cpp)
|
||||
add_library(KWinIntegrationTestFramework STATIC kwin_wayland_test.cpp test_helpers.cpp)
|
||||
target_link_libraries(KWinIntegrationTestFramework kwin Qt5::Test)
|
||||
|
||||
function(integrationTest)
|
||||
|
|
|
@ -27,8 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/event_queue.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
@ -46,6 +44,7 @@ class DebugConsoleTest : public QObject
|
|||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void cleanup();
|
||||
void topLevelTest_data();
|
||||
void topLevelTest();
|
||||
void testX11Client();
|
||||
|
@ -73,6 +72,11 @@ void DebugConsoleTest::initTestCase()
|
|||
waylandServer()->initWorkspace();
|
||||
}
|
||||
|
||||
void DebugConsoleTest::cleanup()
|
||||
{
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void DebugConsoleTest::topLevelTest_data()
|
||||
{
|
||||
QTest::addColumn<int>("row");
|
||||
|
@ -308,51 +312,15 @@ void DebugConsoleTest::testWaylandClient()
|
|||
QVERIFY(rowsInsertedSpy.isValid());
|
||||
|
||||
// create our connection
|
||||
using namespace KWayland::Client;
|
||||
// setup connection
|
||||
QScopedPointer<ConnectionThread> connection(new ConnectionThread);
|
||||
QSignalSpy connectedSpy(connection.data(), &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
connection->setSocketName(s_socketName);
|
||||
|
||||
QScopedPointer<QThread> thread(new QThread);
|
||||
connection->moveToThread(thread.data());
|
||||
thread->start();
|
||||
|
||||
connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
QScopedPointer<EventQueue> queue(new EventQueue);
|
||||
QVERIFY(!queue->isValid());
|
||||
queue->setup(connection.data());
|
||||
QVERIFY(queue->isValid());
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(queue.data());
|
||||
QSignalSpy interfacesAnnouncedSpy(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(interfacesAnnouncedSpy.isValid());
|
||||
registry.create(connection.data());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(interfacesAnnouncedSpy.wait());
|
||||
|
||||
QScopedPointer<Compositor> compositor(registry.createCompositor(registry.interface(Registry::Interface::Compositor).name, registry.interface(Registry::Interface::Compositor).version));
|
||||
QVERIFY(compositor->isValid());
|
||||
QScopedPointer<ShmPool> shm(registry.createShmPool(registry.interface(Registry::Interface::Shm).name, registry.interface(Registry::Interface::Shm).version));
|
||||
QVERIFY(shm->isValid());
|
||||
QScopedPointer<Shell> shell(registry.createShell(registry.interface(Registry::Interface::Shell).name, registry.interface(Registry::Interface::Shell).version));
|
||||
QVERIFY(shell->isValid());
|
||||
QVERIFY(Test::setupWaylandConnection(s_socketName));
|
||||
|
||||
// create the Surface and ShellSurface
|
||||
QScopedPointer<Surface> surface(compositor->createSurface());
|
||||
using namespace KWayland::Client;
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(surface->isValid());
|
||||
QScopedPointer<ShellSurface> shellSurface(shell->createSurface(surface.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
QVERIFY(shellSurface->isValid());
|
||||
QImage img(10, 10, QImage::Format_ARGB32);
|
||||
img.fill(Qt::red);
|
||||
surface->attachBuffer(shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 10, 10));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), QSize(10, 10), Qt::red);
|
||||
|
||||
// now we have the window, it should be added to our model
|
||||
QVERIFY(rowsInsertedSpy.wait());
|
||||
|
@ -410,18 +378,11 @@ void DebugConsoleTest::testWaylandClient()
|
|||
surface->attachBuffer(Buffer::Ptr());
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
shellSurface.reset();
|
||||
connection->flush();
|
||||
Test::flushWaylandConnection();
|
||||
qDebug() << rowsRemovedSpy.count();
|
||||
QEXPECT_FAIL("", "Deleting a ShellSurface does not result in the server removing the ShellClient", Continue);
|
||||
QVERIFY(rowsRemovedSpy.wait());
|
||||
// also destroy the connection to ensure the ShellSurface goes away
|
||||
surface.reset();
|
||||
shell.reset();
|
||||
shm.reset();
|
||||
compositor.reset();
|
||||
connection.take()->deleteLater();
|
||||
thread->quit();
|
||||
QVERIFY(thread->wait());
|
||||
|
||||
QVERIFY(rowsRemovedSpy.wait());
|
||||
QCOMPARE(rowsRemovedSpy.count(), 1);
|
||||
|
|
|
@ -33,8 +33,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/event_queue.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/pointer.h>
|
||||
#include <KWayland/Client/server_decoration.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
|
@ -74,14 +72,6 @@ private Q_SLOTS:
|
|||
|
||||
private:
|
||||
AbstractClient *showWindow();
|
||||
KWayland::Client::ConnectionThread *m_connection = nullptr;
|
||||
KWayland::Client::Compositor *m_compositor = nullptr;
|
||||
KWayland::Client::ServerSideDecorationManager *m_deco = nullptr;
|
||||
KWayland::Client::Seat *m_seat = nullptr;
|
||||
KWayland::Client::ShmPool *m_shm = nullptr;
|
||||
KWayland::Client::Shell *m_shell = nullptr;
|
||||
KWayland::Client::EventQueue *m_queue = nullptr;
|
||||
QThread *m_thread = nullptr;
|
||||
};
|
||||
|
||||
#define MOTION(target) \
|
||||
|
@ -105,11 +95,11 @@ AbstractClient *DecorationInputTest::showWindow()
|
|||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
VERIFY(clientAddedSpy.isValid());
|
||||
|
||||
Surface *surface = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface = Test::createSurface(Test::waylandCompositor());
|
||||
VERIFY(surface);
|
||||
ShellSurface *shellSurface = m_shell->createSurface(surface, surface);
|
||||
ShellSurface *shellSurface = Test::createShellSurface(surface, surface);
|
||||
VERIFY(shellSurface);
|
||||
auto deco = m_deco->create(surface, surface);
|
||||
auto deco = Test::waylandServerSideDecoration()->create(surface, surface);
|
||||
QSignalSpy decoSpy(deco, &ServerSideDecoration::modeChanged);
|
||||
VERIFY(decoSpy.isValid());
|
||||
VERIFY(decoSpy.wait());
|
||||
|
@ -117,13 +107,9 @@ AbstractClient *DecorationInputTest::showWindow()
|
|||
VERIFY(decoSpy.wait());
|
||||
COMPARE(deco->mode(), ServerSideDecoration::Mode::Server);
|
||||
// let's render
|
||||
QImage img(QSize(500, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 500, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface, QSize(500, 50), Qt::blue);
|
||||
|
||||
m_connection->flush();
|
||||
Test::flushWaylandConnection();
|
||||
VERIFY(clientAddedSpy.wait());
|
||||
AbstractClient *c = workspace()->activeClient();
|
||||
VERIFY(c);
|
||||
|
@ -166,61 +152,8 @@ void DecorationInputTest::initTestCase()
|
|||
void DecorationInputTest::init()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
// setup connection
|
||||
m_connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
m_connection->setSocketName(s_socketName);
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_connection->moveToThread(m_thread);
|
||||
m_thread->start();
|
||||
|
||||
m_connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
m_queue = new EventQueue(this);
|
||||
QVERIFY(!m_queue->isValid());
|
||||
m_queue->setup(m_connection);
|
||||
QVERIFY(m_queue->isValid());
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(m_queue);
|
||||
QSignalSpy compositorSpy(®istry, &Registry::compositorAnnounced);
|
||||
QSignalSpy shmSpy(®istry, &Registry::shmAnnounced);
|
||||
QSignalSpy shellSpy(®istry, &Registry::shellAnnounced);
|
||||
QSignalSpy seatSpy(®istry, &Registry::seatAnnounced);
|
||||
QSignalSpy decorationSpy(®istry, &Registry::serverSideDecorationManagerAnnounced);
|
||||
QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(allAnnounced.isValid());
|
||||
QVERIFY(shmSpy.isValid());
|
||||
QVERIFY(shellSpy.isValid());
|
||||
QVERIFY(compositorSpy.isValid());
|
||||
QVERIFY(seatSpy.isValid());
|
||||
QVERIFY(decorationSpy.isValid());
|
||||
registry.create(m_connection->display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(allAnnounced.wait());
|
||||
QVERIFY(!compositorSpy.isEmpty());
|
||||
QVERIFY(!shmSpy.isEmpty());
|
||||
QVERIFY(!shellSpy.isEmpty());
|
||||
QVERIFY(!seatSpy.isEmpty());
|
||||
QVERIFY(!decorationSpy.isEmpty());
|
||||
|
||||
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_compositor->isValid());
|
||||
m_shm = registry.createShmPool(shmSpy.first().first().value<quint32>(), shmSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shm->isValid());
|
||||
m_shell = registry.createShell(shellSpy.first().first().value<quint32>(), shellSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shell->isValid());
|
||||
m_seat = registry.createSeat(seatSpy.first().first().value<quint32>(), seatSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_seat->isValid());
|
||||
m_deco = registry.createServerSideDecorationManager(decorationSpy.first().first().value<quint32>(), decorationSpy.first().last().value<quint32>());
|
||||
QVERIFY(m_deco->isValid());
|
||||
QSignalSpy hasPointerSpy(m_seat, &Seat::hasPointerChanged);
|
||||
QVERIFY(hasPointerSpy.isValid());
|
||||
QVERIFY(hasPointerSpy.wait());
|
||||
QVERIFY(Test::setupWaylandConnection(s_socketName, Test::AdditionalWaylandInterface::Seat | Test::AdditionalWaylandInterface::Decoration));
|
||||
QVERIFY(Test::waitForWaylandPointer());
|
||||
|
||||
screens()->setCurrent(0);
|
||||
Cursor::setPos(QPoint(640, 512));
|
||||
|
@ -228,26 +161,7 @@ void DecorationInputTest::init()
|
|||
|
||||
void DecorationInputTest::cleanup()
|
||||
{
|
||||
delete m_compositor;
|
||||
m_compositor = nullptr;
|
||||
delete m_deco;
|
||||
m_deco = nullptr;
|
||||
delete m_seat;
|
||||
m_seat = nullptr;
|
||||
delete m_shm;
|
||||
m_shm = nullptr;
|
||||
delete m_shell;
|
||||
m_shell = nullptr;
|
||||
delete m_queue;
|
||||
m_queue = nullptr;
|
||||
if (m_thread) {
|
||||
m_connection->deleteLater();
|
||||
m_thread->quit();
|
||||
m_thread->wait();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
m_connection = nullptr;
|
||||
}
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void DecorationInputTest::testAxis_data()
|
||||
|
|
|
@ -33,13 +33,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <KDecoration2/Decoration>
|
||||
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
#include <KWayland/Client/event_queue.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
@ -58,12 +56,6 @@ private Q_SLOTS:
|
|||
private:
|
||||
void unlock();
|
||||
AbstractClient *showWindow();
|
||||
KWayland::Client::ConnectionThread *m_connection = nullptr;
|
||||
KWayland::Client::Compositor *m_compositor = nullptr;
|
||||
KWayland::Client::ShmPool *m_shm = nullptr;
|
||||
KWayland::Client::Shell *m_shell = nullptr;
|
||||
KWayland::Client::EventQueue *m_queue = nullptr;
|
||||
QThread *m_thread = nullptr;
|
||||
};
|
||||
|
||||
void DontCrashCancelAnimationFromAnimationEndedTest::initTestCase()
|
||||
|
@ -83,69 +75,12 @@ void DontCrashCancelAnimationFromAnimationEndedTest::initTestCase()
|
|||
|
||||
void DontCrashCancelAnimationFromAnimationEndedTest::init()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
// setup connection
|
||||
m_connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
m_connection->setSocketName(s_socketName);
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_connection->moveToThread(m_thread);
|
||||
m_thread->start();
|
||||
|
||||
m_connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
m_queue = new EventQueue(this);
|
||||
QVERIFY(!m_queue->isValid());
|
||||
m_queue->setup(m_connection);
|
||||
QVERIFY(m_queue->isValid());
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(m_queue);
|
||||
QSignalSpy compositorSpy(®istry, &Registry::compositorAnnounced);
|
||||
QSignalSpy shmSpy(®istry, &Registry::shmAnnounced);
|
||||
QSignalSpy shellSpy(®istry, &Registry::shellAnnounced);
|
||||
QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(allAnnounced.isValid());
|
||||
QVERIFY(shmSpy.isValid());
|
||||
QVERIFY(shellSpy.isValid());
|
||||
QVERIFY(compositorSpy.isValid());
|
||||
registry.create(m_connection->display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(allAnnounced.wait());
|
||||
QVERIFY(!compositorSpy.isEmpty());
|
||||
QVERIFY(!shmSpy.isEmpty());
|
||||
QVERIFY(!shellSpy.isEmpty());
|
||||
|
||||
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_compositor->isValid());
|
||||
m_shm = registry.createShmPool(shmSpy.first().first().value<quint32>(), shmSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shm->isValid());
|
||||
m_shell = registry.createShell(shellSpy.first().first().value<quint32>(), shellSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shell->isValid());
|
||||
QVERIFY(Test::setupWaylandConnection(s_socketName));
|
||||
}
|
||||
|
||||
void DontCrashCancelAnimationFromAnimationEndedTest::cleanup()
|
||||
{
|
||||
delete m_compositor;
|
||||
m_compositor = nullptr;
|
||||
delete m_shm;
|
||||
m_shm = nullptr;
|
||||
delete m_shell;
|
||||
m_shell = nullptr;
|
||||
delete m_queue;
|
||||
m_queue = nullptr;
|
||||
if (m_thread) {
|
||||
m_connection->deleteLater();
|
||||
m_thread->quit();
|
||||
m_thread->wait();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
m_connection = nullptr;
|
||||
}
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void DontCrashCancelAnimationFromAnimationEndedTest::testScript()
|
||||
|
@ -169,18 +104,14 @@ void DontCrashCancelAnimationFromAnimationEndedTest::testScript()
|
|||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
Surface *surface = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface = Test::createSurface(Test::waylandCompositor());
|
||||
QVERIFY(surface);
|
||||
ShellSurface *shellSurface = m_shell->createSurface(surface, surface);
|
||||
ShellSurface *shellSurface = Test::createShellSurface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
// let's render
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface, QSize(100, 50), Qt::blue);
|
||||
|
||||
m_connection->flush();
|
||||
Test::flushWaylandConnection();
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
AbstractClient *c = workspace()->activeClient();
|
||||
QVERIFY(c);
|
||||
|
|
|
@ -28,17 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "shell_client.h"
|
||||
#include <kwineffects.h>
|
||||
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/event_queue.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/pointer.h>
|
||||
#include <KWayland/Client/server_decoration.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/seat.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
#include <KDecoration2/Decoration>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
@ -54,18 +43,7 @@ class DontCrashEmptyDecorationTest : public QObject
|
|||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
void testBug361551();
|
||||
|
||||
private:
|
||||
KWayland::Client::ConnectionThread *m_connection = nullptr;
|
||||
KWayland::Client::Compositor *m_compositor = nullptr;
|
||||
KWayland::Client::ServerSideDecorationManager *m_deco = nullptr;
|
||||
KWayland::Client::Seat *m_seat = nullptr;
|
||||
KWayland::Client::ShmPool *m_shm = nullptr;
|
||||
KWayland::Client::Shell *m_shell = nullptr;
|
||||
KWayland::Client::EventQueue *m_queue = nullptr;
|
||||
QThread *m_thread = nullptr;
|
||||
};
|
||||
|
||||
void DontCrashEmptyDecorationTest::initTestCase()
|
||||
|
@ -94,91 +72,10 @@ void DontCrashEmptyDecorationTest::initTestCase()
|
|||
|
||||
void DontCrashEmptyDecorationTest::init()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
// setup connection
|
||||
m_connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
m_connection->setSocketName(s_socketName);
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_connection->moveToThread(m_thread);
|
||||
m_thread->start();
|
||||
|
||||
m_connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
m_queue = new EventQueue(this);
|
||||
QVERIFY(!m_queue->isValid());
|
||||
m_queue->setup(m_connection);
|
||||
QVERIFY(m_queue->isValid());
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(m_queue);
|
||||
QSignalSpy compositorSpy(®istry, &Registry::compositorAnnounced);
|
||||
QSignalSpy shmSpy(®istry, &Registry::shmAnnounced);
|
||||
QSignalSpy shellSpy(®istry, &Registry::shellAnnounced);
|
||||
QSignalSpy seatSpy(®istry, &Registry::seatAnnounced);
|
||||
QSignalSpy decorationSpy(®istry, &Registry::serverSideDecorationManagerAnnounced);
|
||||
QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(allAnnounced.isValid());
|
||||
QVERIFY(shmSpy.isValid());
|
||||
QVERIFY(shellSpy.isValid());
|
||||
QVERIFY(compositorSpy.isValid());
|
||||
QVERIFY(seatSpy.isValid());
|
||||
QVERIFY(decorationSpy.isValid());
|
||||
registry.create(m_connection->display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(allAnnounced.wait());
|
||||
QVERIFY(!compositorSpy.isEmpty());
|
||||
QVERIFY(!shmSpy.isEmpty());
|
||||
QVERIFY(!shellSpy.isEmpty());
|
||||
QVERIFY(!seatSpy.isEmpty());
|
||||
QVERIFY(!decorationSpy.isEmpty());
|
||||
|
||||
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_compositor->isValid());
|
||||
m_shm = registry.createShmPool(shmSpy.first().first().value<quint32>(), shmSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shm->isValid());
|
||||
m_shell = registry.createShell(shellSpy.first().first().value<quint32>(), shellSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shell->isValid());
|
||||
m_seat = registry.createSeat(seatSpy.first().first().value<quint32>(), seatSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_seat->isValid());
|
||||
m_deco = registry.createServerSideDecorationManager(decorationSpy.first().first().value<quint32>(), decorationSpy.first().last().value<quint32>());
|
||||
QVERIFY(m_deco->isValid());
|
||||
QSignalSpy hasPointerSpy(m_seat, &Seat::hasPointerChanged);
|
||||
QVERIFY(hasPointerSpy.isValid());
|
||||
QVERIFY(hasPointerSpy.wait());
|
||||
|
||||
screens()->setCurrent(0);
|
||||
Cursor::setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void DontCrashEmptyDecorationTest::cleanup()
|
||||
{
|
||||
delete m_compositor;
|
||||
m_compositor = nullptr;
|
||||
delete m_deco;
|
||||
m_deco = nullptr;
|
||||
delete m_seat;
|
||||
m_seat = nullptr;
|
||||
delete m_shm;
|
||||
m_shm = nullptr;
|
||||
delete m_shell;
|
||||
m_shell = nullptr;
|
||||
delete m_queue;
|
||||
m_queue = nullptr;
|
||||
if (m_thread) {
|
||||
m_connection->deleteLater();
|
||||
m_thread->quit();
|
||||
m_thread->wait();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
m_connection = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void DontCrashEmptyDecorationTest::testBug361551()
|
||||
{
|
||||
// this test verifies that resizing an X11 window to an invalid size does not result in crash on unmap
|
||||
|
|
|
@ -29,15 +29,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "shell_client.h"
|
||||
#include <kwineffects.h>
|
||||
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/event_queue.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/pointer.h>
|
||||
#include <KWayland/Client/server_decoration.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/seat.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
#include <KDecoration2/Decoration>
|
||||
|
@ -57,16 +50,6 @@ private Q_SLOTS:
|
|||
void init();
|
||||
void cleanup();
|
||||
void testCreateWindow();
|
||||
|
||||
private:
|
||||
KWayland::Client::ConnectionThread *m_connection = nullptr;
|
||||
KWayland::Client::Compositor *m_compositor = nullptr;
|
||||
KWayland::Client::ServerSideDecorationManager *m_deco = nullptr;
|
||||
KWayland::Client::Seat *m_seat = nullptr;
|
||||
KWayland::Client::ShmPool *m_shm = nullptr;
|
||||
KWayland::Client::Shell *m_shell = nullptr;
|
||||
KWayland::Client::EventQueue *m_queue = nullptr;
|
||||
QThread *m_thread = nullptr;
|
||||
};
|
||||
|
||||
void DontCrashNoBorder::initTestCase()
|
||||
|
@ -100,62 +83,7 @@ void DontCrashNoBorder::initTestCase()
|
|||
|
||||
void DontCrashNoBorder::init()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
// setup connection
|
||||
m_connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
m_connection->setSocketName(s_socketName);
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_connection->moveToThread(m_thread);
|
||||
m_thread->start();
|
||||
|
||||
m_connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
m_queue = new EventQueue(this);
|
||||
QVERIFY(!m_queue->isValid());
|
||||
m_queue->setup(m_connection);
|
||||
QVERIFY(m_queue->isValid());
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(m_queue);
|
||||
QSignalSpy compositorSpy(®istry, &Registry::compositorAnnounced);
|
||||
QSignalSpy shmSpy(®istry, &Registry::shmAnnounced);
|
||||
QSignalSpy shellSpy(®istry, &Registry::shellAnnounced);
|
||||
QSignalSpy seatSpy(®istry, &Registry::seatAnnounced);
|
||||
QSignalSpy decorationSpy(®istry, &Registry::serverSideDecorationManagerAnnounced);
|
||||
QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(allAnnounced.isValid());
|
||||
QVERIFY(shmSpy.isValid());
|
||||
QVERIFY(shellSpy.isValid());
|
||||
QVERIFY(compositorSpy.isValid());
|
||||
QVERIFY(seatSpy.isValid());
|
||||
QVERIFY(decorationSpy.isValid());
|
||||
registry.create(m_connection->display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(allAnnounced.wait());
|
||||
QVERIFY(!compositorSpy.isEmpty());
|
||||
QVERIFY(!shmSpy.isEmpty());
|
||||
QVERIFY(!shellSpy.isEmpty());
|
||||
QVERIFY(!seatSpy.isEmpty());
|
||||
QVERIFY(!decorationSpy.isEmpty());
|
||||
|
||||
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_compositor->isValid());
|
||||
m_shm = registry.createShmPool(shmSpy.first().first().value<quint32>(), shmSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shm->isValid());
|
||||
m_shell = registry.createShell(shellSpy.first().first().value<quint32>(), shellSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shell->isValid());
|
||||
m_seat = registry.createSeat(seatSpy.first().first().value<quint32>(), seatSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_seat->isValid());
|
||||
m_deco = registry.createServerSideDecorationManager(decorationSpy.first().first().value<quint32>(), decorationSpy.first().last().value<quint32>());
|
||||
QVERIFY(m_deco->isValid());
|
||||
QSignalSpy hasPointerSpy(m_seat, &Seat::hasPointerChanged);
|
||||
QVERIFY(hasPointerSpy.isValid());
|
||||
QVERIFY(hasPointerSpy.wait());
|
||||
QVERIFY(Test::setupWaylandConnection(s_socketName, Test::AdditionalWaylandInterface::Decoration));
|
||||
|
||||
screens()->setCurrent(0);
|
||||
Cursor::setPos(QPoint(640, 512));
|
||||
|
@ -163,26 +91,7 @@ void DontCrashNoBorder::init()
|
|||
|
||||
void DontCrashNoBorder::cleanup()
|
||||
{
|
||||
delete m_compositor;
|
||||
m_compositor = nullptr;
|
||||
delete m_deco;
|
||||
m_deco = nullptr;
|
||||
delete m_seat;
|
||||
m_seat = nullptr;
|
||||
delete m_shm;
|
||||
m_shm = nullptr;
|
||||
delete m_shell;
|
||||
m_shell = nullptr;
|
||||
delete m_queue;
|
||||
m_queue = nullptr;
|
||||
if (m_thread) {
|
||||
m_connection->deleteLater();
|
||||
m_thread->quit();
|
||||
m_thread->wait();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
m_connection = nullptr;
|
||||
}
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void DontCrashNoBorder::testCreateWindow()
|
||||
|
@ -192,25 +101,21 @@ void DontCrashNoBorder::testCreateWindow()
|
|||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
Surface *surface = m_compositor->createSurface(m_compositor);
|
||||
QVERIFY(surface);
|
||||
ShellSurface *shellSurface = m_shell->createSurface(surface, surface);
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
QVERIFY(shellSurface);
|
||||
auto deco = m_deco->create(surface, surface);
|
||||
QSignalSpy decoSpy(deco, &ServerSideDecoration::modeChanged);
|
||||
QScopedPointer<ServerSideDecoration> deco(Test::waylandServerSideDecoration()->create(surface.data()));
|
||||
QSignalSpy decoSpy(deco.data(), &ServerSideDecoration::modeChanged);
|
||||
QVERIFY(decoSpy.isValid());
|
||||
QVERIFY(decoSpy.wait());
|
||||
deco->requestMode(ServerSideDecoration::Mode::Server);
|
||||
QVERIFY(decoSpy.wait());
|
||||
QCOMPARE(deco->mode(), ServerSideDecoration::Mode::Server);
|
||||
// let's render
|
||||
QImage img(QSize(500, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 500, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), QSize(500, 50), Qt::blue);
|
||||
|
||||
m_connection->flush();
|
||||
Test::flushWaylandConnection();
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
AbstractClient *c = workspace()->activeClient();
|
||||
QVERIFY(c);
|
||||
|
|
|
@ -57,13 +57,6 @@ private Q_SLOTS:
|
|||
|
||||
private:
|
||||
void render(KWayland::Client::Surface *surface);
|
||||
KWayland::Client::ConnectionThread *m_connection = nullptr;
|
||||
KWayland::Client::Compositor *m_compositor = nullptr;
|
||||
KWayland::Client::Seat *m_seat = nullptr;
|
||||
KWayland::Client::ShmPool *m_shm = nullptr;
|
||||
KWayland::Client::Shell *m_shell = nullptr;
|
||||
KWayland::Client::EventQueue *m_queue = nullptr;
|
||||
QThread *m_thread = nullptr;
|
||||
};
|
||||
|
||||
void InputStackingOrderTest::initTestCase()
|
||||
|
@ -89,56 +82,8 @@ void InputStackingOrderTest::initTestCase()
|
|||
void InputStackingOrderTest::init()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
// setup connection
|
||||
m_connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
m_connection->setSocketName(s_socketName);
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_connection->moveToThread(m_thread);
|
||||
m_thread->start();
|
||||
|
||||
m_connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
m_queue = new EventQueue(this);
|
||||
QVERIFY(!m_queue->isValid());
|
||||
m_queue->setup(m_connection);
|
||||
QVERIFY(m_queue->isValid());
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(m_queue);
|
||||
QSignalSpy compositorSpy(®istry, &Registry::compositorAnnounced);
|
||||
QSignalSpy shmSpy(®istry, &Registry::shmAnnounced);
|
||||
QSignalSpy shellSpy(®istry, &Registry::shellAnnounced);
|
||||
QSignalSpy seatSpy(®istry, &Registry::seatAnnounced);
|
||||
QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(allAnnounced.isValid());
|
||||
QVERIFY(shmSpy.isValid());
|
||||
QVERIFY(shellSpy.isValid());
|
||||
QVERIFY(compositorSpy.isValid());
|
||||
QVERIFY(seatSpy.isValid());
|
||||
registry.create(m_connection->display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(allAnnounced.wait());
|
||||
QVERIFY(!compositorSpy.isEmpty());
|
||||
QVERIFY(!shmSpy.isEmpty());
|
||||
QVERIFY(!shellSpy.isEmpty());
|
||||
QVERIFY(!seatSpy.isEmpty());
|
||||
|
||||
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_compositor->isValid());
|
||||
m_shm = registry.createShmPool(shmSpy.first().first().value<quint32>(), shmSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shm->isValid());
|
||||
m_shell = registry.createShell(shellSpy.first().first().value<quint32>(), shellSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shell->isValid());
|
||||
m_seat = registry.createSeat(seatSpy.first().first().value<quint32>(), seatSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_seat->isValid());
|
||||
QSignalSpy hasPointerSpy(m_seat, &Seat::hasPointerChanged);
|
||||
QVERIFY(hasPointerSpy.isValid());
|
||||
QVERIFY(hasPointerSpy.wait());
|
||||
QVERIFY(Test::setupWaylandConnection(s_socketName, Test::AdditionalWaylandInterface::Seat));
|
||||
QVERIFY(Test::waitForWaylandPointer());
|
||||
|
||||
screens()->setCurrent(0);
|
||||
Cursor::setPos(QPoint(640, 512));
|
||||
|
@ -146,34 +91,13 @@ void InputStackingOrderTest::init()
|
|||
|
||||
void InputStackingOrderTest::cleanup()
|
||||
{
|
||||
delete m_compositor;
|
||||
m_compositor = nullptr;
|
||||
delete m_seat;
|
||||
m_seat = nullptr;
|
||||
delete m_shm;
|
||||
m_shm = nullptr;
|
||||
delete m_shell;
|
||||
m_shell = nullptr;
|
||||
delete m_queue;
|
||||
m_queue = nullptr;
|
||||
if (m_thread) {
|
||||
m_connection->deleteLater();
|
||||
m_thread->quit();
|
||||
m_thread->wait();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
m_connection = nullptr;
|
||||
}
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void InputStackingOrderTest::render(KWayland::Client::Surface *surface)
|
||||
{
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
||||
m_connection->flush();
|
||||
Test::render(surface, QSize(100, 50), Qt::blue);
|
||||
Test::flushWaylandConnection();
|
||||
}
|
||||
|
||||
void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange()
|
||||
|
@ -184,7 +108,7 @@ void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange()
|
|||
// other window should gain focus without a mouse event in between
|
||||
using namespace KWayland::Client;
|
||||
// create pointer and signal spy for enter and leave signals
|
||||
auto pointer = m_seat->createPointer(m_seat);
|
||||
auto pointer = Test::waylandSeat()->createPointer(Test::waylandSeat());
|
||||
QVERIFY(pointer);
|
||||
QVERIFY(pointer->isValid());
|
||||
QSignalSpy enteredSpy(pointer, &Pointer::entered);
|
||||
|
@ -195,18 +119,18 @@ void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange()
|
|||
// now create the two windows and make them overlap
|
||||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
Surface *surface1 = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface1 = Test::createSurface(Test::waylandCompositor());
|
||||
QVERIFY(surface1);
|
||||
ShellSurface *shellSurface1 = m_shell->createSurface(surface1, surface1);
|
||||
ShellSurface *shellSurface1 = Test::createShellSurface(surface1, surface1);
|
||||
QVERIFY(shellSurface1);
|
||||
render(surface1);
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
AbstractClient *window1 = workspace()->activeClient();
|
||||
QVERIFY(window1);
|
||||
|
||||
Surface *surface2 = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface2 = Test::createSurface(Test::waylandCompositor());
|
||||
QVERIFY(surface2);
|
||||
ShellSurface *shellSurface2 = m_shell->createSurface(surface2, surface2);
|
||||
ShellSurface *shellSurface2 = Test::createShellSurface(surface2, surface2);
|
||||
QVERIFY(shellSurface2);
|
||||
render(surface2);
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
|
|
@ -25,6 +25,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
// Qt
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
namespace KWayland
|
||||
{
|
||||
namespace Client
|
||||
{
|
||||
class ConnectionThread;
|
||||
class Compositor;
|
||||
class PlasmaShell;
|
||||
class PlasmaWindowManagement;
|
||||
class Seat;
|
||||
class ServerSideDecorationManager;
|
||||
class Shell;
|
||||
class ShellSurface;
|
||||
class ShmPool;
|
||||
class Surface;
|
||||
}
|
||||
}
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
|
@ -50,8 +67,61 @@ private:
|
|||
QMetaObject::Connection m_xwaylandFailConnection;
|
||||
};
|
||||
|
||||
namespace Test
|
||||
{
|
||||
|
||||
enum class AdditionalWaylandInterface {
|
||||
Seat = 1 << 0,
|
||||
Decoration = 1 << 1,
|
||||
PlasmaShell = 1 << 2,
|
||||
WindowManagement = 1 << 3
|
||||
};
|
||||
Q_DECLARE_FLAGS(AdditionalWaylandInterfaces, AdditionalWaylandInterface)
|
||||
/**
|
||||
* Creates a Wayland Connection in a dedicated thread and creates various
|
||||
* client side objects which can be used to create windows.
|
||||
* @param socketName The name of the Wayland socket to connect to.
|
||||
* @returns @c true if created successfully, @c false if there was an error
|
||||
* @see destroyWaylandConnection
|
||||
**/
|
||||
bool setupWaylandConnection(const QString &socketName, AdditionalWaylandInterfaces flags = AdditionalWaylandInterfaces());
|
||||
|
||||
/**
|
||||
* Destroys the Wayland Connection created with @link{setupWaylandConnection}.
|
||||
* This can be called from cleanup in order to ensure that no Wayland Connection
|
||||
* leaks into the next test method.
|
||||
* @see setupWaylandConnection
|
||||
*/
|
||||
void destroyWaylandConnection();
|
||||
|
||||
KWayland::Client::ConnectionThread *waylandConnection();
|
||||
KWayland::Client::Compositor *waylandCompositor();
|
||||
KWayland::Client::Shell *waylandShell();
|
||||
KWayland::Client::ShmPool *waylandShmPool();
|
||||
KWayland::Client::Seat *waylandSeat();
|
||||
KWayland::Client::ServerSideDecorationManager *waylandServerSideDecoration();
|
||||
KWayland::Client::PlasmaShell *waylandPlasmaShell();
|
||||
KWayland::Client::PlasmaWindowManagement *waylandWindowManagement();
|
||||
|
||||
bool waitForWaylandPointer();
|
||||
bool waitForWaylandTouch();
|
||||
|
||||
void flushWaylandConnection();
|
||||
|
||||
KWayland::Client::Surface *createSurface(QObject *parent = nullptr);
|
||||
KWayland::Client::ShellSurface *createShellSurface(KWayland::Client::Surface *surface, QObject *parent = nullptr);
|
||||
|
||||
/**
|
||||
* Creates a shared memory buffer of @p size in @p color and attaches it to the @p surface.
|
||||
* The @p surface gets damaged and committed, thus it's rendered.
|
||||
**/
|
||||
void render(KWayland::Client::Surface *surface, const QSize &size, const QColor &color, const QImage::Format &format = QImage::Format_ARGB32);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::Test::AdditionalWaylandInterfaces)
|
||||
|
||||
#define WAYLANDTEST_MAIN_HELPER(TestObject, DPI) \
|
||||
int main(int argc, char *argv[]) \
|
||||
{ \
|
||||
|
|
|
@ -30,7 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/event_queue.h>
|
||||
#include <KWayland/Client/keyboard.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/pointer.h>
|
||||
|
@ -83,8 +82,6 @@ private:
|
|||
KWayland::Client::Seat *m_seat = nullptr;
|
||||
KWayland::Client::ShmPool *m_shm = nullptr;
|
||||
KWayland::Client::Shell *m_shell = nullptr;
|
||||
KWayland::Client::EventQueue *m_queue = nullptr;
|
||||
QThread *m_thread = nullptr;
|
||||
};
|
||||
|
||||
class HelperEffect : public Effect
|
||||
|
@ -167,16 +164,12 @@ AbstractClient *LockScreenTest::showWindow()
|
|||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
VERIFY(clientAddedSpy.isValid());
|
||||
|
||||
Surface *surface = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface = Test::createSurface(m_compositor);
|
||||
VERIFY(surface);
|
||||
ShellSurface *shellSurface = m_shell->createSurface(surface, surface);
|
||||
ShellSurface *shellSurface = Test::createShellSurface(surface, surface);
|
||||
VERIFY(shellSurface);
|
||||
// let's render
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface, QSize(100, 50), Qt::blue);
|
||||
|
||||
m_connection->flush();
|
||||
VERIFY(clientAddedSpy.wait());
|
||||
|
@ -212,57 +205,13 @@ void LockScreenTest::initTestCase()
|
|||
|
||||
void LockScreenTest::init()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
// setup connection
|
||||
m_connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
m_connection->setSocketName(s_socketName);
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_connection->moveToThread(m_thread);
|
||||
m_thread->start();
|
||||
|
||||
m_connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
m_queue = new EventQueue(this);
|
||||
QVERIFY(!m_queue->isValid());
|
||||
m_queue->setup(m_connection);
|
||||
QVERIFY(m_queue->isValid());
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(m_queue);
|
||||
QSignalSpy compositorSpy(®istry, &Registry::compositorAnnounced);
|
||||
QSignalSpy shmSpy(®istry, &Registry::shmAnnounced);
|
||||
QSignalSpy shellSpy(®istry, &Registry::shellAnnounced);
|
||||
QSignalSpy seatSpy(®istry, &Registry::seatAnnounced);
|
||||
QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(allAnnounced.isValid());
|
||||
QVERIFY(shmSpy.isValid());
|
||||
QVERIFY(shellSpy.isValid());
|
||||
QVERIFY(compositorSpy.isValid());
|
||||
QVERIFY(seatSpy.isValid());
|
||||
registry.create(m_connection->display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(allAnnounced.wait());
|
||||
QVERIFY(!compositorSpy.isEmpty());
|
||||
QVERIFY(!shmSpy.isEmpty());
|
||||
QVERIFY(!shellSpy.isEmpty());
|
||||
QVERIFY(!seatSpy.isEmpty());
|
||||
|
||||
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_compositor->isValid());
|
||||
m_shm = registry.createShmPool(shmSpy.first().first().value<quint32>(), shmSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shm->isValid());
|
||||
m_shell = registry.createShell(shellSpy.first().first().value<quint32>(), shellSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shell->isValid());
|
||||
m_seat = registry.createSeat(seatSpy.first().first().value<quint32>(), seatSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_seat->isValid());
|
||||
QSignalSpy hasPointerSpy(m_seat, &Seat::hasPointerChanged);
|
||||
QVERIFY(hasPointerSpy.isValid());
|
||||
QVERIFY(hasPointerSpy.wait());
|
||||
QVERIFY(Test::setupWaylandConnection(s_socketName, Test::AdditionalWaylandInterface::Seat));
|
||||
QVERIFY(Test::waitForWaylandPointer());
|
||||
m_connection = Test::waylandConnection();
|
||||
m_compositor = Test::waylandCompositor();
|
||||
m_shell = Test::waylandShell();
|
||||
m_shm = Test::waylandShmPool();
|
||||
m_seat = Test::waylandSeat();
|
||||
|
||||
screens()->setCurrent(0);
|
||||
Cursor::setPos(QPoint(640, 512));
|
||||
|
@ -270,24 +219,7 @@ void LockScreenTest::init()
|
|||
|
||||
void LockScreenTest::cleanup()
|
||||
{
|
||||
delete m_compositor;
|
||||
m_compositor = nullptr;
|
||||
delete m_seat;
|
||||
m_seat = nullptr;
|
||||
delete m_shm;
|
||||
m_shm = nullptr;
|
||||
delete m_shell;
|
||||
m_shell = nullptr;
|
||||
delete m_queue;
|
||||
m_queue = nullptr;
|
||||
if (m_thread) {
|
||||
m_connection->deleteLater();
|
||||
m_thread->quit();
|
||||
m_thread->wait();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
m_connection = nullptr;
|
||||
}
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void LockScreenTest::testPointer()
|
||||
|
|
|
@ -25,10 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/event_queue.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
@ -39,8 +36,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <KDecoration2/Decoration>
|
||||
#include <KDecoration2/DecoratedClient>
|
||||
|
||||
#include <QThread>
|
||||
|
||||
using namespace KWin;
|
||||
using namespace KWayland::Client;
|
||||
|
||||
|
@ -56,15 +51,6 @@ private Q_SLOTS:
|
|||
|
||||
void testMaximizedPassedToDeco();
|
||||
void testInitiallyMaximized();
|
||||
|
||||
private:
|
||||
KWayland::Client::Compositor *m_compositor = nullptr;
|
||||
Shell *m_shell = nullptr;
|
||||
ShmPool *m_shm = nullptr;
|
||||
EventQueue *m_queue = nullptr;
|
||||
ServerSideDecorationManager *m_ssd = nullptr;
|
||||
ConnectionThread *m_connection = nullptr;
|
||||
QThread *m_thread = nullptr;
|
||||
};
|
||||
|
||||
void TestMaximized::initTestCase()
|
||||
|
@ -87,49 +73,7 @@ void TestMaximized::initTestCase()
|
|||
|
||||
void TestMaximized::init()
|
||||
{
|
||||
// setup connection
|
||||
m_connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
m_connection->setSocketName(s_socketName);
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_connection->moveToThread(m_thread);
|
||||
m_thread->start();
|
||||
|
||||
m_connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
m_queue = new EventQueue(this);
|
||||
QVERIFY(!m_queue->isValid());
|
||||
m_queue->setup(m_connection);
|
||||
QVERIFY(m_queue->isValid());
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(m_queue);
|
||||
QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(allAnnounced.isValid());
|
||||
registry.create(m_connection->display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(allAnnounced.wait());
|
||||
|
||||
m_compositor = registry.createCompositor(registry.interface(Registry::Interface::Compositor).name,
|
||||
registry.interface(Registry::Interface::Compositor).version,
|
||||
this);
|
||||
QVERIFY(m_compositor->isValid());
|
||||
m_shm = registry.createShmPool(registry.interface(Registry::Interface::Shm).name,
|
||||
registry.interface(Registry::Interface::Shm).version,
|
||||
this);
|
||||
QVERIFY(m_shm->isValid());
|
||||
m_shell = registry.createShell(registry.interface(Registry::Interface::Shell).name,
|
||||
registry.interface(Registry::Interface::Shell).version,
|
||||
this);
|
||||
QVERIFY(m_shell->isValid());
|
||||
m_ssd = registry.createServerSideDecorationManager(registry.interface(Registry::Interface::ServerSideDecorationManager).name,
|
||||
registry.interface(Registry::Interface::ServerSideDecorationManager).version,
|
||||
this);
|
||||
QVERIFY(m_ssd);
|
||||
QVERIFY(Test::setupWaylandConnection(s_socketName, Test::AdditionalWaylandInterface::Decoration));
|
||||
|
||||
screens()->setCurrent(0);
|
||||
KWin::Cursor::setPos(QPoint(1280, 512));
|
||||
|
@ -137,28 +81,7 @@ void TestMaximized::init()
|
|||
|
||||
void TestMaximized::cleanup()
|
||||
{
|
||||
#define CLEANUP(name) \
|
||||
if (name) { \
|
||||
delete name; \
|
||||
name = nullptr; \
|
||||
}
|
||||
CLEANUP(m_compositor)
|
||||
CLEANUP(m_shm)
|
||||
CLEANUP(m_shell)
|
||||
CLEANUP(m_ssd)
|
||||
CLEANUP(m_queue)
|
||||
|
||||
if (m_connection) {
|
||||
m_connection->deleteLater();
|
||||
m_connection = nullptr;
|
||||
}
|
||||
if (m_thread) {
|
||||
m_thread->quit();
|
||||
m_thread->wait();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
}
|
||||
#undef CLEANUP
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void TestMaximized::testMaximizedPassedToDeco()
|
||||
|
@ -166,15 +89,11 @@ void TestMaximized::testMaximizedPassedToDeco()
|
|||
// this test verifies that when a ShellClient gets maximized the Decoration receives the signal
|
||||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
QScopedPointer<ServerSideDecoration> ssd(m_ssd->create(surface.data()));
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
QScopedPointer<ServerSideDecoration> ssd(Test::waylandServerSideDecoration()->create(surface.data()));
|
||||
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
|
||||
QSignalSpy sizeChangedSpy(shellSurface.data(), &ShellSurface::sizeChanged);
|
||||
QVERIFY(sizeChangedSpy.isValid());
|
||||
|
@ -231,8 +150,8 @@ void TestMaximized::testInitiallyMaximized()
|
|||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
|
||||
QSignalSpy sizeChangedSpy(shellSurface.data(), &ShellSurface::sizeChanged);
|
||||
QVERIFY(sizeChangedSpy.isValid());
|
||||
|
@ -242,11 +161,7 @@ void TestMaximized::testInitiallyMaximized()
|
|||
QCOMPARE(shellSurface->size(), QSize(1280, 1024));
|
||||
|
||||
// now let's render in an incorrect size
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
|
||||
QVERIFY(clientAddedSpy.isEmpty());
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
|
|
@ -30,11 +30,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/event_queue.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/plasmashell.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
@ -71,11 +68,7 @@ private Q_SLOTS:
|
|||
private:
|
||||
KWayland::Client::ConnectionThread *m_connection = nullptr;
|
||||
KWayland::Client::Compositor *m_compositor = nullptr;
|
||||
KWayland::Client::ShmPool *m_shm = nullptr;
|
||||
KWayland::Client::Shell *m_shell = nullptr;
|
||||
KWayland::Client::PlasmaShell *m_plasmaShell = nullptr;
|
||||
KWayland::Client::EventQueue *m_queue = nullptr;
|
||||
QThread *m_thread = nullptr;
|
||||
};
|
||||
|
||||
void MoveResizeWindowTest::initTestCase()
|
||||
|
@ -95,74 +88,17 @@ void MoveResizeWindowTest::initTestCase()
|
|||
|
||||
void MoveResizeWindowTest::init()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
// setup connection
|
||||
m_connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
m_connection->setSocketName(s_socketName);
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_connection->moveToThread(m_thread);
|
||||
m_thread->start();
|
||||
|
||||
m_connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
m_queue = new EventQueue(this);
|
||||
QVERIFY(!m_queue->isValid());
|
||||
m_queue->setup(m_connection);
|
||||
QVERIFY(m_queue->isValid());
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(m_queue);
|
||||
QSignalSpy compositorSpy(®istry, &Registry::compositorAnnounced);
|
||||
QSignalSpy shmSpy(®istry, &Registry::shmAnnounced);
|
||||
QSignalSpy shellSpy(®istry, &Registry::shellAnnounced);
|
||||
QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(allAnnounced.isValid());
|
||||
QVERIFY(shmSpy.isValid());
|
||||
QVERIFY(shellSpy.isValid());
|
||||
QVERIFY(compositorSpy.isValid());
|
||||
registry.create(m_connection->display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(allAnnounced.wait());
|
||||
QVERIFY(!compositorSpy.isEmpty());
|
||||
QVERIFY(!shmSpy.isEmpty());
|
||||
QVERIFY(!shellSpy.isEmpty());
|
||||
|
||||
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_compositor->isValid());
|
||||
m_shm = registry.createShmPool(shmSpy.first().first().value<quint32>(), shmSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shm->isValid());
|
||||
m_shell = registry.createShell(shellSpy.first().first().value<quint32>(), shellSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shell->isValid());
|
||||
m_plasmaShell = registry.createPlasmaShell(registry.interface(Registry::Interface::PlasmaShell).name, registry.interface(Registry::Interface::PlasmaShell).version, this);
|
||||
QVERIFY(m_plasmaShell->isValid());
|
||||
QVERIFY(Test::setupWaylandConnection(s_socketName, Test::AdditionalWaylandInterface::PlasmaShell));
|
||||
m_connection = Test::waylandConnection();
|
||||
m_compositor = Test::waylandCompositor();
|
||||
m_shell = Test::waylandShell();
|
||||
|
||||
screens()->setCurrent(0);
|
||||
}
|
||||
|
||||
void MoveResizeWindowTest::cleanup()
|
||||
{
|
||||
delete m_compositor;
|
||||
m_compositor = nullptr;
|
||||
delete m_shm;
|
||||
m_shm = nullptr;
|
||||
delete m_shell;
|
||||
m_shell = nullptr;
|
||||
delete m_plasmaShell;
|
||||
m_plasmaShell = nullptr;
|
||||
delete m_queue;
|
||||
m_queue = nullptr;
|
||||
if (m_thread) {
|
||||
m_thread->quit();
|
||||
m_thread->wait();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
}
|
||||
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void MoveResizeWindowTest::testMove()
|
||||
|
@ -172,19 +108,15 @@ void MoveResizeWindowTest::testMove()
|
|||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged);
|
||||
QVERIFY(sizeChangeSpy.isValid());
|
||||
// let's render
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
|
||||
m_connection->flush();
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -274,19 +206,15 @@ void MoveResizeWindowTest::testPackTo()
|
|||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged);
|
||||
QVERIFY(sizeChangeSpy.isValid());
|
||||
// let's render
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
|
||||
m_connection->flush();
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -322,30 +250,26 @@ void MoveResizeWindowTest::testPackAgainstClient()
|
|||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
QScopedPointer<Surface> surface1(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface1(Test::createSurface());
|
||||
QVERIFY(!surface1.isNull());
|
||||
QScopedPointer<Surface> surface2(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface2(Test::createSurface());
|
||||
QVERIFY(!surface2.isNull());
|
||||
QScopedPointer<Surface> surface3(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface3(Test::createSurface());
|
||||
QVERIFY(!surface3.isNull());
|
||||
QScopedPointer<Surface> surface4(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface4(Test::createSurface());
|
||||
QVERIFY(!surface4.isNull());
|
||||
|
||||
QScopedPointer<ShellSurface> shellSurface1(m_shell->createSurface(surface1.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface1(Test::createShellSurface(surface1.data()));
|
||||
QVERIFY(!shellSurface1.isNull());
|
||||
QScopedPointer<ShellSurface> shellSurface2(m_shell->createSurface(surface2.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface2(Test::createShellSurface(surface2.data()));
|
||||
QVERIFY(!shellSurface2.isNull());
|
||||
QScopedPointer<ShellSurface> shellSurface3(m_shell->createSurface(surface3.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface3(Test::createShellSurface(surface3.data()));
|
||||
QVERIFY(!shellSurface3.isNull());
|
||||
QScopedPointer<ShellSurface> shellSurface4(m_shell->createSurface(surface4.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface4(Test::createShellSurface(surface4.data()));
|
||||
QVERIFY(!shellSurface4.isNull());
|
||||
auto renderWindow = [this, &clientAddedSpy] (Surface *surface, const QString &methodCall, const QRect &expectedGeometry) {
|
||||
// let's render
|
||||
QImage img(QSize(10, 10), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 10, 10));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface, QSize(10, 10), Qt::blue);
|
||||
|
||||
m_connection->flush();
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -365,15 +289,11 @@ void MoveResizeWindowTest::testPackAgainstClient()
|
|||
renderWindow(surface3.data(), QStringLiteral("slotWindowPackRight"), QRect(1270, 507, 10, 10));
|
||||
renderWindow(surface4.data(), QStringLiteral("slotWindowPackDown"), QRect(635, 1014, 10, 10));
|
||||
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
|
||||
m_connection->flush();
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -407,34 +327,26 @@ void MoveResizeWindowTest::testGrowShrink()
|
|||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
// block geometry helper
|
||||
QScopedPointer<Surface> surface1(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface1(Test::createSurface());
|
||||
QVERIFY(!surface1.isNull());
|
||||
QScopedPointer<ShellSurface> shellSurface1(m_shell->createSurface(surface1.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface1(Test::createShellSurface(surface1.data()));
|
||||
QVERIFY(!shellSurface1.isNull());
|
||||
QImage img1(QSize(650, 514), QImage::Format_ARGB32);
|
||||
img1.fill(Qt::blue);
|
||||
surface1->attachBuffer(m_shm->createBuffer(img1));
|
||||
surface1->damage(QRect(0, 0, 650, 514));
|
||||
surface1->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface1.data(), QSize(650, 514), Qt::blue);
|
||||
m_connection->flush();
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
clientAddedSpy.clear();
|
||||
workspace()->slotWindowPackRight();
|
||||
workspace()->slotWindowPackDown();
|
||||
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged);
|
||||
QVERIFY(sizeChangeSpy.isValid());
|
||||
// let's render
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
|
||||
m_connection->flush();
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -449,11 +361,7 @@ void MoveResizeWindowTest::testGrowShrink()
|
|||
QFETCH(QString, methodCall);
|
||||
QMetaObject::invokeMethod(workspace(), methodCall.toLocal8Bit().constData());
|
||||
QVERIFY(sizeChangeSpy.wait());
|
||||
QImage img2(shellSurface->size(), QImage::Format_ARGB32);
|
||||
img2.fill(Qt::red);
|
||||
surface->attachBuffer(m_shm->createBuffer(img2));
|
||||
surface->damage(QRect(QPoint(0, 0), shellSurface->size()));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), shellSurface->size(), Qt::red);
|
||||
|
||||
QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryChanged);
|
||||
QVERIFY(geometryChangedSpy.isValid());
|
||||
|
@ -486,19 +394,15 @@ void MoveResizeWindowTest::testPointerMoveEnd()
|
|||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged);
|
||||
QVERIFY(sizeChangeSpy.isValid());
|
||||
// let's render
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
|
||||
m_connection->flush();
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -547,22 +451,18 @@ void MoveResizeWindowTest::testPlasmaShellSurfaceMovable()
|
|||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
// and a PlasmaShellSurface
|
||||
QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data()));
|
||||
QScopedPointer<PlasmaShellSurface> plasmaSurface(Test::waylandPlasmaShell()->createSurface(surface.data()));
|
||||
QVERIFY(!plasmaSurface.isNull());
|
||||
QFETCH(KWayland::Client::PlasmaShellSurface::Role, role);
|
||||
plasmaSurface->setRole(role);
|
||||
// let's render
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
|
||||
m_connection->flush();
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
|
|
@ -52,11 +52,8 @@ private Q_SLOTS:
|
|||
private:
|
||||
ConnectionThread *m_connection = nullptr;
|
||||
KWayland::Client::Compositor *m_compositor = nullptr;
|
||||
ShmPool *m_shm = nullptr;
|
||||
Shell *m_shell = nullptr;
|
||||
PlasmaShell *m_plasmaShell = nullptr;
|
||||
EventQueue *m_queue = nullptr;
|
||||
QThread *m_thread = nullptr;
|
||||
};
|
||||
|
||||
void PlasmaSurfaceTest::initTestCase()
|
||||
|
@ -72,70 +69,15 @@ void PlasmaSurfaceTest::initTestCase()
|
|||
|
||||
void PlasmaSurfaceTest::init()
|
||||
{
|
||||
// setup connection
|
||||
m_connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
m_connection->setSocketName(s_socketName);
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_connection->moveToThread(m_thread);
|
||||
m_thread->start();
|
||||
|
||||
m_connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
m_queue = new EventQueue(this);
|
||||
QVERIFY(!m_queue->isValid());
|
||||
m_queue->setup(m_connection);
|
||||
QVERIFY(m_queue->isValid());
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(m_queue);
|
||||
QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(allAnnounced.isValid());
|
||||
registry.create(m_connection->display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(allAnnounced.wait());
|
||||
|
||||
m_compositor = registry.createCompositor(registry.interface(Registry::Interface::Compositor).name,
|
||||
registry.interface(Registry::Interface::Compositor).version,
|
||||
this);
|
||||
QVERIFY(m_compositor->isValid());
|
||||
m_shm = registry.createShmPool(registry.interface(Registry::Interface::Shm).name,
|
||||
registry.interface(Registry::Interface::Shm).version,
|
||||
this);
|
||||
QVERIFY(m_shm->isValid());
|
||||
m_shell = registry.createShell(registry.interface(Registry::Interface::Shell).name,
|
||||
registry.interface(Registry::Interface::Shell).version,
|
||||
this);
|
||||
QVERIFY(m_shell->isValid());
|
||||
m_plasmaShell = registry.createPlasmaShell(registry.interface(Registry::Interface::PlasmaShell).name,
|
||||
registry.interface(Registry::Interface::PlasmaShell).version,
|
||||
this);
|
||||
QVERIFY(m_plasmaShell->isValid());
|
||||
QVERIFY(Test::setupWaylandConnection(s_socketName, Test::AdditionalWaylandInterface::PlasmaShell));
|
||||
m_compositor = Test::waylandCompositor();
|
||||
m_shell = Test::waylandShell();
|
||||
m_plasmaShell = Test::waylandPlasmaShell();
|
||||
}
|
||||
|
||||
void PlasmaSurfaceTest::cleanup()
|
||||
{
|
||||
#define CLEANUP(name) delete name; name = nullptr;
|
||||
CLEANUP(m_plasmaShell)
|
||||
CLEANUP(m_shell)
|
||||
CLEANUP(m_shm)
|
||||
CLEANUP(m_compositor)
|
||||
CLEANUP(m_queue)
|
||||
if (m_connection) {
|
||||
m_connection->deleteLater();
|
||||
m_connection = nullptr;
|
||||
}
|
||||
if (m_thread) {
|
||||
m_thread->quit();
|
||||
m_thread->wait();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
}
|
||||
#undef CLEANUP
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void PlasmaSurfaceTest::testRoleOnAllDesktops_data()
|
||||
|
@ -154,9 +96,9 @@ void PlasmaSurfaceTest::testRoleOnAllDesktops_data()
|
|||
void PlasmaSurfaceTest::testRoleOnAllDesktops()
|
||||
{
|
||||
// this test verifies that a ShellClient is set on all desktops when the role changes
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data()));
|
||||
QVERIFY(!plasmaSurface.isNull());
|
||||
|
@ -165,11 +107,7 @@ void PlasmaSurfaceTest::testRoleOnAllDesktops()
|
|||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
// now render to map the window
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit();
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
AbstractClient *c = workspace()->activeClient();
|
||||
QVERIFY(c);
|
||||
|
@ -189,16 +127,14 @@ void PlasmaSurfaceTest::testRoleOnAllDesktops()
|
|||
|
||||
// let's create a second window where we init a little bit different
|
||||
// first creating the PlasmaSurface then the Shell Surface
|
||||
QScopedPointer<Surface> surface2(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface2(Test::createSurface());
|
||||
QVERIFY(!surface2.isNull());
|
||||
QScopedPointer<PlasmaShellSurface> plasmaSurface2(m_plasmaShell->createSurface(surface2.data()));
|
||||
QVERIFY(!plasmaSurface2.isNull());
|
||||
plasmaSurface2->setRole(role);
|
||||
QScopedPointer<ShellSurface> shellSurface2(m_shell->createSurface(surface2.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface2(Test::createShellSurface(surface2.data()));
|
||||
QVERIFY(!shellSurface2.isNull());
|
||||
surface2->attachBuffer(m_shm->createBuffer(img));
|
||||
surface2->damage(QRect(0, 0, 100, 50));
|
||||
surface2->commit();
|
||||
Test::render(surface2.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
||||
QVERIFY(workspace()->activeClient() != c);
|
||||
|
@ -228,9 +164,9 @@ void PlasmaSurfaceTest::testAcceptsFocus_data()
|
|||
void PlasmaSurfaceTest::testAcceptsFocus()
|
||||
{
|
||||
// this test verifies that some surface roles don't get focus
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data()));
|
||||
QVERIFY(!plasmaSurface.isNull());
|
||||
|
@ -241,11 +177,7 @@ void PlasmaSurfaceTest::testAcceptsFocus()
|
|||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
// now render to map the window
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit();
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
||||
auto c = clientAddedSpy.first().first().value<ShellClient*>();
|
||||
|
|
|
@ -29,12 +29,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <kwineffects.h>
|
||||
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/event_queue.h>
|
||||
#include <KWayland/Client/plasmawindowmanagement.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
#include <KWayland/Server/seat_interface.h>
|
||||
//screenlocker
|
||||
|
@ -67,13 +63,9 @@ private Q_SLOTS:
|
|||
void testDestroyedButNotUnmapped();
|
||||
|
||||
private:
|
||||
ConnectionThread *m_connection = nullptr;
|
||||
PlasmaWindowManagement *m_windowManagement = nullptr;
|
||||
KWayland::Client::Compositor *m_compositor = nullptr;
|
||||
Shell *m_shell = nullptr;
|
||||
ShmPool *m_shm = nullptr;
|
||||
EventQueue *m_queue = nullptr;
|
||||
QThread *m_thread = nullptr;
|
||||
};
|
||||
|
||||
void PlasmaWindowTest::initTestCase()
|
||||
|
@ -98,49 +90,10 @@ void PlasmaWindowTest::initTestCase()
|
|||
|
||||
void PlasmaWindowTest::init()
|
||||
{
|
||||
// setup connection
|
||||
m_connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
m_connection->setSocketName(s_socketName);
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_connection->moveToThread(m_thread);
|
||||
m_thread->start();
|
||||
|
||||
m_connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
m_queue = new EventQueue(this);
|
||||
QVERIFY(!m_queue->isValid());
|
||||
m_queue->setup(m_connection);
|
||||
QVERIFY(m_queue->isValid());
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(m_queue);
|
||||
QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(allAnnounced.isValid());
|
||||
registry.create(m_connection->display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(allAnnounced.wait());
|
||||
|
||||
m_windowManagement = registry.createPlasmaWindowManagement(registry.interface(Registry::Interface::PlasmaWindowManagement).name,
|
||||
registry.interface(Registry::Interface::PlasmaWindowManagement).version,
|
||||
this);
|
||||
QVERIFY(m_windowManagement);
|
||||
m_compositor = registry.createCompositor(registry.interface(Registry::Interface::Compositor).name,
|
||||
registry.interface(Registry::Interface::Compositor).version,
|
||||
this);
|
||||
QVERIFY(m_compositor);
|
||||
m_shm = registry.createShmPool(registry.interface(Registry::Interface::Shm).name,
|
||||
registry.interface(Registry::Interface::Shm).version,
|
||||
this);
|
||||
QVERIFY(m_shm);
|
||||
m_shell = registry.createShell(registry.interface(Registry::Interface::Shell).name,
|
||||
registry.interface(Registry::Interface::Shell).version,
|
||||
this);
|
||||
QVERIFY(m_shell);
|
||||
QVERIFY(Test::setupWaylandConnection(s_socketName, Test::AdditionalWaylandInterface::WindowManagement));
|
||||
m_windowManagement = Test::waylandWindowManagement();
|
||||
m_compositor = Test::waylandCompositor();
|
||||
m_shell = Test::waylandShell();
|
||||
|
||||
screens()->setCurrent(0);
|
||||
Cursor::setPos(QPoint(640, 512));
|
||||
|
@ -148,27 +101,7 @@ void PlasmaWindowTest::init()
|
|||
|
||||
void PlasmaWindowTest::cleanup()
|
||||
{
|
||||
#define CLEANUP(name) \
|
||||
if (name) { \
|
||||
delete name; \
|
||||
name = nullptr; \
|
||||
}
|
||||
CLEANUP(m_windowManagement)
|
||||
CLEANUP(m_shm)
|
||||
CLEANUP(m_shell)
|
||||
CLEANUP(m_compositor)
|
||||
CLEANUP(m_queue)
|
||||
#undef CLEANUP
|
||||
if (m_connection) {
|
||||
m_connection->deleteLater();
|
||||
m_connection = nullptr;
|
||||
}
|
||||
if (m_thread) {
|
||||
m_thread->quit();
|
||||
m_thread->wait();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
}
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void PlasmaWindowTest::testCreateDestroyX11PlasmaWindow()
|
||||
|
@ -304,35 +237,27 @@ void PlasmaWindowTest::testPopupWindowNoPlasmaWindow()
|
|||
QVERIFY(plasmaWindowCreatedSpy.isValid());
|
||||
|
||||
// first create the parent window
|
||||
QScopedPointer<Surface> parentSurface(m_compositor->createSurface());
|
||||
QScopedPointer<ShellSurface> parentShellSurface(m_shell->createSurface(parentSurface.data()));
|
||||
QScopedPointer<Surface> parentSurface(Test::createSurface());
|
||||
QScopedPointer<ShellSurface> parentShellSurface(Test::createShellSurface(parentSurface.data()));
|
||||
// map that window
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
parentSurface->attachBuffer(m_shm->createBuffer(img));
|
||||
parentSurface->damage(QRect(0, 0, 100, 50));
|
||||
parentSurface->commit();
|
||||
Test::render(parentSurface.data(), QSize(100, 50), Qt::blue);
|
||||
// this should create a plasma window
|
||||
QVERIFY(plasmaWindowCreatedSpy.wait());
|
||||
|
||||
// now let's create a popup window for it
|
||||
QScopedPointer<Surface> popupSurface(m_compositor->createSurface());
|
||||
QScopedPointer<ShellSurface> popupShellSurface(m_shell->createSurface(popupSurface.data()));
|
||||
QScopedPointer<Surface> popupSurface(Test::createSurface());
|
||||
QScopedPointer<ShellSurface> popupShellSurface(Test::createShellSurface(popupSurface.data()));
|
||||
popupShellSurface->setTransient(parentSurface.data(), QPoint(0, 0), ShellSurface::TransientFlag::NoFocus);
|
||||
// let's map it
|
||||
popupSurface->attachBuffer(m_shm->createBuffer(img));
|
||||
popupSurface->damage(QRect(0, 0, 100, 50));
|
||||
popupSurface->commit();
|
||||
Test::render(popupSurface.data(), QSize(100, 50), Qt::blue);
|
||||
|
||||
// this should not create a plasma window
|
||||
QVERIFY(!plasmaWindowCreatedSpy.wait());
|
||||
|
||||
// now the same with an already mapped surface when we create the shell surface
|
||||
QScopedPointer<Surface> popup2Surface(m_compositor->createSurface());
|
||||
popup2Surface->attachBuffer(m_shm->createBuffer(img));
|
||||
popup2Surface->damage(QRect(0, 0, 100, 50));
|
||||
popup2Surface->commit();
|
||||
QScopedPointer<ShellSurface> popup2ShellSurface(m_shell->createSurface(popup2Surface.data()));
|
||||
QScopedPointer<Surface> popup2Surface(Test::createSurface());
|
||||
Test::render(popup2Surface.data(), QSize(100, 50), Qt::blue);
|
||||
QScopedPointer<ShellSurface> popup2ShellSurface(Test::createShellSurface(popup2Surface.data()));
|
||||
popup2ShellSurface->setTransient(popupSurface.data(), QPoint(0, 0), ShellSurface::TransientFlag::NoFocus);
|
||||
|
||||
// this should not create a plasma window
|
||||
|
@ -409,14 +334,10 @@ void PlasmaWindowTest::testDestroyedButNotUnmapped()
|
|||
QVERIFY(plasmaWindowCreatedSpy.isValid());
|
||||
|
||||
// first create the parent window
|
||||
QScopedPointer<Surface> parentSurface(m_compositor->createSurface());
|
||||
QScopedPointer<ShellSurface> parentShellSurface(m_shell->createSurface(parentSurface.data()));
|
||||
QScopedPointer<Surface> parentSurface(Test::createSurface());
|
||||
QScopedPointer<ShellSurface> parentShellSurface(Test::createShellSurface(parentSurface.data()));
|
||||
// map that window
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
parentSurface->attachBuffer(m_shm->createBuffer(img));
|
||||
parentSurface->damage(QRect(0, 0, 100, 50));
|
||||
parentSurface->commit();
|
||||
Test::render(parentSurface.data(), QSize(100, 50), Qt::blue);
|
||||
// this should create a plasma window
|
||||
QVERIFY(plasmaWindowCreatedSpy.wait());
|
||||
QCOMPARE(plasmaWindowCreatedSpy.count(), 1);
|
||||
|
|
|
@ -33,8 +33,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/event_queue.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/pointer.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/seat.h>
|
||||
|
@ -75,13 +73,9 @@ private Q_SLOTS:
|
|||
|
||||
private:
|
||||
void render(KWayland::Client::Surface *surface, const QSize &size = QSize(100, 50));
|
||||
KWayland::Client::ConnectionThread *m_connection = nullptr;
|
||||
KWayland::Client::Compositor *m_compositor = nullptr;
|
||||
KWayland::Client::Seat *m_seat = nullptr;
|
||||
KWayland::Client::ShmPool *m_shm = nullptr;
|
||||
KWayland::Client::Shell *m_shell = nullptr;
|
||||
KWayland::Client::EventQueue *m_queue = nullptr;
|
||||
QThread *m_thread = nullptr;
|
||||
};
|
||||
|
||||
void PointerInputTest::initTestCase()
|
||||
|
@ -111,57 +105,11 @@ void PointerInputTest::initTestCase()
|
|||
|
||||
void PointerInputTest::init()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
// setup connection
|
||||
m_connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
m_connection->setSocketName(s_socketName);
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_connection->moveToThread(m_thread);
|
||||
m_thread->start();
|
||||
|
||||
m_connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
m_queue = new EventQueue(this);
|
||||
QVERIFY(!m_queue->isValid());
|
||||
m_queue->setup(m_connection);
|
||||
QVERIFY(m_queue->isValid());
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(m_queue);
|
||||
QSignalSpy compositorSpy(®istry, &Registry::compositorAnnounced);
|
||||
QSignalSpy shmSpy(®istry, &Registry::shmAnnounced);
|
||||
QSignalSpy shellSpy(®istry, &Registry::shellAnnounced);
|
||||
QSignalSpy seatSpy(®istry, &Registry::seatAnnounced);
|
||||
QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(allAnnounced.isValid());
|
||||
QVERIFY(shmSpy.isValid());
|
||||
QVERIFY(shellSpy.isValid());
|
||||
QVERIFY(compositorSpy.isValid());
|
||||
QVERIFY(seatSpy.isValid());
|
||||
registry.create(m_connection->display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(allAnnounced.wait());
|
||||
QVERIFY(!compositorSpy.isEmpty());
|
||||
QVERIFY(!shmSpy.isEmpty());
|
||||
QVERIFY(!shellSpy.isEmpty());
|
||||
QVERIFY(!seatSpy.isEmpty());
|
||||
|
||||
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_compositor->isValid());
|
||||
m_shm = registry.createShmPool(shmSpy.first().first().value<quint32>(), shmSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shm->isValid());
|
||||
m_shell = registry.createShell(shellSpy.first().first().value<quint32>(), shellSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shell->isValid());
|
||||
m_seat = registry.createSeat(seatSpy.first().first().value<quint32>(), seatSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_seat->isValid());
|
||||
QSignalSpy hasPointerSpy(m_seat, &Seat::hasPointerChanged);
|
||||
QVERIFY(hasPointerSpy.isValid());
|
||||
QVERIFY(hasPointerSpy.wait());
|
||||
QVERIFY(Test::setupWaylandConnection(s_socketName, Test::AdditionalWaylandInterface::Seat));
|
||||
QVERIFY(Test::waitForWaylandPointer());
|
||||
m_compositor = Test::waylandCompositor();
|
||||
m_shell = Test::waylandShell();
|
||||
m_seat = Test::waylandSeat();
|
||||
|
||||
screens()->setCurrent(0);
|
||||
Cursor::setPos(QPoint(640, 512));
|
||||
|
@ -169,34 +117,13 @@ void PointerInputTest::init()
|
|||
|
||||
void PointerInputTest::cleanup()
|
||||
{
|
||||
delete m_compositor;
|
||||
m_compositor = nullptr;
|
||||
delete m_seat;
|
||||
m_seat = nullptr;
|
||||
delete m_shm;
|
||||
m_shm = nullptr;
|
||||
delete m_shell;
|
||||
m_shell = nullptr;
|
||||
delete m_queue;
|
||||
m_queue = nullptr;
|
||||
if (m_thread) {
|
||||
m_connection->deleteLater();
|
||||
m_thread->quit();
|
||||
m_thread->wait();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
m_connection = nullptr;
|
||||
}
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void PointerInputTest::render(KWayland::Client::Surface *surface, const QSize &size)
|
||||
{
|
||||
QImage img(size, QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(QPoint(0, 0), size));
|
||||
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
||||
m_connection->flush();
|
||||
Test::render(surface, size, Qt::blue);
|
||||
Test::flushWaylandConnection();
|
||||
}
|
||||
|
||||
void PointerInputTest::testWarpingUpdatesFocus()
|
||||
|
@ -215,9 +142,9 @@ void PointerInputTest::testWarpingUpdatesFocus()
|
|||
// create a window
|
||||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
Surface *surface = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface = Test::createSurface(m_compositor);
|
||||
QVERIFY(surface);
|
||||
ShellSurface *shellSurface = m_shell->createSurface(surface, surface);
|
||||
ShellSurface *shellSurface = Test::createShellSurface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
render(surface);
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -262,9 +189,9 @@ void PointerInputTest::testWarpingGeneratesPointerMotion()
|
|||
// create a window
|
||||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
Surface *surface = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface = Test::createSurface(m_compositor);
|
||||
QVERIFY(surface);
|
||||
ShellSurface *shellSurface = m_shell->createSurface(surface, surface);
|
||||
ShellSurface *shellSurface = Test::createShellSurface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
render(surface);
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -304,9 +231,9 @@ void PointerInputTest::testUpdateFocusAfterScreenChange()
|
|||
// create a window
|
||||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
Surface *surface = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface = Test::createSurface(m_compositor);
|
||||
QVERIFY(surface);
|
||||
ShellSurface *shellSurface = m_shell->createSurface(surface, surface);
|
||||
ShellSurface *shellSurface = Test::createShellSurface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
render(surface, QSize(1280, 1024));
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -383,9 +310,9 @@ void PointerInputTest::testModifierClickUnrestrictedMove()
|
|||
// create a window
|
||||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
Surface *surface = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface = Test::createSurface(m_compositor);
|
||||
QVERIFY(surface);
|
||||
ShellSurface *shellSurface = m_shell->createSurface(surface, surface);
|
||||
ShellSurface *shellSurface = Test::createShellSurface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
render(surface);
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -453,9 +380,9 @@ void PointerInputTest::testModifierScrollOpacity()
|
|||
// create a window
|
||||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
Surface *surface = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface = Test::createSurface(m_compositor);
|
||||
QVERIFY(surface);
|
||||
ShellSurface *shellSurface = m_shell->createSurface(surface, surface);
|
||||
ShellSurface *shellSurface = Test::createShellSurface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
render(surface);
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -501,17 +428,17 @@ void PointerInputTest::testScrollAction()
|
|||
// create two windows
|
||||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
Surface *surface1 = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface1 = Test::createSurface(m_compositor);
|
||||
QVERIFY(surface1);
|
||||
ShellSurface *shellSurface1 = m_shell->createSurface(surface1, surface1);
|
||||
ShellSurface *shellSurface1 = Test::createShellSurface(surface1, surface1);
|
||||
QVERIFY(shellSurface1);
|
||||
render(surface1);
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
AbstractClient *window1 = workspace()->activeClient();
|
||||
QVERIFY(window1);
|
||||
Surface *surface2 = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface2 = Test::createSurface(m_compositor);
|
||||
QVERIFY(surface2);
|
||||
ShellSurface *shellSurface2 = m_shell->createSurface(surface2, surface2);
|
||||
ShellSurface *shellSurface2 = Test::createShellSurface(surface2, surface2);
|
||||
QVERIFY(shellSurface2);
|
||||
render(surface2);
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -561,17 +488,17 @@ void PointerInputTest::testFocusFollowsMouse()
|
|||
// create two windows
|
||||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
Surface *surface1 = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface1 = Test::createSurface(m_compositor);
|
||||
QVERIFY(surface1);
|
||||
ShellSurface *shellSurface1 = m_shell->createSurface(surface1, surface1);
|
||||
ShellSurface *shellSurface1 = Test::createShellSurface(surface1, surface1);
|
||||
QVERIFY(shellSurface1);
|
||||
render(surface1, QSize(800, 800));
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
AbstractClient *window1 = workspace()->activeClient();
|
||||
QVERIFY(window1);
|
||||
Surface *surface2 = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface2 = Test::createSurface(m_compositor);
|
||||
QVERIFY(surface2);
|
||||
ShellSurface *shellSurface2 = m_shell->createSurface(surface2, surface2);
|
||||
ShellSurface *shellSurface2 = Test::createShellSurface(surface2, surface2);
|
||||
QVERIFY(shellSurface2);
|
||||
render(surface2, QSize(800, 800));
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -647,17 +574,17 @@ void PointerInputTest::testMouseActionInactiveWindow()
|
|||
// create two windows
|
||||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
Surface *surface1 = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface1 = Test::createSurface(m_compositor);
|
||||
QVERIFY(surface1);
|
||||
ShellSurface *shellSurface1 = m_shell->createSurface(surface1, surface1);
|
||||
ShellSurface *shellSurface1 = Test::createShellSurface(surface1, surface1);
|
||||
QVERIFY(shellSurface1);
|
||||
render(surface1, QSize(800, 800));
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
AbstractClient *window1 = workspace()->activeClient();
|
||||
QVERIFY(window1);
|
||||
Surface *surface2 = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface2 = Test::createSurface(m_compositor);
|
||||
QVERIFY(surface2);
|
||||
ShellSurface *shellSurface2 = m_shell->createSurface(surface2, surface2);
|
||||
ShellSurface *shellSurface2 = Test::createShellSurface(surface2, surface2);
|
||||
QVERIFY(shellSurface2);
|
||||
render(surface2, QSize(800, 800));
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -737,9 +664,9 @@ void PointerInputTest::testMouseActionActiveWindow()
|
|||
// create two windows
|
||||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
Surface *surface1 = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface1 = Test::createSurface(m_compositor);
|
||||
QVERIFY(surface1);
|
||||
ShellSurface *shellSurface1 = m_shell->createSurface(surface1, surface1);
|
||||
ShellSurface *shellSurface1 = Test::createShellSurface(surface1, surface1);
|
||||
QVERIFY(shellSurface1);
|
||||
render(surface1, QSize(800, 800));
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -747,9 +674,9 @@ void PointerInputTest::testMouseActionActiveWindow()
|
|||
QVERIFY(window1);
|
||||
QSignalSpy window1DestroyedSpy(window1, &QObject::destroyed);
|
||||
QVERIFY(window1DestroyedSpy.isValid());
|
||||
Surface *surface2 = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface2 = Test::createSurface(m_compositor);
|
||||
QVERIFY(surface2);
|
||||
ShellSurface *shellSurface2 = m_shell->createSurface(surface2, surface2);
|
||||
ShellSurface *shellSurface2 = Test::createShellSurface(surface2, surface2);
|
||||
QVERIFY(shellSurface2);
|
||||
render(surface2, QSize(800, 800));
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -817,9 +744,9 @@ void PointerInputTest::testCursorImage()
|
|||
// create a window
|
||||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
Surface *surface = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface = Test::createSurface(m_compositor);
|
||||
QVERIFY(surface);
|
||||
ShellSurface *shellSurface = m_shell->createSurface(surface, surface);
|
||||
ShellSurface *shellSurface = Test::createShellSurface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
render(surface);
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -833,13 +760,13 @@ void PointerInputTest::testCursorImage()
|
|||
QVERIFY(enteredSpy.wait());
|
||||
|
||||
// create a cursor on the pointer
|
||||
Surface *cursorSurface = m_compositor->createSurface(m_compositor);
|
||||
Surface *cursorSurface = Test::createSurface(m_compositor);
|
||||
QVERIFY(cursorSurface);
|
||||
QSignalSpy cursorRenderedSpy(cursorSurface, &Surface::frameRendered);
|
||||
QVERIFY(cursorRenderedSpy.isValid());
|
||||
QImage red = QImage(QSize(10, 10), QImage::Format_ARGB32);
|
||||
red.fill(Qt::red);
|
||||
cursorSurface->attachBuffer(m_shm->createBuffer(red));
|
||||
cursorSurface->attachBuffer(Test::waylandShmPool()->createBuffer(red));
|
||||
cursorSurface->damage(QRect(0, 0, 10, 10));
|
||||
cursorSurface->commit();
|
||||
pointer->setCursor(cursorSurface, QPoint(5, 5));
|
||||
|
@ -848,14 +775,14 @@ void PointerInputTest::testCursorImage()
|
|||
QCOMPARE(p->cursorHotSpot(), QPoint(5, 5));
|
||||
// change hotspot
|
||||
pointer->setCursor(cursorSurface, QPoint(6, 6));
|
||||
m_connection->flush();
|
||||
Test::flushWaylandConnection();
|
||||
QTRY_COMPARE(p->cursorHotSpot(), QPoint(6, 6));
|
||||
QCOMPARE(p->cursorImage(), red);
|
||||
|
||||
// change the buffer
|
||||
QImage blue = QImage(QSize(10, 10), QImage::Format_ARGB32);
|
||||
blue.fill(Qt::blue);
|
||||
auto b = m_shm->createBuffer(blue);
|
||||
auto b = Test::waylandShmPool()->createBuffer(blue);
|
||||
cursorSurface->attachBuffer(b);
|
||||
cursorSurface->damage(QRect(0, 0, 10, 10));
|
||||
cursorSurface->commit();
|
||||
|
@ -865,7 +792,7 @@ void PointerInputTest::testCursorImage()
|
|||
|
||||
// hide the cursor
|
||||
pointer->setCursor(nullptr);
|
||||
m_connection->flush();
|
||||
Test::flushWaylandConnection();
|
||||
QTRY_VERIFY(p->cursorImage().isNull());
|
||||
|
||||
// move cursor somewhere else, should reset to fallback cursor
|
||||
|
@ -904,9 +831,9 @@ void PointerInputTest::testEffectOverrideCursorImage()
|
|||
// now let's create a window
|
||||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
Surface *surface = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface = Test::createSurface(m_compositor);
|
||||
QVERIFY(surface);
|
||||
ShellSurface *shellSurface = m_shell->createSurface(surface, surface);
|
||||
ShellSurface *shellSurface = Test::createShellSurface(surface, surface);
|
||||
QVERIFY(shellSurface);
|
||||
render(surface);
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
|
|
@ -28,10 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/event_queue.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
@ -63,10 +60,7 @@ private Q_SLOTS:
|
|||
private:
|
||||
KWayland::Client::ConnectionThread *m_connection = nullptr;
|
||||
KWayland::Client::Compositor *m_compositor = nullptr;
|
||||
KWayland::Client::ShmPool *m_shm = nullptr;
|
||||
KWayland::Client::Shell *m_shell = nullptr;
|
||||
KWayland::Client::EventQueue *m_queue = nullptr;
|
||||
QThread *m_thread = nullptr;
|
||||
};
|
||||
|
||||
void QuickTilingTest::initTestCase()
|
||||
|
@ -97,71 +91,17 @@ void QuickTilingTest::initTestCase()
|
|||
|
||||
void QuickTilingTest::init()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
// setup connection
|
||||
m_connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
m_connection->setSocketName(s_socketName);
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_connection->moveToThread(m_thread);
|
||||
m_thread->start();
|
||||
|
||||
m_connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
m_queue = new EventQueue(this);
|
||||
QVERIFY(!m_queue->isValid());
|
||||
m_queue->setup(m_connection);
|
||||
QVERIFY(m_queue->isValid());
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(m_queue);
|
||||
QSignalSpy compositorSpy(®istry, &Registry::compositorAnnounced);
|
||||
QSignalSpy shmSpy(®istry, &Registry::shmAnnounced);
|
||||
QSignalSpy shellSpy(®istry, &Registry::shellAnnounced);
|
||||
QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(allAnnounced.isValid());
|
||||
QVERIFY(shmSpy.isValid());
|
||||
QVERIFY(shellSpy.isValid());
|
||||
QVERIFY(compositorSpy.isValid());
|
||||
registry.create(m_connection->display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(allAnnounced.wait());
|
||||
QVERIFY(!compositorSpy.isEmpty());
|
||||
QVERIFY(!shmSpy.isEmpty());
|
||||
QVERIFY(!shellSpy.isEmpty());
|
||||
|
||||
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_compositor->isValid());
|
||||
m_shm = registry.createShmPool(shmSpy.first().first().value<quint32>(), shmSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shm->isValid());
|
||||
m_shell = registry.createShell(shellSpy.first().first().value<quint32>(), shellSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shell->isValid());
|
||||
QVERIFY(Test::setupWaylandConnection(s_socketName));
|
||||
m_connection = Test::waylandConnection();
|
||||
m_compositor = Test::waylandCompositor();
|
||||
m_shell = Test::waylandShell();
|
||||
|
||||
screens()->setCurrent(0);
|
||||
}
|
||||
|
||||
void QuickTilingTest::cleanup()
|
||||
{
|
||||
delete m_compositor;
|
||||
m_compositor = nullptr;
|
||||
delete m_shm;
|
||||
m_shm = nullptr;
|
||||
delete m_shell;
|
||||
m_shell = nullptr;
|
||||
delete m_queue;
|
||||
m_queue = nullptr;
|
||||
if (m_thread) {
|
||||
m_connection->deleteLater();
|
||||
m_thread->quit();
|
||||
m_thread->wait();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
m_connection = nullptr;
|
||||
}
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void QuickTilingTest::testQuickTiling_data()
|
||||
|
@ -194,19 +134,15 @@ void QuickTilingTest::testQuickTiling()
|
|||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged);
|
||||
QVERIFY(sizeChangeSpy.isValid());
|
||||
// let's render
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
|
||||
m_connection->flush();
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -235,11 +171,7 @@ void QuickTilingTest::testQuickTiling()
|
|||
QCOMPARE(sizeChangeSpy.first().first().toSize(), expectedGeometry.size());
|
||||
|
||||
// attach a new image
|
||||
img = QImage(expectedGeometry.size(), QImage::Format_ARGB32);
|
||||
img.fill(Qt::red);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(QPoint(0, 0), expectedGeometry.size()));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), expectedGeometry.size(), Qt::red);
|
||||
m_connection->flush();
|
||||
|
||||
QVERIFY(geometryChangedSpy.wait());
|
||||
|
@ -276,19 +208,15 @@ void QuickTilingTest::testQuickMaximizing()
|
|||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged);
|
||||
QVERIFY(sizeChangeSpy.isValid());
|
||||
// let's render
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
|
||||
m_connection->flush();
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -329,11 +257,7 @@ void QuickTilingTest::testQuickMaximizing()
|
|||
QCOMPARE(sizeChangeSpy.first().first().toSize(), QSize(1280, 1024));
|
||||
|
||||
// attach a new image
|
||||
img = QImage(QSize(1280, 1024), QImage::Format_ARGB32);
|
||||
img.fill(Qt::red);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 1280, 1024));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), QSize(1280, 1024), Qt::red);
|
||||
m_connection->flush();
|
||||
|
||||
QVERIFY(geometryChangedSpy.wait());
|
||||
|
@ -363,11 +287,7 @@ void QuickTilingTest::testQuickMaximizing()
|
|||
QCOMPARE(sizeChangeSpy.last().first().toSize(), QSize(100, 50));
|
||||
|
||||
// render again
|
||||
img = QImage(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::yellow);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::yellow);
|
||||
m_connection->flush();
|
||||
|
||||
QVERIFY(geometryChangedSpy.wait());
|
||||
|
@ -396,19 +316,15 @@ void QuickTilingTest::testQuickTilingKeyboardMove()
|
|||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged);
|
||||
QVERIFY(sizeChangeSpy.isValid());
|
||||
// let's render
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
|
||||
m_connection->flush();
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -477,19 +393,15 @@ void QuickTilingTest::testQuickTilingPointerMove()
|
|||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged);
|
||||
QVERIFY(sizeChangeSpy.isValid());
|
||||
// let's render
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
|
||||
m_connection->flush();
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
|
|
@ -27,16 +27,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/event_queue.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
#include <KWayland/Server/shell_interface.h>
|
||||
|
||||
#include <QThread>
|
||||
|
||||
using namespace KWin;
|
||||
using namespace KWayland::Client;
|
||||
|
||||
|
@ -51,14 +46,6 @@ private Q_SLOTS:
|
|||
void cleanup();
|
||||
|
||||
void testMapUnmapMap();
|
||||
|
||||
private:
|
||||
KWayland::Client::Compositor *m_compositor = nullptr;
|
||||
Shell *m_shell = nullptr;
|
||||
ShmPool *m_shm = nullptr;
|
||||
EventQueue *m_queue = nullptr;
|
||||
ConnectionThread *m_connection = nullptr;
|
||||
QThread *m_thread = nullptr;
|
||||
};
|
||||
|
||||
void TestShellClient::initTestCase()
|
||||
|
@ -81,45 +68,7 @@ void TestShellClient::initTestCase()
|
|||
|
||||
void TestShellClient::init()
|
||||
{
|
||||
// setup connection
|
||||
m_connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
m_connection->setSocketName(s_socketName);
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_connection->moveToThread(m_thread);
|
||||
m_thread->start();
|
||||
|
||||
m_connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
m_queue = new EventQueue(this);
|
||||
QVERIFY(!m_queue->isValid());
|
||||
m_queue->setup(m_connection);
|
||||
QVERIFY(m_queue->isValid());
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(m_queue);
|
||||
QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(allAnnounced.isValid());
|
||||
registry.create(m_connection->display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(allAnnounced.wait());
|
||||
|
||||
m_compositor = registry.createCompositor(registry.interface(Registry::Interface::Compositor).name,
|
||||
registry.interface(Registry::Interface::Compositor).version,
|
||||
this);
|
||||
QVERIFY(m_compositor->isValid());
|
||||
m_shm = registry.createShmPool(registry.interface(Registry::Interface::Shm).name,
|
||||
registry.interface(Registry::Interface::Shm).version,
|
||||
this);
|
||||
QVERIFY(m_shm->isValid());
|
||||
m_shell = registry.createShell(registry.interface(Registry::Interface::Shell).name,
|
||||
registry.interface(Registry::Interface::Shell).version,
|
||||
this);
|
||||
QVERIFY(m_shell->isValid());
|
||||
QVERIFY(Test::setupWaylandConnection(s_socketName));
|
||||
|
||||
screens()->setCurrent(0);
|
||||
KWin::Cursor::setPos(QPoint(1280, 512));
|
||||
|
@ -127,27 +76,7 @@ void TestShellClient::init()
|
|||
|
||||
void TestShellClient::cleanup()
|
||||
{
|
||||
#define CLEANUP(name) \
|
||||
if (name) { \
|
||||
delete name; \
|
||||
name = nullptr; \
|
||||
}
|
||||
CLEANUP(m_compositor)
|
||||
CLEANUP(m_shm)
|
||||
CLEANUP(m_shell)
|
||||
CLEANUP(m_queue)
|
||||
|
||||
if (m_connection) {
|
||||
m_connection->deleteLater();
|
||||
m_connection = nullptr;
|
||||
}
|
||||
if (m_thread) {
|
||||
m_thread->quit();
|
||||
m_thread->wait();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
}
|
||||
#undef CLEANUP
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void TestShellClient::testMapUnmapMap()
|
||||
|
@ -156,15 +85,11 @@ void TestShellClient::testMapUnmapMap()
|
|||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
|
||||
// now let's render
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
|
||||
QVERIFY(clientAddedSpy.isEmpty());
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
|
@ -186,9 +111,7 @@ void TestShellClient::testMapUnmapMap()
|
|||
|
||||
QSignalSpy windowShownSpy(client, &ShellClient::windowShown);
|
||||
QVERIFY(windowShownSpy.isValid());
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
QCOMPARE(clientAddedSpy.count(), 1);
|
||||
QVERIFY(windowShownSpy.wait());
|
||||
QCOMPARE(windowShownSpy.count(), 1);
|
||||
|
|
|
@ -26,10 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/event_queue.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
namespace KWin
|
||||
|
@ -42,6 +39,7 @@ class StartTest : public QObject
|
|||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void cleanup();
|
||||
void testScreens();
|
||||
void testNoWindowsAtStart();
|
||||
void testCreateWindow();
|
||||
|
@ -57,6 +55,11 @@ void StartTest::initTestCase()
|
|||
QVERIFY(workspaceCreatedSpy.wait());
|
||||
}
|
||||
|
||||
void StartTest::cleanup()
|
||||
{
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void StartTest::testScreens()
|
||||
{
|
||||
QCOMPARE(screens()->count(), 1);
|
||||
|
@ -78,15 +81,7 @@ void StartTest::testCreateWindow()
|
|||
{
|
||||
// first we need to connect to the server
|
||||
using namespace KWayland::Client;
|
||||
auto connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(connection, &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
connection->setSocketName(s_socketName);
|
||||
QThread *thread = new QThread(this);
|
||||
connection->moveToThread(thread);
|
||||
thread->start();
|
||||
connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
QVERIFY(Test::setupWaylandConnection(s_socketName));
|
||||
|
||||
QSignalSpy shellClientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(shellClientAddedSpy.isValid());
|
||||
|
@ -94,32 +89,14 @@ void StartTest::testCreateWindow()
|
|||
QVERIFY(shellClientRemovedSpy.isValid());
|
||||
|
||||
{
|
||||
EventQueue queue;
|
||||
queue.setup(connection);
|
||||
Registry registry;
|
||||
registry.setEventQueue(&queue);
|
||||
registry.create(connection);
|
||||
QSignalSpy registryAnnouncedSpy(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(registryAnnouncedSpy.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(registryAnnouncedSpy.wait());
|
||||
|
||||
const auto compositorData = registry.interface(Registry::Interface::Compositor);
|
||||
const auto shellData = registry.interface(Registry::Interface::Shell);
|
||||
const auto shmData = registry.interface(Registry::Interface::Shm);
|
||||
QScopedPointer<KWayland::Client::Compositor> compositor(registry.createCompositor(compositorData.name, compositorData.version));
|
||||
QVERIFY(!compositor.isNull());
|
||||
QScopedPointer<Shell> shell(registry.createShell(shellData.name, shellData.version));
|
||||
QVERIFY(!shell.isNull());
|
||||
|
||||
QScopedPointer<Surface> surface(compositor->createSurface());
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
QSignalSpy surfaceRenderedSpy(surface.data(), &Surface::frameRendered);
|
||||
QVERIFY(surfaceRenderedSpy.isValid());
|
||||
|
||||
QScopedPointer<ShellSurface> shellSurface(shell->createSurface(surface.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
connection->flush();
|
||||
Test::flushWaylandConnection();
|
||||
QVERIFY(waylandServer()->clients().isEmpty());
|
||||
// now dispatch should give us the client
|
||||
waylandServer()->dispatch();
|
||||
|
@ -132,15 +109,10 @@ void StartTest::testCreateWindow()
|
|||
QVERIFY(waylandServer()->clients().first()->iconGeometry().isNull());
|
||||
|
||||
// let's render
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
QScopedPointer<ShmPool> shm(registry.createShmPool(shmData.name, shmData.version));
|
||||
QVERIFY(!shm.isNull());
|
||||
surface->attachBuffer(shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
surface->commit();
|
||||
|
||||
connection->flush();
|
||||
Test::flushWaylandConnection();
|
||||
QVERIFY(shellClientAddedSpy.wait());
|
||||
QCOMPARE(workspace()->allClientList().count(), 1);
|
||||
QCOMPARE(workspace()->allClientList().first(), waylandServer()->clients().first());
|
||||
|
@ -155,11 +127,6 @@ void StartTest::testCreateWindow()
|
|||
// this should tear down everything again
|
||||
QVERIFY(shellClientRemovedSpy.wait());
|
||||
QVERIFY(waylandServer()->clients().isEmpty());
|
||||
|
||||
// cleanup
|
||||
connection->deleteLater();
|
||||
thread->quit();
|
||||
thread->wait();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,16 +28,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "shell_client.h"
|
||||
#include <kwineffects.h>
|
||||
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/event_queue.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/plasmashell.h>
|
||||
#include <KWayland/Client/pointer.h>
|
||||
#include <KWayland/Client/server_decoration.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/seat.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
#include <KDecoration2/Decoration>
|
||||
|
@ -66,15 +59,8 @@ private Q_SLOTS:
|
|||
void test363804();
|
||||
|
||||
private:
|
||||
KWayland::Client::ConnectionThread *m_connection = nullptr;
|
||||
KWayland::Client::Compositor *m_compositor = nullptr;
|
||||
KWayland::Client::ServerSideDecorationManager *m_deco = nullptr;
|
||||
KWayland::Client::Seat *m_seat = nullptr;
|
||||
KWayland::Client::ShmPool *m_shm = nullptr;
|
||||
KWayland::Client::Shell *m_shell = nullptr;
|
||||
KWayland::Client::EventQueue *m_queue = nullptr;
|
||||
KWayland::Client::PlasmaShell *m_plasmaShell = nullptr;
|
||||
QThread *m_thread = nullptr;
|
||||
};
|
||||
|
||||
void StrutsTest::initTestCase()
|
||||
|
@ -98,99 +84,18 @@ void StrutsTest::initTestCase()
|
|||
|
||||
void StrutsTest::init()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
// setup connection
|
||||
m_connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
m_connection->setSocketName(s_socketName);
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_connection->moveToThread(m_thread);
|
||||
m_thread->start();
|
||||
|
||||
m_connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
m_queue = new EventQueue(this);
|
||||
QVERIFY(!m_queue->isValid());
|
||||
m_queue->setup(m_connection);
|
||||
QVERIFY(m_queue->isValid());
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(m_queue);
|
||||
QSignalSpy compositorSpy(®istry, &Registry::compositorAnnounced);
|
||||
QSignalSpy shmSpy(®istry, &Registry::shmAnnounced);
|
||||
QSignalSpy shellSpy(®istry, &Registry::shellAnnounced);
|
||||
QSignalSpy seatSpy(®istry, &Registry::seatAnnounced);
|
||||
QSignalSpy decorationSpy(®istry, &Registry::serverSideDecorationManagerAnnounced);
|
||||
QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(allAnnounced.isValid());
|
||||
QVERIFY(shmSpy.isValid());
|
||||
QVERIFY(shellSpy.isValid());
|
||||
QVERIFY(compositorSpy.isValid());
|
||||
QVERIFY(seatSpy.isValid());
|
||||
QVERIFY(decorationSpy.isValid());
|
||||
registry.create(m_connection->display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(allAnnounced.wait());
|
||||
QVERIFY(!compositorSpy.isEmpty());
|
||||
QVERIFY(!shmSpy.isEmpty());
|
||||
QVERIFY(!shellSpy.isEmpty());
|
||||
QVERIFY(!seatSpy.isEmpty());
|
||||
QVERIFY(!decorationSpy.isEmpty());
|
||||
|
||||
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_compositor->isValid());
|
||||
m_shm = registry.createShmPool(shmSpy.first().first().value<quint32>(), shmSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shm->isValid());
|
||||
m_shell = registry.createShell(shellSpy.first().first().value<quint32>(), shellSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shell->isValid());
|
||||
m_seat = registry.createSeat(seatSpy.first().first().value<quint32>(), seatSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_seat->isValid());
|
||||
m_deco = registry.createServerSideDecorationManager(decorationSpy.first().first().value<quint32>(), decorationSpy.first().last().value<quint32>());
|
||||
QVERIFY(m_deco->isValid());
|
||||
m_plasmaShell = registry.createPlasmaShell(registry.interface(Registry::Interface::PlasmaShell).name,
|
||||
registry.interface(Registry::Interface::PlasmaShell).version,
|
||||
this);
|
||||
QVERIFY(m_plasmaShell);
|
||||
QSignalSpy hasPointerSpy(m_seat, &Seat::hasPointerChanged);
|
||||
QVERIFY(hasPointerSpy.isValid());
|
||||
QVERIFY(hasPointerSpy.wait());
|
||||
QVERIFY(Test::setupWaylandConnection(s_socketName, Test::AdditionalWaylandInterface::PlasmaShell));
|
||||
m_compositor = Test::waylandCompositor();
|
||||
m_plasmaShell = Test::waylandPlasmaShell();
|
||||
|
||||
screens()->setCurrent(0);
|
||||
Cursor::setPos(QPoint(640, 512));
|
||||
QVERIFY(waylandServer()->clients().isEmpty());
|
||||
}
|
||||
|
||||
void StrutsTest::cleanup()
|
||||
{
|
||||
delete m_compositor;
|
||||
m_compositor = nullptr;
|
||||
delete m_deco;
|
||||
m_deco = nullptr;
|
||||
delete m_seat;
|
||||
m_seat = nullptr;
|
||||
delete m_shm;
|
||||
m_shm = nullptr;
|
||||
delete m_shell;
|
||||
m_shell = nullptr;
|
||||
delete m_plasmaShell;
|
||||
m_plasmaShell = nullptr;
|
||||
delete m_queue;
|
||||
m_queue = nullptr;
|
||||
if (m_thread) {
|
||||
m_connection->deleteLater();
|
||||
m_thread->quit();
|
||||
m_thread->wait();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
m_connection = nullptr;
|
||||
}
|
||||
while (!waylandServer()->clients().isEmpty()) {
|
||||
QCoreApplication::instance()->processEvents(QEventLoop::WaitForMoreEvents);
|
||||
}
|
||||
QVERIFY(waylandServer()->clients().isEmpty());
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void StrutsTest::testWaylandStruts_data()
|
||||
|
@ -252,21 +157,18 @@ void StrutsTest::testWaylandStruts()
|
|||
// create the panels
|
||||
QSignalSpy windowCreatedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(windowCreatedSpy.isValid());
|
||||
QHash<Surface*, ShellClient*> clients;
|
||||
for (auto it = windowGeometries.constBegin(), end = windowGeometries.constEnd(); it != end; it++) {
|
||||
const QRect windowGeometry = *it;
|
||||
Surface *surface = m_compositor->createSurface(m_compositor);
|
||||
ShellSurface *shellSurface = m_shell->createSurface(surface, surface);
|
||||
Surface *surface = Test::createSurface(m_compositor);
|
||||
ShellSurface *shellSurface = Test::createShellSurface(surface, surface);
|
||||
Q_UNUSED(shellSurface)
|
||||
PlasmaShellSurface *plasmaSurface = m_plasmaShell->createSurface(surface, surface);
|
||||
plasmaSurface->setPosition(windowGeometry.topLeft());
|
||||
plasmaSurface->setRole(PlasmaShellSurface::Role::Panel);
|
||||
|
||||
// map the window
|
||||
QImage img(windowGeometry.size(), QImage::Format_RGB32);
|
||||
img.fill(Qt::red);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(QPoint(0, 0), windowGeometry.size()));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface, windowGeometry.size(), Qt::red, QImage::Format_RGB32);
|
||||
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
QCOMPARE(windowCreatedSpy.count(), 1);
|
||||
|
@ -277,6 +179,7 @@ void StrutsTest::testWaylandStruts()
|
|||
QVERIFY(c->isDock());
|
||||
QVERIFY(c->hasStrut());
|
||||
windowCreatedSpy.clear();
|
||||
clients.insert(surface, c);
|
||||
}
|
||||
|
||||
// some props are independent of struts - those first
|
||||
|
@ -299,6 +202,14 @@ void StrutsTest::testWaylandStruts()
|
|||
QTEST(workspace()->clientArea(PlacementArea, 1, 1), "screen1Maximized");
|
||||
QTEST(workspace()->clientArea(MaximizeArea, 1, 1), "screen1Maximized");
|
||||
QTEST(workspace()->clientArea(WorkArea, 0, 1), "workArea");
|
||||
|
||||
// delete all surfaces
|
||||
for (auto it = clients.begin(); it != clients.end(); it++) {
|
||||
QSignalSpy destroyedSpy(it.value(), &QObject::destroyed);
|
||||
QVERIFY(destroyedSpy.isValid());
|
||||
delete it.key();
|
||||
QVERIFY(destroyedSpy.wait());
|
||||
}
|
||||
}
|
||||
|
||||
void StrutsTest::testMoveWaylandPanel()
|
||||
|
@ -306,8 +217,8 @@ void StrutsTest::testMoveWaylandPanel()
|
|||
// this test verifies that repositioning a Wayland panel updates the client area
|
||||
using namespace KWayland::Client;
|
||||
const QRect windowGeometry(0, 1000, 1280, 24);
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
Q_UNUSED(shellSurface)
|
||||
QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data()));
|
||||
plasmaSurface->setPosition(windowGeometry.topLeft());
|
||||
|
@ -317,11 +228,7 @@ void StrutsTest::testMoveWaylandPanel()
|
|||
QVERIFY(windowCreatedSpy.isValid());
|
||||
|
||||
// map the window
|
||||
QImage img(windowGeometry.size(), QImage::Format_RGB32);
|
||||
img.fill(Qt::red);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(QPoint(0, 0), windowGeometry.size()));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), windowGeometry.size(), Qt::red, QImage::Format_RGB32);
|
||||
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
QCOMPARE(windowCreatedSpy.count(), 1);
|
||||
|
@ -362,8 +269,8 @@ void StrutsTest::testWaylandMobilePanel()
|
|||
|
||||
// create first top panel
|
||||
const QRect windowGeometry(0, 0, 1280, 60);
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
Q_UNUSED(shellSurface)
|
||||
QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data()));
|
||||
plasmaSurface->setPosition(windowGeometry.topLeft());
|
||||
|
@ -373,11 +280,7 @@ void StrutsTest::testWaylandMobilePanel()
|
|||
QVERIFY(windowCreatedSpy.isValid());
|
||||
|
||||
// map the first panel
|
||||
QImage img(windowGeometry.size(), QImage::Format_RGB32);
|
||||
img.fill(Qt::red);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(QPoint(0, 0), windowGeometry.size()));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface.data(), windowGeometry.size(), Qt::red, QImage::Format_RGB32);
|
||||
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
QCOMPARE(windowCreatedSpy.count(), 1);
|
||||
|
@ -398,18 +301,14 @@ void StrutsTest::testWaylandMobilePanel()
|
|||
|
||||
// create another bottom panel
|
||||
const QRect windowGeometry2(0, 874, 1280, 150);
|
||||
QScopedPointer<Surface> surface2(m_compositor->createSurface());
|
||||
QScopedPointer<ShellSurface> shellSurface2(m_shell->createSurface(surface2.data()));
|
||||
QScopedPointer<Surface> surface2(Test::createSurface());
|
||||
QScopedPointer<ShellSurface> shellSurface2(Test::createShellSurface(surface2.data()));
|
||||
Q_UNUSED(shellSurface2)
|
||||
QScopedPointer<PlasmaShellSurface> plasmaSurface2(m_plasmaShell->createSurface(surface2.data()));
|
||||
plasmaSurface2->setPosition(windowGeometry2.topLeft());
|
||||
plasmaSurface2->setRole(PlasmaShellSurface::Role::Panel);
|
||||
|
||||
QImage img2(windowGeometry2.size(), QImage::Format_RGB32);
|
||||
img2.fill(Qt::blue);
|
||||
surface2->attachBuffer(m_shm->createBuffer(img2));
|
||||
surface2->damage(QRect(QPoint(0, 0), windowGeometry2.size()));
|
||||
surface2->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface2.data(), windowGeometry2.size(), Qt::blue, QImage::Format_RGB32);
|
||||
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
QCOMPARE(windowCreatedSpy.count(), 1);
|
||||
|
|
|
@ -0,0 +1,281 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/event_queue.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/plasmashell.h>
|
||||
#include <KWayland/Client/plasmawindowmanagement.h>
|
||||
#include <KWayland/Client/seat.h>
|
||||
#include <KWayland/Client/server_decoration.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
#include <QThread>
|
||||
|
||||
using namespace KWayland::Client;
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
namespace Test
|
||||
{
|
||||
|
||||
static struct {
|
||||
ConnectionThread *connection = nullptr;
|
||||
EventQueue *queue = nullptr;
|
||||
Compositor *compositor = nullptr;
|
||||
ServerSideDecorationManager *decoration = nullptr;
|
||||
Shell *shell = nullptr;
|
||||
ShmPool *shm = nullptr;
|
||||
Seat *seat = nullptr;
|
||||
PlasmaShell *plasmaShell = nullptr;
|
||||
PlasmaWindowManagement *windowManagement = nullptr;
|
||||
QThread *thread = nullptr;
|
||||
} s_waylandConnection;
|
||||
|
||||
bool setupWaylandConnection(const QString &socketName, AdditionalWaylandInterfaces flags)
|
||||
{
|
||||
if (s_waylandConnection.connection) {
|
||||
return false;
|
||||
}
|
||||
// setup connection
|
||||
s_waylandConnection.connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(s_waylandConnection.connection, &ConnectionThread::connected);
|
||||
if (!connectedSpy.isValid()) {
|
||||
return false;
|
||||
}
|
||||
s_waylandConnection.connection->setSocketName(socketName);
|
||||
|
||||
s_waylandConnection.thread = new QThread(kwinApp());
|
||||
s_waylandConnection.connection->moveToThread(s_waylandConnection.thread);
|
||||
s_waylandConnection.thread->start();
|
||||
|
||||
s_waylandConnection.connection->initConnection();
|
||||
if (!connectedSpy.wait()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
s_waylandConnection.queue = new EventQueue;
|
||||
s_waylandConnection.queue->setup(s_waylandConnection.connection);
|
||||
if (!s_waylandConnection.queue->isValid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(s_waylandConnection.queue);
|
||||
QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced);
|
||||
if (!allAnnounced.isValid()) {
|
||||
return false;
|
||||
}
|
||||
registry.create(s_waylandConnection.connection);
|
||||
if (!registry.isValid()) {
|
||||
return false;
|
||||
}
|
||||
registry.setup();
|
||||
if (!allAnnounced.wait()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
s_waylandConnection.compositor = registry.createCompositor(registry.interface(Registry::Interface::Compositor).name, registry.interface(Registry::Interface::Compositor).version);
|
||||
if (!s_waylandConnection.compositor->isValid()) {
|
||||
return false;
|
||||
}
|
||||
s_waylandConnection.shm = registry.createShmPool(registry.interface(Registry::Interface::Shm).name, registry.interface(Registry::Interface::Shm).version);
|
||||
if (!s_waylandConnection.shm->isValid()) {
|
||||
return false;
|
||||
}
|
||||
s_waylandConnection.shell = registry.createShell(registry.interface(Registry::Interface::Shell).name, registry.interface(Registry::Interface::Shell).version);
|
||||
if (!s_waylandConnection.shell->isValid()) {
|
||||
return false;
|
||||
}
|
||||
if (flags.testFlag(AdditionalWaylandInterface::Seat)) {
|
||||
s_waylandConnection.seat = registry.createSeat(registry.interface(Registry::Interface::Seat).name, registry.interface(Registry::Interface::Seat).version);
|
||||
if (!s_waylandConnection.seat->isValid()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (flags.testFlag(AdditionalWaylandInterface::Decoration)) {
|
||||
s_waylandConnection.decoration = registry.createServerSideDecorationManager(registry.interface(Registry::Interface::ServerSideDecorationManager).name,
|
||||
registry.interface(Registry::Interface::ServerSideDecorationManager).version);
|
||||
if (!s_waylandConnection.decoration->isValid()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (flags.testFlag(AdditionalWaylandInterface::PlasmaShell)) {
|
||||
s_waylandConnection.plasmaShell = registry.createPlasmaShell(registry.interface(Registry::Interface::PlasmaShell).name,
|
||||
registry.interface(Registry::Interface::PlasmaShell).version);
|
||||
if (!s_waylandConnection.plasmaShell->isValid()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (flags.testFlag(AdditionalWaylandInterface::WindowManagement)) {
|
||||
s_waylandConnection.windowManagement = registry.createPlasmaWindowManagement(registry.interface(Registry::Interface::PlasmaWindowManagement).name,
|
||||
registry.interface(Registry::Interface::PlasmaWindowManagement).version);
|
||||
if (!s_waylandConnection.windowManagement->isValid()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void destroyWaylandConnection()
|
||||
{
|
||||
delete s_waylandConnection.compositor;
|
||||
s_waylandConnection.compositor = nullptr;
|
||||
delete s_waylandConnection.windowManagement;
|
||||
s_waylandConnection.windowManagement = nullptr;
|
||||
delete s_waylandConnection.plasmaShell;
|
||||
s_waylandConnection.plasmaShell = nullptr;
|
||||
delete s_waylandConnection.decoration;
|
||||
s_waylandConnection.decoration = nullptr;
|
||||
delete s_waylandConnection.decoration;
|
||||
s_waylandConnection.decoration = nullptr;
|
||||
delete s_waylandConnection.seat;
|
||||
s_waylandConnection.seat = nullptr;
|
||||
delete s_waylandConnection.shell;
|
||||
s_waylandConnection.shell = nullptr;
|
||||
delete s_waylandConnection.shm;
|
||||
s_waylandConnection.shm = nullptr;
|
||||
delete s_waylandConnection.queue;
|
||||
s_waylandConnection.queue = nullptr;
|
||||
if (s_waylandConnection.thread) {
|
||||
QSignalSpy spy(s_waylandConnection.connection, &QObject::destroyed);
|
||||
s_waylandConnection.connection->deleteLater();
|
||||
QVERIFY(spy.wait());
|
||||
s_waylandConnection.thread->quit();
|
||||
s_waylandConnection.thread->wait();
|
||||
delete s_waylandConnection.thread;
|
||||
s_waylandConnection.thread = nullptr;
|
||||
s_waylandConnection.connection = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ConnectionThread *waylandConnection()
|
||||
{
|
||||
return s_waylandConnection.connection;
|
||||
}
|
||||
|
||||
Compositor *waylandCompositor()
|
||||
{
|
||||
return s_waylandConnection.compositor;
|
||||
}
|
||||
|
||||
Shell *waylandShell()
|
||||
{
|
||||
return s_waylandConnection.shell;
|
||||
}
|
||||
|
||||
ShmPool *waylandShmPool()
|
||||
{
|
||||
return s_waylandConnection.shm;
|
||||
}
|
||||
|
||||
Seat *waylandSeat()
|
||||
{
|
||||
return s_waylandConnection.seat;
|
||||
}
|
||||
|
||||
ServerSideDecorationManager *waylandServerSideDecoration()
|
||||
{
|
||||
return s_waylandConnection.decoration;
|
||||
}
|
||||
|
||||
PlasmaShell *waylandPlasmaShell()
|
||||
{
|
||||
return s_waylandConnection.plasmaShell;
|
||||
}
|
||||
|
||||
PlasmaWindowManagement *waylandWindowManagement()
|
||||
{
|
||||
return s_waylandConnection.windowManagement;
|
||||
}
|
||||
|
||||
bool waitForWaylandPointer()
|
||||
{
|
||||
if (!s_waylandConnection.seat) {
|
||||
return false;
|
||||
}
|
||||
QSignalSpy hasPointerSpy(s_waylandConnection.seat, &Seat::hasPointerChanged);
|
||||
if (!hasPointerSpy.isValid()) {
|
||||
return false;
|
||||
}
|
||||
return hasPointerSpy.wait();
|
||||
}
|
||||
|
||||
bool waitForWaylandTouch()
|
||||
{
|
||||
if (!s_waylandConnection.seat) {
|
||||
return false;
|
||||
}
|
||||
QSignalSpy hasTouchSpy(s_waylandConnection.seat, &Seat::hasTouchChanged);
|
||||
if (!hasTouchSpy.isValid()) {
|
||||
return false;
|
||||
}
|
||||
return hasTouchSpy.wait();
|
||||
}
|
||||
|
||||
void render(Surface *surface, const QSize &size, const QColor &color, const QImage::Format &format)
|
||||
{
|
||||
QImage img(size, format);
|
||||
img.fill(color);
|
||||
surface->attachBuffer(s_waylandConnection.shm->createBuffer(img));
|
||||
surface->damage(QRect(QPoint(0, 0), size));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
}
|
||||
|
||||
void flushWaylandConnection()
|
||||
{
|
||||
if (s_waylandConnection.connection) {
|
||||
s_waylandConnection.connection->flush();
|
||||
}
|
||||
}
|
||||
|
||||
Surface *createSurface(QObject *parent)
|
||||
{
|
||||
if (!s_waylandConnection.compositor) {
|
||||
return nullptr;
|
||||
}
|
||||
auto s = s_waylandConnection.compositor->createSurface(parent);
|
||||
if (!s->isValid()) {
|
||||
delete s;
|
||||
return nullptr;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
ShellSurface *createShellSurface(Surface *surface, QObject *parent)
|
||||
{
|
||||
if (!s_waylandConnection.shell) {
|
||||
return nullptr;
|
||||
}
|
||||
auto s = s_waylandConnection.shell->createSurface(surface, parent);
|
||||
if (!s->isValid()) {
|
||||
delete s;
|
||||
return nullptr;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -27,11 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/event_queue.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/seat.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
#include <KWayland/Client/touch.h>
|
||||
|
||||
|
@ -53,14 +50,7 @@ private Q_SLOTS:
|
|||
|
||||
private:
|
||||
AbstractClient *showWindow();
|
||||
KWayland::Client::ConnectionThread *m_connection = nullptr;
|
||||
KWayland::Client::Compositor *m_compositor = nullptr;
|
||||
KWayland::Client::Seat *m_seat = nullptr;
|
||||
KWayland::Client::ShmPool *m_shm = nullptr;
|
||||
KWayland::Client::Shell *m_shell = nullptr;
|
||||
KWayland::Client::Touch *m_touch = nullptr;
|
||||
KWayland::Client::EventQueue *m_queue = nullptr;
|
||||
QThread *m_thread = nullptr;
|
||||
};
|
||||
|
||||
void TouchInputTest::initTestCase()
|
||||
|
@ -84,57 +74,9 @@ void TouchInputTest::initTestCase()
|
|||
void TouchInputTest::init()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
// setup connection
|
||||
m_connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
m_connection->setSocketName(s_socketName);
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_connection->moveToThread(m_thread);
|
||||
m_thread->start();
|
||||
|
||||
m_connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
m_queue = new EventQueue(this);
|
||||
QVERIFY(!m_queue->isValid());
|
||||
m_queue->setup(m_connection);
|
||||
QVERIFY(m_queue->isValid());
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(m_queue);
|
||||
QSignalSpy compositorSpy(®istry, &Registry::compositorAnnounced);
|
||||
QSignalSpy shmSpy(®istry, &Registry::shmAnnounced);
|
||||
QSignalSpy shellSpy(®istry, &Registry::shellAnnounced);
|
||||
QSignalSpy seatSpy(®istry, &Registry::seatAnnounced);
|
||||
QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(allAnnounced.isValid());
|
||||
QVERIFY(shmSpy.isValid());
|
||||
QVERIFY(shellSpy.isValid());
|
||||
QVERIFY(compositorSpy.isValid());
|
||||
QVERIFY(seatSpy.isValid());
|
||||
registry.create(m_connection->display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(allAnnounced.wait());
|
||||
QVERIFY(!compositorSpy.isEmpty());
|
||||
QVERIFY(!shmSpy.isEmpty());
|
||||
QVERIFY(!shellSpy.isEmpty());
|
||||
QVERIFY(!seatSpy.isEmpty());
|
||||
|
||||
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_compositor->isValid());
|
||||
m_shm = registry.createShmPool(shmSpy.first().first().value<quint32>(), shmSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shm->isValid());
|
||||
m_shell = registry.createShell(shellSpy.first().first().value<quint32>(), shellSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shell->isValid());
|
||||
m_seat = registry.createSeat(seatSpy.first().first().value<quint32>(), seatSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_seat->isValid());
|
||||
QSignalSpy hasTouchSpy(m_seat, &Seat::hasTouchChanged);
|
||||
QVERIFY(hasTouchSpy.isValid());
|
||||
QVERIFY(hasTouchSpy.wait());
|
||||
m_touch = m_seat->createTouch(m_seat);
|
||||
QVERIFY(Test::setupWaylandConnection(s_socketName, Test::AdditionalWaylandInterface::Seat));
|
||||
QVERIFY(Test::waitForWaylandTouch());
|
||||
m_touch = Test::waylandSeat()->createTouch(Test::waylandSeat());
|
||||
QVERIFY(m_touch);
|
||||
QVERIFY(m_touch->isValid());
|
||||
|
||||
|
@ -144,26 +86,9 @@ void TouchInputTest::init()
|
|||
|
||||
void TouchInputTest::cleanup()
|
||||
{
|
||||
delete m_compositor;
|
||||
m_compositor = nullptr;
|
||||
delete m_touch;
|
||||
m_touch = nullptr;
|
||||
delete m_seat;
|
||||
m_seat = nullptr;
|
||||
delete m_shm;
|
||||
m_shm = nullptr;
|
||||
delete m_shell;
|
||||
m_shell = nullptr;
|
||||
delete m_queue;
|
||||
m_queue = nullptr;
|
||||
if (m_thread) {
|
||||
m_connection->deleteLater();
|
||||
m_thread->quit();
|
||||
m_thread->wait();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
m_connection = nullptr;
|
||||
}
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
AbstractClient *TouchInputTest::showWindow()
|
||||
|
@ -178,18 +103,14 @@ AbstractClient *TouchInputTest::showWindow()
|
|||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
VERIFY(clientAddedSpy.isValid());
|
||||
|
||||
Surface *surface = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface = Test::createSurface(Test::waylandCompositor());
|
||||
VERIFY(surface);
|
||||
ShellSurface *shellSurface = m_shell->createSurface(surface, surface);
|
||||
ShellSurface *shellSurface = Test::createShellSurface(surface, surface);
|
||||
VERIFY(shellSurface);
|
||||
// let's render
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface, QSize(100, 50), Qt::blue);
|
||||
|
||||
m_connection->flush();
|
||||
Test::flushWaylandConnection();
|
||||
VERIFY(clientAddedSpy.wait());
|
||||
AbstractClient *c = workspace()->activeClient();
|
||||
VERIFY(c);
|
||||
|
|
|
@ -27,10 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/event_queue.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
namespace KWin
|
||||
|
@ -46,14 +43,6 @@ private Q_SLOTS:
|
|||
void init();
|
||||
void cleanup();
|
||||
void testTransientNoFocus();
|
||||
|
||||
private:
|
||||
KWayland::Client::ConnectionThread *m_connection = nullptr;
|
||||
KWayland::Client::Compositor *m_compositor = nullptr;
|
||||
KWayland::Client::ShmPool *m_shm = nullptr;
|
||||
KWayland::Client::Shell *m_shell = nullptr;
|
||||
KWayland::Client::EventQueue *m_queue = nullptr;
|
||||
QThread *m_thread = nullptr;
|
||||
};
|
||||
|
||||
void TransientNoInputTest::initTestCase()
|
||||
|
@ -69,68 +58,12 @@ void TransientNoInputTest::initTestCase()
|
|||
|
||||
void TransientNoInputTest::init()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
// setup connection
|
||||
m_connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
m_connection->setSocketName(s_socketName);
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_connection->moveToThread(m_thread);
|
||||
m_thread->start();
|
||||
|
||||
m_connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
m_queue = new EventQueue(this);
|
||||
QVERIFY(!m_queue->isValid());
|
||||
m_queue->setup(m_connection);
|
||||
QVERIFY(m_queue->isValid());
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(m_queue);
|
||||
QSignalSpy compositorSpy(®istry, &Registry::compositorAnnounced);
|
||||
QSignalSpy shmSpy(®istry, &Registry::shmAnnounced);
|
||||
QSignalSpy shellSpy(®istry, &Registry::shellAnnounced);
|
||||
QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(allAnnounced.isValid());
|
||||
QVERIFY(shmSpy.isValid());
|
||||
QVERIFY(shellSpy.isValid());
|
||||
QVERIFY(compositorSpy.isValid());
|
||||
registry.create(m_connection->display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(allAnnounced.wait());
|
||||
QVERIFY(!compositorSpy.isEmpty());
|
||||
QVERIFY(!shmSpy.isEmpty());
|
||||
QVERIFY(!shellSpy.isEmpty());
|
||||
|
||||
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_compositor->isValid());
|
||||
m_shm = registry.createShmPool(shmSpy.first().first().value<quint32>(), shmSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shm->isValid());
|
||||
m_shell = registry.createShell(shellSpy.first().first().value<quint32>(), shellSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shell->isValid());
|
||||
QVERIFY(Test::setupWaylandConnection(s_socketName));
|
||||
}
|
||||
|
||||
void TransientNoInputTest::cleanup()
|
||||
{
|
||||
delete m_compositor;
|
||||
m_compositor = nullptr;
|
||||
delete m_shm;
|
||||
m_shm = nullptr;
|
||||
delete m_shell;
|
||||
m_shell = nullptr;
|
||||
delete m_queue;
|
||||
m_queue = nullptr;
|
||||
if (m_thread) {
|
||||
m_thread->quit();
|
||||
m_thread->wait();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
}
|
||||
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void TransientNoInputTest::testTransientNoFocus()
|
||||
|
@ -140,38 +73,30 @@ void TransientNoInputTest::testTransientNoFocus()
|
|||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
|
||||
QScopedPointer<Surface> surface(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> surface(Test::createSurface());
|
||||
QVERIFY(!surface.isNull());
|
||||
|
||||
QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data()));
|
||||
QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data()));
|
||||
QVERIFY(!shellSurface.isNull());
|
||||
// let's render
|
||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit();
|
||||
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
||||
|
||||
m_connection->flush();
|
||||
Test::flushWaylandConnection();
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
AbstractClient *c = workspace()->activeClient();
|
||||
QVERIFY(c);
|
||||
QCOMPARE(clientAddedSpy.first().first().value<ShellClient*>(), c);
|
||||
|
||||
// let's create a transient with no input
|
||||
QScopedPointer<Surface> transientSurface(m_compositor->createSurface());
|
||||
QScopedPointer<Surface> transientSurface(Test::createSurface());
|
||||
QVERIFY(!transientSurface.isNull());
|
||||
QScopedPointer<ShellSurface> transientShellSurface(m_shell->createSurface(transientSurface.data()));
|
||||
QScopedPointer<ShellSurface> transientShellSurface(Test::createShellSurface(transientSurface.data()));
|
||||
QVERIFY(!transientShellSurface.isNull());
|
||||
transientShellSurface->setTransient(surface.data(), QPoint(10, 20), ShellSurface::TransientFlag::NoFocus);
|
||||
m_connection->flush();
|
||||
Test::flushWaylandConnection();
|
||||
// let's render
|
||||
QImage img2(QSize(200, 20), QImage::Format_ARGB32);
|
||||
img2.fill(Qt::red);
|
||||
transientSurface->attachBuffer(m_shm->createBuffer(img2));
|
||||
transientSurface->damage(QRect(0, 0, 200, 20));
|
||||
transientSurface->commit();
|
||||
m_connection->flush();
|
||||
Test::render(transientSurface.data(), QSize(200, 20), Qt::red);
|
||||
Test::flushWaylandConnection();
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
// get the latest ShellClient
|
||||
auto transientClient = clientAddedSpy.last().first().value<ShellClient*>();
|
||||
|
|
|
@ -63,14 +63,6 @@ private Q_SLOTS:
|
|||
private:
|
||||
AbstractClient *showWindow(const QSize &size, bool decorated = false, KWayland::Client::Surface *parent = nullptr, const QPoint &offset = QPoint());
|
||||
KWayland::Client::Surface *surfaceForClient(AbstractClient *c) const;
|
||||
KWayland::Client::ConnectionThread *m_connection = nullptr;
|
||||
KWayland::Client::Compositor *m_compositor = nullptr;
|
||||
KWayland::Client::ServerSideDecorationManager *m_deco = nullptr;
|
||||
KWayland::Client::Seat *m_seat = nullptr;
|
||||
KWayland::Client::ShmPool *m_shm = nullptr;
|
||||
KWayland::Client::Shell *m_shell = nullptr;
|
||||
KWayland::Client::EventQueue *m_queue = nullptr;
|
||||
QThread *m_thread = nullptr;
|
||||
};
|
||||
|
||||
void TransientPlacementTest::initTestCase()
|
||||
|
@ -94,60 +86,7 @@ void TransientPlacementTest::initTestCase()
|
|||
|
||||
void TransientPlacementTest::init()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
// setup connection
|
||||
m_connection = new ConnectionThread;
|
||||
QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected);
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
m_connection->setSocketName(s_socketName);
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_connection->moveToThread(m_thread);
|
||||
m_thread->start();
|
||||
|
||||
m_connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
m_queue = new EventQueue(this);
|
||||
QVERIFY(!m_queue->isValid());
|
||||
m_queue->setup(m_connection);
|
||||
QVERIFY(m_queue->isValid());
|
||||
|
||||
Registry registry;
|
||||
registry.setEventQueue(m_queue);
|
||||
QSignalSpy compositorSpy(®istry, &Registry::compositorAnnounced);
|
||||
QSignalSpy shmSpy(®istry, &Registry::shmAnnounced);
|
||||
QSignalSpy shellSpy(®istry, &Registry::shellAnnounced);
|
||||
QSignalSpy seatSpy(®istry, &Registry::seatAnnounced);
|
||||
QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced);
|
||||
QVERIFY(allAnnounced.isValid());
|
||||
QVERIFY(shmSpy.isValid());
|
||||
QVERIFY(shellSpy.isValid());
|
||||
QVERIFY(compositorSpy.isValid());
|
||||
QVERIFY(seatSpy.isValid());
|
||||
registry.create(m_connection->display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(allAnnounced.wait());
|
||||
QVERIFY(!compositorSpy.isEmpty());
|
||||
QVERIFY(!shmSpy.isEmpty());
|
||||
QVERIFY(!shellSpy.isEmpty());
|
||||
QVERIFY(!seatSpy.isEmpty());
|
||||
|
||||
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_compositor->isValid());
|
||||
m_shm = registry.createShmPool(shmSpy.first().first().value<quint32>(), shmSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shm->isValid());
|
||||
m_shell = registry.createShell(shellSpy.first().first().value<quint32>(), shellSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shell->isValid());
|
||||
m_seat = registry.createSeat(seatSpy.first().first().value<quint32>(), seatSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_seat->isValid());
|
||||
QSignalSpy hasPointerSpy(m_seat, &Seat::hasPointerChanged);
|
||||
QVERIFY(hasPointerSpy.isValid());
|
||||
QVERIFY(hasPointerSpy.wait());
|
||||
|
||||
m_deco = registry.createServerSideDecorationManager(registry.interface(Registry::Interface::ServerSideDecorationManager).name, registry.interface(Registry::Interface::ServerSideDecorationManager).version, this);
|
||||
QVERIFY(m_deco->isValid());
|
||||
QVERIFY(Test::setupWaylandConnection(s_socketName, Test::AdditionalWaylandInterface::Decoration));
|
||||
|
||||
screens()->setCurrent(0);
|
||||
Cursor::setPos(QPoint(640, 512));
|
||||
|
@ -155,26 +94,7 @@ void TransientPlacementTest::init()
|
|||
|
||||
void TransientPlacementTest::cleanup()
|
||||
{
|
||||
delete m_deco;
|
||||
m_deco = nullptr;
|
||||
delete m_compositor;
|
||||
m_compositor = nullptr;
|
||||
delete m_seat;
|
||||
m_seat = nullptr;
|
||||
delete m_shm;
|
||||
m_shm = nullptr;
|
||||
delete m_shell;
|
||||
m_shell = nullptr;
|
||||
delete m_queue;
|
||||
m_queue = nullptr;
|
||||
if (m_thread) {
|
||||
m_connection->deleteLater();
|
||||
m_thread->quit();
|
||||
m_thread->wait();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
m_connection = nullptr;
|
||||
}
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
AbstractClient *TransientPlacementTest::showWindow(const QSize &size, bool decorated, KWayland::Client::Surface *parent, const QPoint &offset)
|
||||
|
@ -189,15 +109,15 @@ AbstractClient *TransientPlacementTest::showWindow(const QSize &size, bool decor
|
|||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
VERIFY(clientAddedSpy.isValid());
|
||||
|
||||
Surface *surface = m_compositor->createSurface(m_compositor);
|
||||
Surface *surface = Test::createSurface(Test::waylandCompositor());
|
||||
VERIFY(surface);
|
||||
ShellSurface *shellSurface = m_shell->createSurface(surface, surface);
|
||||
ShellSurface *shellSurface = Test::createShellSurface(surface, surface);
|
||||
VERIFY(shellSurface);
|
||||
if (parent) {
|
||||
shellSurface->setTransient(parent, offset);
|
||||
}
|
||||
if (decorated) {
|
||||
auto deco = m_deco->create(surface, surface);
|
||||
auto deco = Test::waylandServerSideDecoration()->create(surface, surface);
|
||||
QSignalSpy decoSpy(deco, &ServerSideDecoration::modeChanged);
|
||||
VERIFY(decoSpy.isValid());
|
||||
VERIFY(decoSpy.wait());
|
||||
|
@ -206,13 +126,9 @@ AbstractClient *TransientPlacementTest::showWindow(const QSize &size, bool decor
|
|||
COMPARE(deco->mode(), ServerSideDecoration::Mode::Server);
|
||||
}
|
||||
// let's render
|
||||
QImage img(size, QImage::Format_ARGB32);
|
||||
img.fill(Qt::blue);
|
||||
surface->attachBuffer(m_shm->createBuffer(img));
|
||||
surface->damage(QRect(QPoint(0, 0), size));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
Test::render(surface, size, Qt::blue);
|
||||
|
||||
m_connection->flush();
|
||||
Test::flushWaylandConnection();
|
||||
VERIFY(clientAddedSpy.wait());
|
||||
AbstractClient *c = workspace()->activeClient();
|
||||
VERIFY(c);
|
||||
|
|
Loading…
Reference in New Issue