2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2018-12-08 16:06:51 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2018 Martin Flöser <mgraesslin@kde.org>
|
2020-08-02 22:10:35 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
|
|
*/
|
2022-03-16 11:41:47 +00:00
|
|
|
#include "config-kwin.h"
|
|
|
|
|
2018-12-08 16:06:51 +00:00
|
|
|
#include "kwin_wayland_test.h"
|
2022-03-23 10:13:38 +00:00
|
|
|
|
2018-12-08 16:06:51 +00:00
|
|
|
#include "atoms.h"
|
|
|
|
#include "rules.h"
|
|
|
|
#include "virtualdesktops.h"
|
|
|
|
#include "wayland_server.h"
|
2022-04-22 17:39:12 +00:00
|
|
|
#include "window.h"
|
2018-12-08 16:06:51 +00:00
|
|
|
#include "workspace.h"
|
2022-04-22 17:54:31 +00:00
|
|
|
#include "x11window.h"
|
2018-12-08 16:06:51 +00:00
|
|
|
|
|
|
|
#include <KWayland/Client/surface.h>
|
|
|
|
|
|
|
|
#include <QDBusArgument>
|
|
|
|
#include <QDBusConnection>
|
|
|
|
#include <QDBusMessage>
|
|
|
|
#include <QDBusPendingReply>
|
|
|
|
#include <QUuid>
|
|
|
|
|
|
|
|
#include <netwm.h>
|
|
|
|
#include <xcb/xcb_icccm.h>
|
|
|
|
|
|
|
|
using namespace KWin;
|
|
|
|
|
|
|
|
static const QString s_socketName = QStringLiteral("wayland_test_kwin_dbus_interface-0");
|
|
|
|
|
|
|
|
const QString s_destination{QStringLiteral("org.kde.KWin")};
|
|
|
|
const QString s_path{QStringLiteral("/KWin")};
|
|
|
|
const QString s_interface{QStringLiteral("org.kde.KWin")};
|
|
|
|
|
|
|
|
class TestDbusInterface : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
private Q_SLOTS:
|
|
|
|
void initTestCase();
|
|
|
|
void init();
|
|
|
|
void cleanup();
|
|
|
|
|
|
|
|
void testGetWindowInfoInvalidUuid();
|
2019-08-30 21:36:58 +00:00
|
|
|
void testGetWindowInfoXdgShellClient();
|
2018-12-08 16:06:51 +00:00
|
|
|
void testGetWindowInfoX11Client();
|
|
|
|
};
|
|
|
|
|
|
|
|
void TestDbusInterface::initTestCase()
|
|
|
|
{
|
2022-04-22 17:39:12 +00:00
|
|
|
qRegisterMetaType<KWin::Window *>();
|
2018-12-08 16:06:51 +00:00
|
|
|
|
2020-07-07 09:32:29 +00:00
|
|
|
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
2020-12-09 13:06:15 +00:00
|
|
|
QVERIFY(waylandServer()->init(s_socketName));
|
2023-05-08 10:16:00 +00:00
|
|
|
Test::setOutputConfig({
|
|
|
|
QRect(0, 0, 1280, 1024),
|
|
|
|
QRect(1280, 0, 1280, 1024),
|
|
|
|
});
|
2018-12-08 16:06:51 +00:00
|
|
|
|
|
|
|
kwinApp()->start();
|
2020-07-07 09:32:29 +00:00
|
|
|
QVERIFY(applicationStartedSpy.wait());
|
2018-12-08 16:06:51 +00:00
|
|
|
VirtualDesktopManager::self()->setCount(4);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestDbusInterface::init()
|
|
|
|
{
|
|
|
|
QVERIFY(Test::setupWaylandConnection());
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestDbusInterface::cleanup()
|
|
|
|
{
|
|
|
|
Test::destroyWaylandConnection();
|
|
|
|
}
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
namespace
|
|
|
|
{
|
2018-12-08 16:06:51 +00:00
|
|
|
QDBusPendingCall getWindowInfo(const QUuid &uuid)
|
|
|
|
{
|
|
|
|
auto msg = QDBusMessage::createMethodCall(s_destination, s_path, s_interface, QStringLiteral("getWindowInfo"));
|
|
|
|
msg.setArguments({uuid.toString()});
|
|
|
|
return QDBusConnection::sessionBus().asyncCall(msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestDbusInterface::testGetWindowInfoInvalidUuid()
|
|
|
|
{
|
|
|
|
QDBusPendingReply<QVariantMap> reply{getWindowInfo(QUuid::createUuid())};
|
|
|
|
reply.waitForFinished();
|
|
|
|
QVERIFY(reply.isValid());
|
|
|
|
QVERIFY(!reply.isError());
|
|
|
|
const auto windowData = reply.value();
|
|
|
|
QVERIFY(windowData.empty());
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestDbusInterface::testGetWindowInfoXdgShellClient()
|
2018-12-08 16:06:51 +00:00
|
|
|
{
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
2018-12-08 16:06:51 +00:00
|
|
|
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
|
|
|
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
|
|
|
shellSurface->set_title(QStringLiteral("Test window"));
|
2018-12-08 16:06:51 +00:00
|
|
|
|
|
|
|
// now let's render
|
2022-08-01 21:29:02 +00:00
|
|
|
Test::render(surface.get(), QSize(100, 50), Qt::blue);
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.isEmpty());
|
|
|
|
QVERIFY(windowAddedSpy.wait());
|
2022-04-23 19:51:16 +00:00
|
|
|
auto window = windowAddedSpy.first().first().value<Window *>();
|
|
|
|
QVERIFY(window);
|
2018-12-08 16:06:51 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
const QVariantMap expectedData = {
|
|
|
|
{QStringLiteral("type"), int(NET::Normal)},
|
2022-04-23 19:51:16 +00:00
|
|
|
{QStringLiteral("x"), window->x()},
|
|
|
|
{QStringLiteral("y"), window->y()},
|
|
|
|
{QStringLiteral("width"), window->width()},
|
|
|
|
{QStringLiteral("height"), window->height()},
|
|
|
|
{QStringLiteral("desktops"), window->desktopIds()},
|
2022-03-23 10:13:38 +00:00
|
|
|
{QStringLiteral("minimized"), false},
|
|
|
|
{QStringLiteral("shaded"), false},
|
|
|
|
{QStringLiteral("fullscreen"), false},
|
|
|
|
{QStringLiteral("keepAbove"), false},
|
|
|
|
{QStringLiteral("keepBelow"), false},
|
|
|
|
{QStringLiteral("skipTaskbar"), false},
|
|
|
|
{QStringLiteral("skipPager"), false},
|
|
|
|
{QStringLiteral("skipSwitcher"), false},
|
|
|
|
{QStringLiteral("maximizeHorizontal"), false},
|
|
|
|
{QStringLiteral("maximizeVertical"), false},
|
|
|
|
{QStringLiteral("noBorder"), false},
|
|
|
|
{QStringLiteral("clientMachine"), QString()},
|
|
|
|
{QStringLiteral("localhost"), true},
|
|
|
|
{QStringLiteral("role"), QString()},
|
|
|
|
{QStringLiteral("resourceName"), QStringLiteral("testDbusInterface")},
|
|
|
|
{QStringLiteral("resourceClass"), QStringLiteral("org.kde.foo")},
|
|
|
|
{QStringLiteral("desktopFile"), QStringLiteral("org.kde.foo")},
|
|
|
|
{QStringLiteral("caption"), QStringLiteral("Test window")},
|
2022-03-16 11:41:47 +00:00
|
|
|
#if KWIN_BUILD_ACTIVITIES
|
2022-03-23 10:13:38 +00:00
|
|
|
{QStringLiteral("activities"), QStringList()},
|
2022-03-16 11:41:47 +00:00
|
|
|
#endif
|
2024-01-16 21:54:17 +00:00
|
|
|
{QStringLiteral("layer"), NormalLayer},
|
2022-03-16 11:41:47 +00:00
|
|
|
};
|
|
|
|
|
2018-12-08 16:06:51 +00:00
|
|
|
// let's get the window info
|
2022-04-23 19:51:16 +00:00
|
|
|
QDBusPendingReply<QVariantMap> reply{getWindowInfo(window->internalId())};
|
2018-12-08 16:06:51 +00:00
|
|
|
reply.waitForFinished();
|
|
|
|
QVERIFY(reply.isValid());
|
|
|
|
QVERIFY(!reply.isError());
|
|
|
|
auto windowData = reply.value();
|
2023-01-13 15:14:53 +00:00
|
|
|
windowData.remove(QStringLiteral("uuid"));
|
2022-03-16 11:41:47 +00:00
|
|
|
QCOMPARE(windowData, expectedData);
|
2018-12-08 16:06:51 +00:00
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
auto verifyProperty = [window](const QString &name) {
|
|
|
|
QDBusPendingReply<QVariantMap> reply{getWindowInfo(window->internalId())};
|
2018-12-08 16:06:51 +00:00
|
|
|
reply.waitForFinished();
|
|
|
|
return reply.value().value(name).toBool();
|
|
|
|
};
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(!window->isMinimized());
|
|
|
|
window->setMinimized(true);
|
|
|
|
QVERIFY(window->isMinimized());
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("minimized")), true);
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(!window->keepAbove());
|
|
|
|
window->setKeepAbove(true);
|
|
|
|
QVERIFY(window->keepAbove());
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("keepAbove")), true);
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(!window->keepBelow());
|
|
|
|
window->setKeepBelow(true);
|
|
|
|
QVERIFY(window->keepBelow());
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("keepBelow")), true);
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(!window->skipTaskbar());
|
|
|
|
window->setSkipTaskbar(true);
|
|
|
|
QVERIFY(window->skipTaskbar());
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("skipTaskbar")), true);
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(!window->skipPager());
|
|
|
|
window->setSkipPager(true);
|
|
|
|
QVERIFY(window->skipPager());
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("skipPager")), true);
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(!window->skipSwitcher());
|
|
|
|
window->setSkipSwitcher(true);
|
|
|
|
QVERIFY(window->skipSwitcher());
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("skipSwitcher")), true);
|
|
|
|
|
|
|
|
// not testing shaded as that's X11
|
|
|
|
// not testing fullscreen, maximizeHorizontal, maximizeVertical and noBorder as those require window geometry changes
|
|
|
|
|
2023-10-19 06:50:15 +00:00
|
|
|
const QList<VirtualDesktop *> desktops = VirtualDesktopManager::self()->desktops();
|
|
|
|
QCOMPARE(window->desktops(), QList<VirtualDesktop *>{desktops[0]});
|
2023-02-23 17:10:08 +00:00
|
|
|
workspace()->sendWindowToDesktops(window, {desktops[1]}, false);
|
2023-10-19 06:50:15 +00:00
|
|
|
QCOMPARE(window->desktops(), QList<VirtualDesktop *>{desktops[1]});
|
2022-04-23 19:51:16 +00:00
|
|
|
reply = getWindowInfo(window->internalId());
|
2018-12-08 16:06:51 +00:00
|
|
|
reply.waitForFinished();
|
2022-04-23 19:51:16 +00:00
|
|
|
QCOMPARE(reply.value().value(QStringLiteral("desktops")).toStringList(), window->desktopIds());
|
2018-12-08 16:06:51 +00:00
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
window->move(QPoint(10, 20));
|
|
|
|
reply = getWindowInfo(window->internalId());
|
2018-12-08 16:06:51 +00:00
|
|
|
reply.waitForFinished();
|
2022-04-23 19:51:16 +00:00
|
|
|
QCOMPARE(reply.value().value(QStringLiteral("x")).toInt(), window->x());
|
|
|
|
QCOMPARE(reply.value().value(QStringLiteral("y")).toInt(), window->y());
|
2018-12-08 16:06:51 +00:00
|
|
|
// not testing width, height as that would require window geometry change
|
|
|
|
|
|
|
|
// finally close window
|
2022-04-23 19:51:16 +00:00
|
|
|
const auto id = window->internalId();
|
2023-03-13 19:21:11 +00:00
|
|
|
QSignalSpy windowClosedSpy(window, &Window::closed);
|
2018-12-08 16:06:51 +00:00
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(windowClosedSpy.wait());
|
|
|
|
QCOMPARE(windowClosedSpy.count(), 1);
|
|
|
|
|
|
|
|
reply = getWindowInfo(id);
|
|
|
|
reply.waitForFinished();
|
|
|
|
QVERIFY(reply.value().empty());
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestDbusInterface::testGetWindowInfoX11Client()
|
|
|
|
{
|
2023-02-03 13:29:21 +00:00
|
|
|
Test::XcbConnectionPtr c = Test::createX11Connection();
|
2022-08-01 21:29:02 +00:00
|
|
|
QVERIFY(!xcb_connection_has_error(c.get()));
|
2018-12-08 16:06:51 +00:00
|
|
|
const QRect windowGeometry(0, 0, 600, 400);
|
2022-08-01 21:29:02 +00:00
|
|
|
xcb_window_t windowId = xcb_generate_id(c.get());
|
|
|
|
xcb_create_window(c.get(), XCB_COPY_FROM_PARENT, windowId, rootWindow(),
|
2018-12-08 16:06:51 +00:00
|
|
|
windowGeometry.x(),
|
|
|
|
windowGeometry.y(),
|
|
|
|
windowGeometry.width(),
|
|
|
|
windowGeometry.height(),
|
|
|
|
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, 0, nullptr);
|
|
|
|
xcb_size_hints_t hints;
|
|
|
|
memset(&hints, 0, sizeof(hints));
|
|
|
|
xcb_icccm_size_hints_set_position(&hints, 1, windowGeometry.x(), windowGeometry.y());
|
|
|
|
xcb_icccm_size_hints_set_size(&hints, 1, windowGeometry.width(), windowGeometry.height());
|
2022-08-01 21:29:02 +00:00
|
|
|
xcb_icccm_set_wm_normal_hints(c.get(), windowId, &hints);
|
|
|
|
xcb_icccm_set_wm_class(c.get(), windowId, 7, "foo\0bar");
|
|
|
|
NETWinInfo winInfo(c.get(), windowId, rootWindow(), NET::Properties(), NET::Properties2());
|
2018-12-08 16:06:51 +00:00
|
|
|
winInfo.setName("Some caption");
|
|
|
|
winInfo.setDesktopFileName("org.kde.foo");
|
2022-08-01 21:29:02 +00:00
|
|
|
xcb_map_window(c.get(), windowId);
|
|
|
|
xcb_flush(c.get());
|
2018-12-08 16:06:51 +00:00
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
// we should get a window for it
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy windowCreatedSpy(workspace(), &Workspace::windowAdded);
|
2018-12-08 16:06:51 +00:00
|
|
|
QVERIFY(windowCreatedSpy.wait());
|
2022-04-23 19:51:16 +00:00
|
|
|
X11Window *window = windowCreatedSpy.first().first().value<X11Window *>();
|
|
|
|
QVERIFY(window);
|
|
|
|
QCOMPARE(window->window(), windowId);
|
|
|
|
QCOMPARE(window->clientSize(), windowGeometry.size());
|
2018-12-08 16:06:51 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
const QVariantMap expectedData = {
|
|
|
|
{QStringLiteral("type"), NET::Normal},
|
2022-04-23 19:51:16 +00:00
|
|
|
{QStringLiteral("x"), window->x()},
|
|
|
|
{QStringLiteral("y"), window->y()},
|
|
|
|
{QStringLiteral("width"), window->width()},
|
|
|
|
{QStringLiteral("height"), window->height()},
|
|
|
|
{QStringLiteral("desktops"), window->desktopIds()},
|
2022-03-23 10:13:38 +00:00
|
|
|
{QStringLiteral("minimized"), false},
|
|
|
|
{QStringLiteral("shaded"), false},
|
|
|
|
{QStringLiteral("fullscreen"), false},
|
|
|
|
{QStringLiteral("keepAbove"), false},
|
|
|
|
{QStringLiteral("keepBelow"), false},
|
|
|
|
{QStringLiteral("skipTaskbar"), false},
|
|
|
|
{QStringLiteral("skipPager"), false},
|
|
|
|
{QStringLiteral("skipSwitcher"), false},
|
|
|
|
{QStringLiteral("maximizeHorizontal"), false},
|
|
|
|
{QStringLiteral("maximizeVertical"), false},
|
|
|
|
{QStringLiteral("noBorder"), false},
|
|
|
|
{QStringLiteral("role"), QString()},
|
|
|
|
{QStringLiteral("resourceName"), QStringLiteral("foo")},
|
|
|
|
{QStringLiteral("resourceClass"), QStringLiteral("bar")},
|
|
|
|
{QStringLiteral("desktopFile"), QStringLiteral("org.kde.foo")},
|
|
|
|
{QStringLiteral("caption"), QStringLiteral("Some caption")},
|
2022-03-22 11:28:18 +00:00
|
|
|
#if KWIN_BUILD_ACTIVITIES
|
2022-03-23 10:13:38 +00:00
|
|
|
{QStringLiteral("activities"), QStringList()},
|
2022-03-22 11:28:18 +00:00
|
|
|
#endif
|
2024-01-16 21:54:17 +00:00
|
|
|
{QStringLiteral("layer"), NormalLayer},
|
2022-03-22 11:28:18 +00:00
|
|
|
};
|
|
|
|
|
2018-12-08 16:06:51 +00:00
|
|
|
// let's get the window info
|
2022-04-23 19:51:16 +00:00
|
|
|
QDBusPendingReply<QVariantMap> reply{getWindowInfo(window->internalId())};
|
2018-12-08 16:06:51 +00:00
|
|
|
reply.waitForFinished();
|
|
|
|
QVERIFY(reply.isValid());
|
|
|
|
QVERIFY(!reply.isError());
|
|
|
|
auto windowData = reply.value();
|
2022-03-22 11:28:18 +00:00
|
|
|
// not testing clientmachine as that is system dependent due to that also not testing localhost
|
|
|
|
windowData.remove(QStringLiteral("clientMachine"));
|
|
|
|
windowData.remove(QStringLiteral("localhost"));
|
2023-01-13 15:14:53 +00:00
|
|
|
windowData.remove(QStringLiteral("uuid"));
|
2022-03-22 11:28:18 +00:00
|
|
|
QCOMPARE(windowData, expectedData);
|
2018-12-08 16:06:51 +00:00
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
auto verifyProperty = [window](const QString &name) {
|
|
|
|
QDBusPendingReply<QVariantMap> reply{getWindowInfo(window->internalId())};
|
2018-12-08 16:06:51 +00:00
|
|
|
reply.waitForFinished();
|
|
|
|
return reply.value().value(name).toBool();
|
|
|
|
};
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(!window->isMinimized());
|
|
|
|
window->setMinimized(true);
|
|
|
|
QVERIFY(window->isMinimized());
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("minimized")), true);
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(!window->keepAbove());
|
|
|
|
window->setKeepAbove(true);
|
|
|
|
QVERIFY(window->keepAbove());
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("keepAbove")), true);
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(!window->keepBelow());
|
|
|
|
window->setKeepBelow(true);
|
|
|
|
QVERIFY(window->keepBelow());
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("keepBelow")), true);
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(!window->skipTaskbar());
|
|
|
|
window->setSkipTaskbar(true);
|
|
|
|
QVERIFY(window->skipTaskbar());
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("skipTaskbar")), true);
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(!window->skipPager());
|
|
|
|
window->setSkipPager(true);
|
|
|
|
QVERIFY(window->skipPager());
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("skipPager")), true);
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(!window->skipSwitcher());
|
|
|
|
window->setSkipSwitcher(true);
|
|
|
|
QVERIFY(window->skipSwitcher());
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("skipSwitcher")), true);
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(!window->isShade());
|
|
|
|
window->setShade(ShadeNormal);
|
|
|
|
QVERIFY(window->isShade());
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("shaded")), true);
|
2022-04-23 19:51:16 +00:00
|
|
|
window->setShade(ShadeNone);
|
|
|
|
QVERIFY(!window->isShade());
|
2018-12-08 16:06:51 +00:00
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(!window->noBorder());
|
|
|
|
window->setNoBorder(true);
|
|
|
|
QVERIFY(window->noBorder());
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("noBorder")), true);
|
2022-04-23 19:51:16 +00:00
|
|
|
window->setNoBorder(false);
|
|
|
|
QVERIFY(!window->noBorder());
|
2018-12-08 16:06:51 +00:00
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(!window->isFullScreen());
|
|
|
|
window->setFullScreen(true);
|
|
|
|
QVERIFY(window->isFullScreen());
|
|
|
|
QVERIFY(window->clientSize() != windowGeometry.size());
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("fullscreen")), true);
|
2022-04-23 19:51:16 +00:00
|
|
|
reply = getWindowInfo(window->internalId());
|
2018-12-08 16:06:51 +00:00
|
|
|
reply.waitForFinished();
|
2022-04-23 19:51:16 +00:00
|
|
|
QCOMPARE(reply.value().value(QStringLiteral("width")).toInt(), window->width());
|
|
|
|
QCOMPARE(reply.value().value(QStringLiteral("height")).toInt(), window->height());
|
|
|
|
window->setFullScreen(false);
|
|
|
|
QVERIFY(!window->isFullScreen());
|
2018-12-08 16:06:51 +00:00
|
|
|
|
|
|
|
// maximize
|
2022-04-23 19:51:16 +00:00
|
|
|
window->setMaximize(true, false);
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("maximizeVertical")), true);
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("maximizeHorizontal")), false);
|
2022-04-23 19:51:16 +00:00
|
|
|
window->setMaximize(false, true);
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("maximizeVertical")), false);
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("maximizeHorizontal")), true);
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
const auto id = window->internalId();
|
2018-12-08 16:06:51 +00:00
|
|
|
// destroy the window
|
2022-08-01 21:29:02 +00:00
|
|
|
xcb_unmap_window(c.get(), windowId);
|
|
|
|
xcb_flush(c.get());
|
2018-12-08 16:06:51 +00:00
|
|
|
|
2023-03-13 19:21:11 +00:00
|
|
|
QSignalSpy windowClosedSpy(window, &X11Window::closed);
|
2018-12-08 16:06:51 +00:00
|
|
|
QVERIFY(windowClosedSpy.wait());
|
2022-08-01 21:29:02 +00:00
|
|
|
xcb_destroy_window(c.get(), windowId);
|
2018-12-08 16:06:51 +00:00
|
|
|
c.reset();
|
|
|
|
|
|
|
|
reply = getWindowInfo(id);
|
|
|
|
reply.waitForFinished();
|
|
|
|
QVERIFY(reply.value().empty());
|
|
|
|
}
|
|
|
|
|
|
|
|
WAYLANDTEST_MAIN(TestDbusInterface)
|
|
|
|
#include "dbus_interface_test.moc"
|