2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2017-10-07 12:09:07 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2017 Martin Flöser <mgraesslin@kde.org>
|
|
|
|
SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
2017-10-07 12:09:07 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
2017-10-07 12:09:07 +00:00
|
|
|
#include "kwin_wayland_test.h"
|
2019-07-09 17:28:05 +00:00
|
|
|
|
2020-03-04 07:55:26 +00:00
|
|
|
#include "abstract_client.h"
|
2021-08-31 07:03:05 +00:00
|
|
|
#include "abstract_output.h"
|
2019-07-09 17:28:05 +00:00
|
|
|
#include "cursor.h"
|
2017-10-07 12:09:07 +00:00
|
|
|
#include "platform.h"
|
|
|
|
#include "rules.h"
|
|
|
|
#include "virtualdesktops.h"
|
|
|
|
#include "wayland_server.h"
|
2022-02-05 16:38:24 +00:00
|
|
|
#include "waylandoutputconfig.h"
|
2018-02-11 17:27:34 +00:00
|
|
|
#include "workspace.h"
|
2017-10-07 12:09:07 +00:00
|
|
|
|
|
|
|
#include <KWayland/Client/surface.h>
|
|
|
|
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
#include <linux/input.h>
|
|
|
|
|
2017-10-07 12:09:07 +00:00
|
|
|
using namespace KWin;
|
|
|
|
using namespace KWayland::Client;
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
static const QString s_socketName = QStringLiteral("wayland_test_kwin_xdgshellclient_rules-0");
|
2017-10-07 12:09:07 +00:00
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
class TestXdgShellClientRules : public QObject
|
2017-10-07 12:09:07 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
2017-10-07 12:09:07 +00:00
|
|
|
private Q_SLOTS:
|
|
|
|
void initTestCase();
|
|
|
|
void init();
|
|
|
|
void cleanup();
|
|
|
|
|
2019-07-09 17:28:05 +00:00
|
|
|
void testPositionDontAffect();
|
|
|
|
void testPositionApply();
|
|
|
|
void testPositionRemember();
|
|
|
|
void testPositionForce();
|
|
|
|
void testPositionApplyNow();
|
|
|
|
void testPositionForceTemporarily();
|
|
|
|
|
|
|
|
void testSizeDontAffect();
|
|
|
|
void testSizeApply();
|
|
|
|
void testSizeRemember();
|
|
|
|
void testSizeForce();
|
|
|
|
void testSizeApplyNow();
|
|
|
|
void testSizeForceTemporarily();
|
|
|
|
|
2019-07-09 18:07:21 +00:00
|
|
|
void testMaximizeDontAffect();
|
|
|
|
void testMaximizeApply();
|
|
|
|
void testMaximizeRemember();
|
|
|
|
void testMaximizeForce();
|
|
|
|
void testMaximizeApplyNow();
|
|
|
|
void testMaximizeForceTemporarily();
|
|
|
|
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
void testDesktopDontAffect();
|
|
|
|
void testDesktopApply();
|
|
|
|
void testDesktopRemember();
|
|
|
|
void testDesktopForce();
|
|
|
|
void testDesktopApplyNow();
|
|
|
|
void testDesktopForceTemporarily();
|
|
|
|
|
|
|
|
void testMinimizeDontAffect();
|
|
|
|
void testMinimizeApply();
|
|
|
|
void testMinimizeRemember();
|
|
|
|
void testMinimizeForce();
|
|
|
|
void testMinimizeApplyNow();
|
|
|
|
void testMinimizeForceTemporarily();
|
|
|
|
|
|
|
|
void testSkipTaskbarDontAffect();
|
|
|
|
void testSkipTaskbarApply();
|
|
|
|
void testSkipTaskbarRemember();
|
|
|
|
void testSkipTaskbarForce();
|
|
|
|
void testSkipTaskbarApplyNow();
|
|
|
|
void testSkipTaskbarForceTemporarily();
|
|
|
|
|
|
|
|
void testSkipPagerDontAffect();
|
|
|
|
void testSkipPagerApply();
|
|
|
|
void testSkipPagerRemember();
|
|
|
|
void testSkipPagerForce();
|
|
|
|
void testSkipPagerApplyNow();
|
|
|
|
void testSkipPagerForceTemporarily();
|
|
|
|
|
|
|
|
void testSkipSwitcherDontAffect();
|
|
|
|
void testSkipSwitcherApply();
|
|
|
|
void testSkipSwitcherRemember();
|
|
|
|
void testSkipSwitcherForce();
|
|
|
|
void testSkipSwitcherApplyNow();
|
|
|
|
void testSkipSwitcherForceTemporarily();
|
|
|
|
|
|
|
|
void testKeepAboveDontAffect();
|
|
|
|
void testKeepAboveApply();
|
|
|
|
void testKeepAboveRemember();
|
|
|
|
void testKeepAboveForce();
|
|
|
|
void testKeepAboveApplyNow();
|
|
|
|
void testKeepAboveForceTemporarily();
|
|
|
|
|
|
|
|
void testKeepBelowDontAffect();
|
|
|
|
void testKeepBelowApply();
|
|
|
|
void testKeepBelowRemember();
|
|
|
|
void testKeepBelowForce();
|
|
|
|
void testKeepBelowApplyNow();
|
|
|
|
void testKeepBelowForceTemporarily();
|
|
|
|
|
|
|
|
void testShortcutDontAffect();
|
|
|
|
void testShortcutApply();
|
|
|
|
void testShortcutRemember();
|
|
|
|
void testShortcutForce();
|
|
|
|
void testShortcutApplyNow();
|
|
|
|
void testShortcutForceTemporarily();
|
|
|
|
|
|
|
|
void testDesktopFileDontAffect();
|
|
|
|
void testDesktopFileApply();
|
|
|
|
void testDesktopFileRemember();
|
|
|
|
void testDesktopFileForce();
|
|
|
|
void testDesktopFileApplyNow();
|
|
|
|
void testDesktopFileForceTemporarily();
|
|
|
|
|
|
|
|
void testActiveOpacityDontAffect();
|
|
|
|
void testActiveOpacityForce();
|
|
|
|
void testActiveOpacityForceTemporarily();
|
|
|
|
|
|
|
|
void testInactiveOpacityDontAffect();
|
|
|
|
void testInactiveOpacityForce();
|
|
|
|
void testInactiveOpacityForceTemporarily();
|
|
|
|
|
2021-12-11 13:29:35 +00:00
|
|
|
void testNoBorderDontAffect();
|
|
|
|
void testNoBorderApply();
|
|
|
|
void testNoBorderRemember();
|
|
|
|
void testNoBorderForce();
|
|
|
|
void testNoBorderApplyNow();
|
|
|
|
void testNoBorderForceTemporarily();
|
|
|
|
|
2022-02-05 16:38:24 +00:00
|
|
|
void testScreenDontAffect();
|
|
|
|
void testScreenApply();
|
|
|
|
void testScreenRemember();
|
|
|
|
void testScreenForce();
|
|
|
|
void testScreenApplyNow();
|
|
|
|
void testScreenForceTemporarily();
|
|
|
|
|
2018-03-12 17:06:33 +00:00
|
|
|
void testMatchAfterNameChange();
|
2021-12-10 09:17:43 +00:00
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
private:
|
|
|
|
template <typename T> void setWindowRule(const QString &property, const T &value, int policy);
|
|
|
|
|
2021-12-10 09:17:43 +00:00
|
|
|
private:
|
|
|
|
KSharedConfig::Ptr m_config;
|
2017-10-07 12:09:07 +00:00
|
|
|
};
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::initTestCase()
|
2017-10-07 12:09:07 +00:00
|
|
|
{
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
qRegisterMetaType<KWin::AbstractClient *>();
|
2017-10-07 12:09:07 +00:00
|
|
|
|
2020-07-07 09:32:29 +00:00
|
|
|
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
|
|
|
QVERIFY(applicationStartedSpy.isValid());
|
2017-10-07 12:09:07 +00:00
|
|
|
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
2020-12-09 13:06:15 +00:00
|
|
|
QVERIFY(waylandServer()->init(s_socketName));
|
2019-08-26 21:16:53 +00:00
|
|
|
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
2017-10-07 12:09:07 +00:00
|
|
|
|
|
|
|
kwinApp()->start();
|
2020-07-07 09:32:29 +00:00
|
|
|
QVERIFY(applicationStartedSpy.wait());
|
2021-08-31 07:03:05 +00:00
|
|
|
const auto outputs = kwinApp()->platform()->enabledOutputs();
|
|
|
|
QCOMPARE(outputs.count(), 2);
|
|
|
|
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
|
|
|
|
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
|
2021-05-08 00:08:22 +00:00
|
|
|
Test::initWaylandWorkspace();
|
2021-12-10 09:17:43 +00:00
|
|
|
|
|
|
|
m_config = KSharedConfig::openConfig(QStringLiteral("kwinrulesrc"), KConfig::SimpleConfig);
|
|
|
|
RuleBook::self()->setConfig(m_config);
|
2017-10-07 12:09:07 +00:00
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::init()
|
2017-10-07 12:09:07 +00:00
|
|
|
{
|
2017-10-07 15:57:10 +00:00
|
|
|
VirtualDesktopManager::self()->setCurrent(VirtualDesktopManager::self()->desktops().first());
|
2021-12-11 13:29:35 +00:00
|
|
|
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::XdgDecorationV1));
|
2017-10-07 12:09:07 +00:00
|
|
|
|
2021-08-28 18:58:29 +00:00
|
|
|
workspace()->setActiveOutput(QPoint(640, 512));
|
2017-10-07 12:09:07 +00:00
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::cleanup()
|
2017-10-07 12:09:07 +00:00
|
|
|
{
|
|
|
|
Test::destroyWaylandConnection();
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
2021-12-10 09:17:43 +00:00
|
|
|
// Wipe the window rule config clean.
|
|
|
|
for (const QString &group : m_config->groupList()) {
|
|
|
|
m_config->deleteGroup(group);
|
|
|
|
}
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Restore virtual desktops to the initial state.
|
|
|
|
VirtualDesktopManager::self()->setCount(1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->count(), 1u);
|
2017-10-07 12:09:07 +00:00
|
|
|
}
|
|
|
|
|
2021-12-11 13:29:35 +00:00
|
|
|
std::tuple<AbstractClient *, KWayland::Client::Surface *, Test::XdgToplevel *> createWindow(const QString &appId, Test::XdgToplevelDecorationV1::mode decorationMode = Test::XdgToplevelDecorationV1::mode_client_side)
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
|
|
|
// Create an xdg surface.
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface = Test::createSurface();
|
2021-12-09 07:47:55 +00:00
|
|
|
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface, Test::CreationSetup::CreateOnly, surface);
|
2021-12-11 13:29:35 +00:00
|
|
|
Test::XdgToplevelDecorationV1 *decoration = Test::createXdgToplevelDecorationV1(shellSurface, shellSurface);
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->set_app_id(appId);
|
2021-12-11 13:29:35 +00:00
|
|
|
decoration->set_mode(decorationMode);
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Wait for the initial configure event.
|
2021-05-11 05:26:51 +00:00
|
|
|
QSignalSpy configureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
configureRequestedSpy.wait();
|
|
|
|
|
|
|
|
// Draw content of the surface.
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(configureRequestedSpy.last().at(0).value<quint32>());
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
return {client, surface, shellSurface};
|
|
|
|
}
|
2018-02-11 17:27:34 +00:00
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
template <typename T>
|
|
|
|
void TestXdgShellClientRules::setWindowRule(const QString &property, const T &value, int policy)
|
2019-07-09 17:28:05 +00:00
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
2021-12-10 09:17:43 +00:00
|
|
|
m_config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = m_config->group("1");
|
2021-09-02 22:19:43 +00:00
|
|
|
|
|
|
|
group.writeEntry(property, value);
|
|
|
|
group.writeEntry(QStringLiteral("%1rule").arg(property), policy);
|
|
|
|
|
2019-07-09 17:28:05 +00:00
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
2021-09-02 22:19:43 +00:00
|
|
|
|
2019-07-09 17:28:05 +00:00
|
|
|
workspace()->slotReconfigure();
|
2021-09-02 22:19:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TestXdgShellClientRules::testPositionDontAffect()
|
|
|
|
{
|
|
|
|
setWindowRule("position", QPoint(42, 42), int(Rules::DontAffect));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
2019-07-09 17:28:05 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
|
|
|
|
// The position of the client should not be affected by the rule. The default
|
|
|
|
// placement policy will put the client in the top-left corner of the screen.
|
|
|
|
QVERIFY(client->isMovable());
|
|
|
|
QVERIFY(client->isMovableAcrossScreens());
|
|
|
|
QCOMPARE(client->pos(), QPoint(0, 0));
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testPositionApply()
|
2019-07-09 17:28:05 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("position", QPoint(42, 42), int(Rules::Apply));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
2019-07-09 17:28:05 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
|
|
|
|
// The client should be moved to the position specified by the rule.
|
|
|
|
QVERIFY(client->isMovable());
|
|
|
|
QVERIFY(client->isMovableAcrossScreens());
|
|
|
|
QCOMPARE(client->pos(), QPoint(42, 42));
|
|
|
|
|
|
|
|
// One should still be able to move the client around.
|
|
|
|
QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized);
|
|
|
|
QVERIFY(clientStartMoveResizedSpy.isValid());
|
|
|
|
QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized);
|
|
|
|
QVERIFY(clientStepUserMovedResizedSpy.isValid());
|
|
|
|
QSignalSpy clientFinishUserMovedResizedSpy(client, &AbstractClient::clientFinishUserMovedResized);
|
|
|
|
QVERIFY(clientFinishUserMovedResizedSpy.isValid());
|
|
|
|
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), nullptr);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
workspace()->slotWindowMove();
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), client);
|
|
|
|
QCOMPARE(clientStartMoveResizedSpy.count(), 1);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
|
2020-04-02 16:18:01 +00:00
|
|
|
const QPoint cursorPos = KWin::Cursors::self()->mouse()->pos();
|
2019-07-09 17:28:05 +00:00
|
|
|
client->keyPressEvent(Qt::Key_Right);
|
2021-04-30 18:06:58 +00:00
|
|
|
client->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
|
2020-04-02 16:18:01 +00:00
|
|
|
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
|
2019-07-09 17:28:05 +00:00
|
|
|
QCOMPARE(clientStepUserMovedResizedSpy.count(), 1);
|
|
|
|
QCOMPARE(client->pos(), QPoint(50, 42));
|
|
|
|
|
|
|
|
client->keyPressEvent(Qt::Key_Enter);
|
|
|
|
QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1);
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), nullptr);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
QCOMPARE(client->pos(), QPoint(50, 42));
|
|
|
|
|
|
|
|
// The rule should be applied again if the client appears after it's been closed.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
2019-07-09 17:28:05 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(client->isMovable());
|
|
|
|
QVERIFY(client->isMovableAcrossScreens());
|
|
|
|
QCOMPARE(client->pos(), QPoint(42, 42));
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testPositionRemember()
|
2019-07-09 17:28:05 +00:00
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("position", QPoint(42, 42), int(Rules::Remember));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
2019-07-09 17:28:05 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
|
|
|
|
// The client should be moved to the position specified by the rule.
|
|
|
|
QVERIFY(client->isMovable());
|
|
|
|
QVERIFY(client->isMovableAcrossScreens());
|
|
|
|
QCOMPARE(client->pos(), QPoint(42, 42));
|
|
|
|
|
|
|
|
// One should still be able to move the client around.
|
|
|
|
QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized);
|
|
|
|
QVERIFY(clientStartMoveResizedSpy.isValid());
|
|
|
|
QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized);
|
|
|
|
QVERIFY(clientStepUserMovedResizedSpy.isValid());
|
|
|
|
QSignalSpy clientFinishUserMovedResizedSpy(client, &AbstractClient::clientFinishUserMovedResized);
|
|
|
|
QVERIFY(clientFinishUserMovedResizedSpy.isValid());
|
|
|
|
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), nullptr);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
workspace()->slotWindowMove();
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), client);
|
|
|
|
QCOMPARE(clientStartMoveResizedSpy.count(), 1);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
|
2020-04-02 16:18:01 +00:00
|
|
|
const QPoint cursorPos = KWin::Cursors::self()->mouse()->pos();
|
2019-07-09 17:28:05 +00:00
|
|
|
client->keyPressEvent(Qt::Key_Right);
|
2021-04-30 18:06:58 +00:00
|
|
|
client->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
|
2020-04-02 16:18:01 +00:00
|
|
|
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
|
2019-07-09 17:28:05 +00:00
|
|
|
QCOMPARE(clientStepUserMovedResizedSpy.count(), 1);
|
|
|
|
QCOMPARE(client->pos(), QPoint(50, 42));
|
|
|
|
|
|
|
|
client->keyPressEvent(Qt::Key_Enter);
|
|
|
|
QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1);
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), nullptr);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
QCOMPARE(client->pos(), QPoint(50, 42));
|
|
|
|
|
|
|
|
// The client should be placed at the last know position if we reopen it.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
2019-07-09 17:28:05 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(client->isMovable());
|
|
|
|
QVERIFY(client->isMovableAcrossScreens());
|
|
|
|
QCOMPARE(client->pos(), QPoint(50, 42));
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testPositionForce()
|
2019-07-09 17:28:05 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("position", QPoint(42, 42), int(Rules::Force));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
2019-07-09 17:28:05 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
|
|
|
|
// The client should be moved to the position specified by the rule.
|
|
|
|
QVERIFY(!client->isMovable());
|
|
|
|
QVERIFY(!client->isMovableAcrossScreens());
|
|
|
|
QCOMPARE(client->pos(), QPoint(42, 42));
|
|
|
|
|
|
|
|
// User should not be able to move the client.
|
|
|
|
QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized);
|
|
|
|
QVERIFY(clientStartMoveResizedSpy.isValid());
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), nullptr);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
workspace()->slotWindowMove();
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), nullptr);
|
|
|
|
QCOMPARE(clientStartMoveResizedSpy.count(), 0);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// The position should still be forced if we reopen the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
2019-07-09 17:28:05 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(!client->isMovable());
|
|
|
|
QVERIFY(!client->isMovableAcrossScreens());
|
|
|
|
QCOMPARE(client->pos(), QPoint(42, 42));
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testPositionApplyNow()
|
2019-07-09 17:28:05 +00:00
|
|
|
{
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2019-07-09 17:28:05 +00:00
|
|
|
QObject *shellSurface;
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
2019-07-09 17:28:05 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
|
|
|
|
// The position of the client isn't set by any rule, thus the default placement
|
|
|
|
// policy will try to put the client in the top-left corner of the screen.
|
|
|
|
QVERIFY(client->isMovable());
|
|
|
|
QVERIFY(client->isMovableAcrossScreens());
|
|
|
|
QCOMPARE(client->pos(), QPoint(0, 0));
|
|
|
|
|
2020-02-05 09:28:50 +00:00
|
|
|
QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged);
|
|
|
|
QVERIFY(frameGeometryChangedSpy.isValid());
|
2021-09-02 22:19:43 +00:00
|
|
|
|
|
|
|
setWindowRule("position", QPoint(42, 42), int(Rules::ApplyNow));
|
|
|
|
|
|
|
|
// The client should be moved to the position specified by the rule.
|
2020-02-05 09:28:50 +00:00
|
|
|
QCOMPARE(frameGeometryChangedSpy.count(), 1);
|
2019-07-09 17:28:05 +00:00
|
|
|
QCOMPARE(client->pos(), QPoint(42, 42));
|
|
|
|
|
|
|
|
// We still have to be able to move the client around.
|
|
|
|
QVERIFY(client->isMovable());
|
|
|
|
QVERIFY(client->isMovableAcrossScreens());
|
|
|
|
QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized);
|
|
|
|
QVERIFY(clientStartMoveResizedSpy.isValid());
|
|
|
|
QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized);
|
|
|
|
QVERIFY(clientStepUserMovedResizedSpy.isValid());
|
|
|
|
QSignalSpy clientFinishUserMovedResizedSpy(client, &AbstractClient::clientFinishUserMovedResized);
|
|
|
|
QVERIFY(clientFinishUserMovedResizedSpy.isValid());
|
|
|
|
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), nullptr);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
workspace()->slotWindowMove();
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), client);
|
|
|
|
QCOMPARE(clientStartMoveResizedSpy.count(), 1);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
|
2020-04-02 16:18:01 +00:00
|
|
|
const QPoint cursorPos = KWin::Cursors::self()->mouse()->pos();
|
2019-07-09 17:28:05 +00:00
|
|
|
client->keyPressEvent(Qt::Key_Right);
|
2021-04-30 18:06:58 +00:00
|
|
|
client->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
|
2020-04-02 16:18:01 +00:00
|
|
|
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
|
2019-07-09 17:28:05 +00:00
|
|
|
QCOMPARE(clientStepUserMovedResizedSpy.count(), 1);
|
|
|
|
QCOMPARE(client->pos(), QPoint(50, 42));
|
|
|
|
|
|
|
|
client->keyPressEvent(Qt::Key_Enter);
|
|
|
|
QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1);
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), nullptr);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
QCOMPARE(client->pos(), QPoint(50, 42));
|
|
|
|
|
|
|
|
// The rule should not be applied again.
|
|
|
|
client->evaluateWindowRules();
|
|
|
|
QCOMPARE(client->pos(), QPoint(50, 42));
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testPositionForceTemporarily()
|
2019-07-09 17:28:05 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("position", QPoint(42, 42), int(Rules::ForceTemporarily));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
2019-07-09 17:28:05 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
|
|
|
|
// The client should be moved to the position specified by the rule.
|
|
|
|
QVERIFY(!client->isMovable());
|
|
|
|
QVERIFY(!client->isMovableAcrossScreens());
|
|
|
|
QCOMPARE(client->pos(), QPoint(42, 42));
|
|
|
|
|
|
|
|
// User should not be able to move the client.
|
|
|
|
QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized);
|
|
|
|
QVERIFY(clientStartMoveResizedSpy.isValid());
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), nullptr);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
workspace()->slotWindowMove();
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), nullptr);
|
|
|
|
QCOMPARE(clientStartMoveResizedSpy.count(), 0);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// The rule should be discarded if we close the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
2019-07-09 17:28:05 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(client->isMovable());
|
|
|
|
QVERIFY(client->isMovableAcrossScreens());
|
|
|
|
QCOMPARE(client->pos(), QPoint(0, 0));
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSizeDontAffect()
|
2019-07-09 17:28:05 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("size", QSize(480, 640), int(Rules::DontAffect));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2021-09-03 17:54:03 +00:00
|
|
|
QScopedPointer<KWayland::Client::Surface> surface;
|
2019-07-09 17:28:05 +00:00
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<QSignalSpy> toplevelConfigureRequestedSpy;
|
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
QScopedPointer<QSignalSpy> surfaceConfigureRequestedSpy;
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// The window size shouldn't be enforced by the rule.
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().first().toSize(), QSize(0, 0));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Map the client.
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
2019-07-09 17:28:05 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(client->isResizable());
|
|
|
|
QCOMPARE(client->size(), QSize(100, 50));
|
|
|
|
|
|
|
|
// We should receive a configure event when the client becomes active.
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSizeApply()
|
2019-07-09 17:28:05 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("size", QSize(480, 640), int(Rules::Apply));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2021-09-03 17:54:03 +00:00
|
|
|
QScopedPointer<KWayland::Client::Surface> surface;
|
2019-07-09 17:28:05 +00:00
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<QSignalSpy> toplevelConfigureRequestedSpy;
|
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
QScopedPointer<QSignalSpy> surfaceConfigureRequestedSpy;
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// The initial configure event should contain size hint set by the rule.
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel::States states;
|
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().at(0).toSize(), QSize(480, 640));
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Resizing));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Map the client.
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue);
|
2019-07-09 17:28:05 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(client->isResizable());
|
|
|
|
QCOMPARE(client->size(), QSize(480, 640));
|
|
|
|
|
|
|
|
// We should receive a configure event when the client becomes active.
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Resizing));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// One still should be able to resize the client.
|
2020-02-05 09:28:50 +00:00
|
|
|
QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged);
|
|
|
|
QVERIFY(frameGeometryChangedSpy.isValid());
|
2019-07-09 17:28:05 +00:00
|
|
|
QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized);
|
|
|
|
QVERIFY(clientStartMoveResizedSpy.isValid());
|
|
|
|
QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized);
|
|
|
|
QVERIFY(clientStepUserMovedResizedSpy.isValid());
|
|
|
|
QSignalSpy clientFinishUserMovedResizedSpy(client, &AbstractClient::clientFinishUserMovedResized);
|
|
|
|
QVERIFY(clientFinishUserMovedResizedSpy.isValid());
|
|
|
|
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), nullptr);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
workspace()->slotWindowResize();
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), client);
|
|
|
|
QCOMPARE(clientStartMoveResizedSpy.count(), 1);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(client->isInteractiveResize());
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 3);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 3);
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Resizing));
|
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2019-07-09 17:28:05 +00:00
|
|
|
|
2020-04-02 16:18:01 +00:00
|
|
|
const QPoint cursorPos = KWin::Cursors::self()->mouse()->pos();
|
2019-07-09 17:28:05 +00:00
|
|
|
client->keyPressEvent(Qt::Key_Right);
|
2021-04-30 18:06:58 +00:00
|
|
|
client->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
|
2020-04-02 16:18:01 +00:00
|
|
|
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 4);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 4);
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Resizing));
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().at(0).toSize(), QSize(488, 640));
|
2021-12-24 09:20:00 +00:00
|
|
|
QCOMPARE(clientStepUserMovedResizedSpy.count(), 1);
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2019-07-09 17:28:05 +00:00
|
|
|
Test::render(surface.data(), QSize(488, 640), Qt::blue);
|
2020-02-05 09:28:50 +00:00
|
|
|
QVERIFY(frameGeometryChangedSpy.wait());
|
2019-07-09 17:28:05 +00:00
|
|
|
QCOMPARE(client->size(), QSize(488, 640));
|
|
|
|
QCOMPARE(clientStepUserMovedResizedSpy.count(), 1);
|
|
|
|
|
|
|
|
client->keyPressEvent(Qt::Key_Enter);
|
|
|
|
QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1);
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), nullptr);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
|
2021-10-07 19:40:35 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
2021-05-11 05:26:51 +00:00
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 5);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 5);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// The rule should be applied again if the client appears after it's been closed.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
surface.reset(Test::createSurface());
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().first().toSize(), QSize(480, 640));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2019-07-09 17:28:05 +00:00
|
|
|
client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue);
|
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(client->isResizable());
|
|
|
|
QCOMPARE(client->size(), QSize(480, 640));
|
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSizeRemember()
|
2019-07-09 17:28:05 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("size", QSize(480, 640), int(Rules::Remember));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2021-09-03 17:54:03 +00:00
|
|
|
QScopedPointer<KWayland::Client::Surface> surface;
|
2019-07-09 17:28:05 +00:00
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<QSignalSpy> toplevelConfigureRequestedSpy;
|
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
QScopedPointer<QSignalSpy> surfaceConfigureRequestedSpy;
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// The initial configure event should contain size hint set by the rule.
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel::States states;
|
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().first().toSize(), QSize(480, 640));
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Resizing));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Map the client.
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue);
|
2019-07-09 17:28:05 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(client->isResizable());
|
|
|
|
QCOMPARE(client->size(), QSize(480, 640));
|
|
|
|
|
|
|
|
// We should receive a configure event when the client becomes active.
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Resizing));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// One should still be able to resize the client.
|
2020-02-05 09:28:50 +00:00
|
|
|
QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged);
|
|
|
|
QVERIFY(frameGeometryChangedSpy.isValid());
|
2019-07-09 17:28:05 +00:00
|
|
|
QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized);
|
|
|
|
QVERIFY(clientStartMoveResizedSpy.isValid());
|
|
|
|
QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized);
|
|
|
|
QVERIFY(clientStepUserMovedResizedSpy.isValid());
|
|
|
|
QSignalSpy clientFinishUserMovedResizedSpy(client, &AbstractClient::clientFinishUserMovedResized);
|
|
|
|
QVERIFY(clientFinishUserMovedResizedSpy.isValid());
|
|
|
|
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), nullptr);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
workspace()->slotWindowResize();
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), client);
|
|
|
|
QCOMPARE(clientStartMoveResizedSpy.count(), 1);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(client->isInteractiveResize());
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 3);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 3);
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Resizing));
|
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2019-07-09 17:28:05 +00:00
|
|
|
|
2020-04-02 16:18:01 +00:00
|
|
|
const QPoint cursorPos = KWin::Cursors::self()->mouse()->pos();
|
2019-07-09 17:28:05 +00:00
|
|
|
client->keyPressEvent(Qt::Key_Right);
|
2021-04-30 18:06:58 +00:00
|
|
|
client->updateInteractiveMoveResize(KWin::Cursors::self()->mouse()->pos());
|
2020-04-02 16:18:01 +00:00
|
|
|
QCOMPARE(KWin::Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 4);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 4);
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Resizing));
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().at(0).toSize(), QSize(488, 640));
|
2021-12-24 09:20:00 +00:00
|
|
|
QCOMPARE(clientStepUserMovedResizedSpy.count(), 1);
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2019-07-09 17:28:05 +00:00
|
|
|
Test::render(surface.data(), QSize(488, 640), Qt::blue);
|
2020-02-05 09:28:50 +00:00
|
|
|
QVERIFY(frameGeometryChangedSpy.wait());
|
2019-07-09 17:28:05 +00:00
|
|
|
QCOMPARE(client->size(), QSize(488, 640));
|
|
|
|
QCOMPARE(clientStepUserMovedResizedSpy.count(), 1);
|
|
|
|
|
|
|
|
client->keyPressEvent(Qt::Key_Enter);
|
|
|
|
QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1);
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), nullptr);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
|
2021-10-07 19:40:35 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
2021-05-11 05:26:51 +00:00
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 5);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 5);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// If the client appears again, it should have the last known size.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
surface.reset(Test::createSurface());
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().first().toSize(), QSize(488, 640));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2019-07-09 17:28:05 +00:00
|
|
|
client = Test::renderAndWaitForShown(surface.data(), QSize(488, 640), Qt::blue);
|
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(client->isResizable());
|
|
|
|
QCOMPARE(client->size(), QSize(488, 640));
|
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSizeForce()
|
2019-07-09 17:28:05 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("size", QSize(480, 640), int(Rules::Force));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2021-09-03 17:54:03 +00:00
|
|
|
QScopedPointer<KWayland::Client::Surface> surface;
|
2019-07-09 17:28:05 +00:00
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<QSignalSpy> toplevelConfigureRequestedSpy;
|
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
QScopedPointer<QSignalSpy> surfaceConfigureRequestedSpy;
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// The initial configure event should contain size hint set by the rule.
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().first().toSize(), QSize(480, 640));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Map the client.
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue);
|
2019-07-09 17:28:05 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(!client->isResizable());
|
|
|
|
QCOMPARE(client->size(), QSize(480, 640));
|
|
|
|
|
|
|
|
// We should receive a configure event when the client becomes active.
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Any attempt to resize the client should not succeed.
|
|
|
|
QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized);
|
|
|
|
QVERIFY(clientStartMoveResizedSpy.isValid());
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), nullptr);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
workspace()->slotWindowResize();
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), nullptr);
|
|
|
|
QCOMPARE(clientStartMoveResizedSpy.count(), 0);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(!surfaceConfigureRequestedSpy->wait(100));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// If the client appears again, the size should still be forced.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
surface.reset(Test::createSurface());
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().first().toSize(), QSize(480, 640));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2019-07-09 17:28:05 +00:00
|
|
|
client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue);
|
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(!client->isResizable());
|
|
|
|
QCOMPARE(client->size(), QSize(480, 640));
|
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSizeApplyNow()
|
2019-07-09 17:28:05 +00:00
|
|
|
{
|
|
|
|
// Create the test client.
|
2021-09-03 17:54:03 +00:00
|
|
|
QScopedPointer<KWayland::Client::Surface> surface;
|
2019-07-09 17:28:05 +00:00
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<QSignalSpy> toplevelConfigureRequestedSpy;
|
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
QScopedPointer<QSignalSpy> surfaceConfigureRequestedSpy;
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// The expected surface dimensions should be set by the rule.
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().first().toSize(), QSize(0, 0));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Map the client.
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
2019-07-09 17:28:05 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(client->isResizable());
|
|
|
|
QCOMPARE(client->size(), QSize(100, 50));
|
|
|
|
|
|
|
|
// We should receive a configure event when the client becomes active.
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("size", QSize(480, 640), int(Rules::ApplyNow));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// The compositor should send a configure event with a new size.
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 3);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 3);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().first().toSize(), QSize(480, 640));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Draw the surface with the new size.
|
2020-02-05 09:28:50 +00:00
|
|
|
QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged);
|
|
|
|
QVERIFY(frameGeometryChangedSpy.isValid());
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2019-07-09 17:28:05 +00:00
|
|
|
Test::render(surface.data(), QSize(480, 640), Qt::blue);
|
2020-02-05 09:28:50 +00:00
|
|
|
QVERIFY(frameGeometryChangedSpy.wait());
|
2019-07-09 17:28:05 +00:00
|
|
|
QCOMPARE(client->size(), QSize(480, 640));
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(!surfaceConfigureRequestedSpy->wait(100));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// The rule should not be applied again.
|
|
|
|
client->evaluateWindowRules();
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(!surfaceConfigureRequestedSpy->wait(100));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSizeForceTemporarily()
|
2019-07-09 17:28:05 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("size", QSize(480, 640), int(Rules::ForceTemporarily));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2021-09-03 17:54:03 +00:00
|
|
|
QScopedPointer<KWayland::Client::Surface> surface;
|
2019-07-09 17:28:05 +00:00
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<QSignalSpy> toplevelConfigureRequestedSpy;
|
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
QScopedPointer<QSignalSpy> surfaceConfigureRequestedSpy;
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// The initial configure event should contain size hint set by the rule.
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().first().toSize(), QSize(480, 640));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Map the client.
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue);
|
2019-07-09 17:28:05 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(!client->isResizable());
|
|
|
|
QCOMPARE(client->size(), QSize(480, 640));
|
|
|
|
|
|
|
|
// We should receive a configure event when the client becomes active.
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Any attempt to resize the client should not succeed.
|
|
|
|
QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized);
|
|
|
|
QVERIFY(clientStartMoveResizedSpy.isValid());
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), nullptr);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2019-07-09 17:28:05 +00:00
|
|
|
workspace()->slotWindowResize();
|
|
|
|
QCOMPARE(workspace()->moveResizeClient(), nullptr);
|
|
|
|
QCOMPARE(clientStartMoveResizedSpy.count(), 0);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!client->isInteractiveMove());
|
|
|
|
QVERIFY(!client->isInteractiveResize());
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(!surfaceConfigureRequestedSpy->wait(100));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// The rule should be discarded when the client is closed.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
surface.reset(Test::createSurface());
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().first().toSize(), QSize(0, 0));
|
2019-07-09 17:28:05 +00:00
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2019-07-09 17:28:05 +00:00
|
|
|
client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(client->isResizable());
|
|
|
|
QCOMPARE(client->size(), QSize(100, 50));
|
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
2019-07-09 17:28:05 +00:00
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testMaximizeDontAffect()
|
2019-07-09 18:07:21 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("maximizehoriz", true, int(Rules::DontAffect));
|
|
|
|
setWindowRule("maximizevert", true, int(Rules::DontAffect));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2021-09-03 17:54:03 +00:00
|
|
|
QScopedPointer<KWayland::Client::Surface> surface;
|
2019-07-09 18:07:21 +00:00
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<QSignalSpy> toplevelConfigureRequestedSpy;
|
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
QScopedPointer<QSignalSpy> surfaceConfigureRequestedSpy;
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Wait for the initial configure event.
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel::States states;
|
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().at(0).toSize(), QSize(0, 0));
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Map the client.
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
2019-07-09 18:07:21 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(client->isMaximizable());
|
|
|
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore);
|
|
|
|
QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore);
|
|
|
|
QCOMPARE(client->size(), QSize(100, 50));
|
|
|
|
|
|
|
|
// We should receive a configure event when the client becomes active.
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testMaximizeApply()
|
2019-07-09 18:07:21 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("maximizehoriz", true, int(Rules::Apply));
|
|
|
|
setWindowRule("maximizevert", true, int(Rules::Apply));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2021-09-03 17:54:03 +00:00
|
|
|
QScopedPointer<KWayland::Client::Surface> surface;
|
2019-07-09 18:07:21 +00:00
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<QSignalSpy> toplevelConfigureRequestedSpy;
|
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
QScopedPointer<QSignalSpy> surfaceConfigureRequestedSpy;
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Wait for the initial configure event.
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel::States states;
|
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024));
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Map the client.
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue);
|
2019-07-09 18:07:21 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(client->isMaximizable());
|
|
|
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull);
|
|
|
|
QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull);
|
|
|
|
QCOMPARE(client->size(), QSize(1280, 1024));
|
|
|
|
|
|
|
|
// We should receive a configure event when the client becomes active.
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// One should still be able to change the maximized state of the client.
|
|
|
|
workspace()->slotWindowMaximize();
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 3);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 3);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().at(0).toSize(), QSize(0, 0));
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
2020-02-05 09:28:50 +00:00
|
|
|
QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged);
|
|
|
|
QVERIFY(frameGeometryChangedSpy.isValid());
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2019-07-09 18:07:21 +00:00
|
|
|
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
2020-02-05 09:28:50 +00:00
|
|
|
QVERIFY(frameGeometryChangedSpy.wait());
|
2019-07-09 18:07:21 +00:00
|
|
|
QCOMPARE(client->size(), QSize(100, 50));
|
|
|
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore);
|
|
|
|
QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore);
|
|
|
|
|
|
|
|
// If we create the client again, it should be initially maximized.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
surface.reset(Test::createSurface());
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 18:07:21 +00:00
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024));
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2019-07-09 18:07:21 +00:00
|
|
|
client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue);
|
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(client->isMaximizable());
|
|
|
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull);
|
|
|
|
QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull);
|
|
|
|
QCOMPARE(client->size(), QSize(1280, 1024));
|
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testMaximizeRemember()
|
2019-07-09 18:07:21 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("maximizehoriz", true, int(Rules::Remember));
|
|
|
|
setWindowRule("maximizevert", true, int(Rules::Remember));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2021-09-03 17:54:03 +00:00
|
|
|
QScopedPointer<KWayland::Client::Surface> surface;
|
2019-07-09 18:07:21 +00:00
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<QSignalSpy> toplevelConfigureRequestedSpy;
|
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
QScopedPointer<QSignalSpy> surfaceConfigureRequestedSpy;
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Wait for the initial configure event.
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel::States states;
|
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024));
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Map the client.
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue);
|
2019-07-09 18:07:21 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(client->isMaximizable());
|
|
|
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull);
|
|
|
|
QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull);
|
|
|
|
QCOMPARE(client->size(), QSize(1280, 1024));
|
|
|
|
|
|
|
|
// We should receive a configure event when the client becomes active.
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// One should still be able to change the maximized state of the client.
|
|
|
|
workspace()->slotWindowMaximize();
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 3);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 3);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().at(0).toSize(), QSize(0, 0));
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
2020-02-05 09:28:50 +00:00
|
|
|
QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged);
|
|
|
|
QVERIFY(frameGeometryChangedSpy.isValid());
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2019-07-09 18:07:21 +00:00
|
|
|
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
2020-02-05 09:28:50 +00:00
|
|
|
QVERIFY(frameGeometryChangedSpy.wait());
|
2019-07-09 18:07:21 +00:00
|
|
|
QCOMPARE(client->size(), QSize(100, 50));
|
|
|
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore);
|
|
|
|
QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore);
|
|
|
|
|
|
|
|
// If we create the client again, it should not be maximized (because last time it wasn't).
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
surface.reset(Test::createSurface());
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 18:07:21 +00:00
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().at(0).toSize(), QSize(0, 0));
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2019-07-09 18:07:21 +00:00
|
|
|
client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(client->isMaximizable());
|
|
|
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore);
|
|
|
|
QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore);
|
|
|
|
QCOMPARE(client->size(), QSize(100, 50));
|
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testMaximizeForce()
|
2019-07-09 18:07:21 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("maximizehoriz", true, int(Rules::Force));
|
|
|
|
setWindowRule("maximizevert", true, int(Rules::Force));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2021-09-03 17:54:03 +00:00
|
|
|
QScopedPointer<KWayland::Client::Surface> surface;
|
2019-07-09 18:07:21 +00:00
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<QSignalSpy> toplevelConfigureRequestedSpy;
|
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
QScopedPointer<QSignalSpy> surfaceConfigureRequestedSpy;
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Wait for the initial configure event.
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel::States states;
|
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024));
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Map the client.
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue);
|
2019-07-09 18:07:21 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(!client->isMaximizable());
|
|
|
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull);
|
|
|
|
QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull);
|
|
|
|
QCOMPARE(client->size(), QSize(1280, 1024));
|
|
|
|
|
|
|
|
// We should receive a configure event when the client becomes active.
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Any attempt to change the maximized state should not succeed.
|
2019-09-27 10:01:10 +00:00
|
|
|
const QRect oldGeometry = client->frameGeometry();
|
2019-07-09 18:07:21 +00:00
|
|
|
workspace()->slotWindowMaximize();
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(!surfaceConfigureRequestedSpy->wait(100));
|
2019-07-09 18:07:21 +00:00
|
|
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull);
|
|
|
|
QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull);
|
2019-09-27 10:01:10 +00:00
|
|
|
QCOMPARE(client->frameGeometry(), oldGeometry);
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// If we create the client again, the maximized state should still be forced.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
surface.reset(Test::createSurface());
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 18:07:21 +00:00
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024));
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2019-07-09 18:07:21 +00:00
|
|
|
client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue);
|
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(!client->isMaximizable());
|
|
|
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull);
|
|
|
|
QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull);
|
|
|
|
QCOMPARE(client->size(), QSize(1280, 1024));
|
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testMaximizeApplyNow()
|
2019-07-09 18:07:21 +00:00
|
|
|
{
|
|
|
|
// Create the test client.
|
2021-09-03 17:54:03 +00:00
|
|
|
QScopedPointer<KWayland::Client::Surface> surface;
|
2019-07-09 18:07:21 +00:00
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<QSignalSpy> toplevelConfigureRequestedSpy;
|
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
QScopedPointer<QSignalSpy> surfaceConfigureRequestedSpy;
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Wait for the initial configure event.
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel::States states;
|
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().at(0).toSize(), QSize(0, 0));
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Map the client.
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
2019-07-09 18:07:21 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(client->isMaximizable());
|
|
|
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore);
|
|
|
|
QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore);
|
|
|
|
QCOMPARE(client->size(), QSize(100, 50));
|
|
|
|
|
|
|
|
// We should receive a configure event when the client becomes active.
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("maximizehoriz", true, int(Rules::ApplyNow));
|
|
|
|
setWindowRule("maximizevert", true, int(Rules::ApplyNow));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// We should receive a configure event with a new surface size.
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 3);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 3);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024));
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Draw contents of the maximized client.
|
2020-02-05 09:28:50 +00:00
|
|
|
QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged);
|
|
|
|
QVERIFY(frameGeometryChangedSpy.isValid());
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2019-07-09 18:07:21 +00:00
|
|
|
Test::render(surface.data(), QSize(1280, 1024), Qt::blue);
|
2020-02-05 09:28:50 +00:00
|
|
|
QVERIFY(frameGeometryChangedSpy.wait());
|
2019-07-09 18:07:21 +00:00
|
|
|
QCOMPARE(client->size(), QSize(1280, 1024));
|
|
|
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull);
|
|
|
|
QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull);
|
|
|
|
|
|
|
|
// The client still has to be maximizeable.
|
|
|
|
QVERIFY(client->isMaximizable());
|
|
|
|
|
|
|
|
// Restore the client.
|
|
|
|
workspace()->slotWindowMaximize();
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 4);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 4);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().at(0).toSize(), QSize(100, 50));
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
|
|
|
|
|
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2019-07-09 18:07:21 +00:00
|
|
|
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
2020-02-05 09:28:50 +00:00
|
|
|
QVERIFY(frameGeometryChangedSpy.wait());
|
2019-07-09 18:07:21 +00:00
|
|
|
QCOMPARE(client->size(), QSize(100, 50));
|
|
|
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore);
|
|
|
|
QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore);
|
|
|
|
|
|
|
|
// The rule should be discarded after it's been applied.
|
2019-09-27 10:01:10 +00:00
|
|
|
const QRect oldGeometry = client->frameGeometry();
|
2019-07-09 18:07:21 +00:00
|
|
|
client->evaluateWindowRules();
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(!surfaceConfigureRequestedSpy->wait(100));
|
2019-07-09 18:07:21 +00:00
|
|
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore);
|
|
|
|
QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore);
|
2019-09-27 10:01:10 +00:00
|
|
|
QCOMPARE(client->frameGeometry(), oldGeometry);
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testMaximizeForceTemporarily()
|
2019-07-09 18:07:21 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("maximizehoriz", true, int(Rules::ForceTemporarily));
|
|
|
|
setWindowRule("maximizevert", true, int(Rules::ForceTemporarily));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2021-09-03 17:54:03 +00:00
|
|
|
QScopedPointer<KWayland::Client::Surface> surface;
|
2019-07-09 18:07:21 +00:00
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<QSignalSpy> toplevelConfigureRequestedSpy;
|
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
QScopedPointer<QSignalSpy> surfaceConfigureRequestedSpy;
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Wait for the initial configure event.
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel::States states;
|
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024));
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Map the client.
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue);
|
2019-07-09 18:07:21 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(!client->isMaximizable());
|
|
|
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull);
|
|
|
|
QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull);
|
|
|
|
QCOMPARE(client->size(), QSize(1280, 1024));
|
|
|
|
|
|
|
|
// We should receive a configure event when the client becomes active.
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Any attempt to change the maximized state should not succeed.
|
2019-09-27 10:01:10 +00:00
|
|
|
const QRect oldGeometry = client->frameGeometry();
|
2019-07-09 18:07:21 +00:00
|
|
|
workspace()->slotWindowMaximize();
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(!surfaceConfigureRequestedSpy->wait(100));
|
2019-07-09 18:07:21 +00:00
|
|
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull);
|
|
|
|
QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull);
|
2019-09-27 10:01:10 +00:00
|
|
|
QCOMPARE(client->frameGeometry(), oldGeometry);
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// The rule should be discarded if we close the client.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
surface.reset(Test::createSurface());
|
2021-12-09 07:47:55 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly));
|
2021-05-11 05:26:51 +00:00
|
|
|
toplevelConfigureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested));
|
|
|
|
surfaceConfigureRequestedSpy.reset(new QSignalSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2021-09-03 17:54:03 +00:00
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
2019-07-09 18:07:21 +00:00
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->last().at(0).toSize(), QSize(0, 0));
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy->last().at(0).value<quint32>());
|
2019-07-09 18:07:21 +00:00
|
|
|
client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QVERIFY(client->isMaximizable());
|
|
|
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore);
|
|
|
|
QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore);
|
|
|
|
QCOMPARE(client->size(), QSize(100, 50));
|
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy->count(), 2);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy->count(), 2);
|
|
|
|
states = toplevelConfigureRequestedSpy->last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
|
2019-07-09 18:07:21 +00:00
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testDesktopDontAffect()
|
2017-10-07 12:09:07 +00:00
|
|
|
{
|
2021-08-13 19:49:10 +00:00
|
|
|
// We need at least two virtual desktop for this test.
|
|
|
|
VirtualDesktopManager::self()->setCount(2);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->count(), 2u);
|
|
|
|
VirtualDesktopManager::self()->setCurrent(1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 1);
|
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("desktops", QStringList{VirtualDesktopManager::self()->desktopForX11Id(2)->id()}, int(Rules::DontAffect));
|
2017-10-07 12:09:07 +00:00
|
|
|
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should appear on the current virtual desktop.
|
|
|
|
QCOMPARE(client->desktop(), 1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 1);
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
2017-10-07 12:09:07 +00:00
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testDesktopApply()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-08-13 19:49:10 +00:00
|
|
|
// We need at least two virtual desktop for this test.
|
|
|
|
VirtualDesktopManager::self()->setCount(2);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->count(), 2u);
|
|
|
|
VirtualDesktopManager::self()->setCurrent(1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 1);
|
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("desktops", QStringList{VirtualDesktopManager::self()->desktopForX11Id(2)->id()}, int(Rules::Apply));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should appear on the second virtual desktop.
|
|
|
|
QCOMPARE(client->desktop(), 2);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 2);
|
|
|
|
|
|
|
|
// We still should be able to move the client between desktops.
|
|
|
|
workspace()->sendClientToDesktop(client, 1, true);
|
|
|
|
QCOMPARE(client->desktop(), 1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 2);
|
|
|
|
|
|
|
|
// If we re-open the client, it should appear on the second virtual desktop again.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
VirtualDesktopManager::self()->setCurrent(1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 1);
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QCOMPARE(client->desktop(), 2);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 2);
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2017-10-07 15:57:10 +00:00
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testDesktopRemember()
|
2017-10-07 15:57:10 +00:00
|
|
|
{
|
2021-08-13 19:49:10 +00:00
|
|
|
// We need at least two virtual desktop for this test.
|
|
|
|
VirtualDesktopManager::self()->setCount(2);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->count(), 2u);
|
|
|
|
VirtualDesktopManager::self()->setCurrent(1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 1);
|
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("desktops", QStringList{VirtualDesktopManager::self()->desktopForX11Id(2)->id()}, int(Rules::Remember));
|
2017-10-07 15:57:10 +00:00
|
|
|
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QCOMPARE(client->desktop(), 2);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 2);
|
|
|
|
|
|
|
|
// Move the client to the first virtual desktop.
|
|
|
|
workspace()->sendClientToDesktop(client, 1, true);
|
|
|
|
QCOMPARE(client->desktop(), 1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 2);
|
|
|
|
|
|
|
|
// If we create the client again, it should appear on the first virtual desktop.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QCOMPARE(client->desktop(), 1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 1);
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
2017-10-07 15:57:10 +00:00
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testDesktopForce()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-08-13 19:49:10 +00:00
|
|
|
// We need at least two virtual desktop for this test.
|
|
|
|
VirtualDesktopManager::self()->setCount(2);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->count(), 2u);
|
|
|
|
VirtualDesktopManager::self()->setCurrent(1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 1);
|
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("desktops", QStringList{VirtualDesktopManager::self()->desktopForX11Id(2)->id()}, int(Rules::Force));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should appear on the second virtual desktop.
|
|
|
|
QCOMPARE(client->desktop(), 2);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 2);
|
|
|
|
|
|
|
|
// Any attempt to move the client to another virtual desktop should fail.
|
|
|
|
workspace()->sendClientToDesktop(client, 1, true);
|
|
|
|
QCOMPARE(client->desktop(), 2);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 2);
|
|
|
|
|
|
|
|
// If we re-open the client, it should appear on the second virtual desktop again.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
VirtualDesktopManager::self()->setCurrent(1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 1);
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QCOMPARE(client->desktop(), 2);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 2);
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2018-01-13 18:58:43 +00:00
|
|
|
}
|
2017-10-07 15:57:10 +00:00
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testDesktopApplyNow()
|
2018-01-13 18:58:43 +00:00
|
|
|
{
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
// We need at least two virtual desktop for this test.
|
|
|
|
VirtualDesktopManager::self()->setCount(2);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->count(), 2u);
|
|
|
|
VirtualDesktopManager::self()->setCurrent(1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 1);
|
2018-01-13 18:58:43 +00:00
|
|
|
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QCOMPARE(client->desktop(), 1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 1);
|
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("desktops", QStringList{VirtualDesktopManager::self()->desktopForX11Id(2)->id()}, int(Rules::ApplyNow));
|
2018-01-13 18:58:43 +00:00
|
|
|
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
// The client should have been moved to the second virtual desktop.
|
|
|
|
QCOMPARE(client->desktop(), 2);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 1);
|
|
|
|
|
|
|
|
// One should still be able to move the client between desktops.
|
|
|
|
workspace()->sendClientToDesktop(client, 1, true);
|
|
|
|
QCOMPARE(client->desktop(), 1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 1);
|
|
|
|
|
|
|
|
// The rule should not be applied again.
|
|
|
|
client->evaluateWindowRules();
|
|
|
|
QCOMPARE(client->desktop(), 1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 1);
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2017-10-07 15:57:10 +00:00
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testDesktopForceTemporarily()
|
2017-10-07 15:57:10 +00:00
|
|
|
{
|
2021-08-13 19:49:10 +00:00
|
|
|
// We need at least two virtual desktop for this test.
|
|
|
|
VirtualDesktopManager::self()->setCount(2);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->count(), 2u);
|
|
|
|
VirtualDesktopManager::self()->setCurrent(1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 1);
|
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("desktops", QStringList{VirtualDesktopManager::self()->desktopForX11Id(2)->id()}, int(Rules::ForceTemporarily));
|
2018-01-13 18:58:43 +00:00
|
|
|
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should appear on the second virtual desktop.
|
|
|
|
QCOMPARE(client->desktop(), 2);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 2);
|
|
|
|
|
|
|
|
// Any attempt to move the client to another virtual desktop should fail.
|
|
|
|
workspace()->sendClientToDesktop(client, 1, true);
|
|
|
|
QCOMPARE(client->desktop(), 2);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 2);
|
|
|
|
|
|
|
|
// The rule should be discarded when the client is withdrawn.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
VirtualDesktopManager::self()->setCurrent(1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 1);
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QCOMPARE(client->desktop(), 1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 1);
|
|
|
|
|
|
|
|
// One should be able to move the client between desktops.
|
|
|
|
workspace()->sendClientToDesktop(client, 2, true);
|
|
|
|
QCOMPARE(client->desktop(), 2);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 1);
|
|
|
|
workspace()->sendClientToDesktop(client, 1, true);
|
|
|
|
QCOMPARE(client->desktop(), 1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 1);
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
2018-01-13 18:58:43 +00:00
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testMinimizeDontAffect()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("minimize", true, int(Rules::DontAffect));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isMinimizable());
|
|
|
|
|
|
|
|
// The client should not be minimized.
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2018-01-13 18:58:43 +00:00
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testMinimizeApply()
|
2018-01-13 18:58:43 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("minimize", true, int(Rules::Apply));
|
2017-10-07 15:57:10 +00:00
|
|
|
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isMinimizable());
|
|
|
|
|
|
|
|
// The client should be minimized.
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
|
|
|
|
// We should still be able to unminimize the client.
|
|
|
|
client->unminimize();
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
|
|
|
// If we re-open the client, it should be minimized back again.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isMinimizable());
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
2017-10-07 15:57:10 +00:00
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testMinimizeRemember()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("minimize", false, int(Rules::Remember));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isMinimizable());
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
|
|
|
// Minimize the client.
|
|
|
|
client->minimize();
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
|
|
|
|
// If we open the client again, it should be minimized.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isMinimizable());
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2018-01-14 08:45:02 +00:00
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testMinimizeForce()
|
2018-01-14 08:45:02 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("minimize", false, int(Rules::Force));
|
2018-01-14 08:45:02 +00:00
|
|
|
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(!client->isMinimizable());
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
|
|
|
// Any attempt to minimize the client should fail.
|
|
|
|
client->minimize();
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
|
|
|
// If we re-open the client, the minimized state should still be forced.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(!client->isMinimizable());
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
client->minimize();
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
2018-01-14 08:45:02 +00:00
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testMinimizeApplyNow()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isMinimizable());
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("minimize", true, int(Rules::ApplyNow));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// The client should be minimized now.
|
|
|
|
QVERIFY(client->isMinimizable());
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
|
|
|
|
// One is still able to unminimize the client.
|
|
|
|
client->unminimize();
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
|
|
|
// The rule should not be applied again.
|
|
|
|
client->evaluateWindowRules();
|
|
|
|
QVERIFY(client->isMinimizable());
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2018-01-14 08:45:02 +00:00
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testMinimizeForceTemporarily()
|
2018-01-14 08:45:02 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("minimize", false, int(Rules::ForceTemporarily));
|
2018-01-14 08:45:02 +00:00
|
|
|
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(!client->isMinimizable());
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
|
|
|
// Any attempt to minimize the client should fail until the client is closed.
|
|
|
|
client->minimize();
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
|
|
|
// The rule should be discarded when the client is closed.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isMinimizable());
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
client->minimize();
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2018-01-14 13:51:37 +00:00
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSkipTaskbarDontAffect()
|
2018-01-14 13:51:37 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("skiptaskbar", true, int(Rules::DontAffect));
|
2018-01-14 13:51:37 +00:00
|
|
|
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should not be affected by the rule.
|
|
|
|
QVERIFY(!client->skipTaskbar());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
2018-01-14 13:51:37 +00:00
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSkipTaskbarApply()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("skiptaskbar", true, int(Rules::Apply));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should not be included on a taskbar.
|
|
|
|
QVERIFY(client->skipTaskbar());
|
|
|
|
|
|
|
|
// Though one can change that.
|
|
|
|
client->setOriginalSkipTaskbar(false);
|
|
|
|
QVERIFY(!client->skipTaskbar());
|
|
|
|
|
|
|
|
// Reopen the client, the rule should be applied again.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->skipTaskbar());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2017-10-07 12:09:07 +00:00
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSkipTaskbarRemember()
|
2018-03-11 16:13:32 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("skiptaskbar", true, int(Rules::Remember));
|
2018-03-11 16:13:32 +00:00
|
|
|
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should not be included on a taskbar.
|
|
|
|
QVERIFY(client->skipTaskbar());
|
|
|
|
|
|
|
|
// Change the skip-taskbar state.
|
|
|
|
client->setOriginalSkipTaskbar(false);
|
|
|
|
QVERIFY(!client->skipTaskbar());
|
|
|
|
|
|
|
|
// Reopen the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should be included on a taskbar.
|
|
|
|
QVERIFY(!client->skipTaskbar());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
2018-03-11 16:13:32 +00:00
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSkipTaskbarForce()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("skiptaskbar", true, int(Rules::Force));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should not be included on a taskbar.
|
|
|
|
QVERIFY(client->skipTaskbar());
|
|
|
|
|
|
|
|
// Any attempt to change the skip-taskbar state should not succeed.
|
|
|
|
client->setOriginalSkipTaskbar(false);
|
|
|
|
QVERIFY(client->skipTaskbar());
|
|
|
|
|
|
|
|
// Reopen the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The skip-taskbar state should be still forced.
|
|
|
|
QVERIFY(client->skipTaskbar());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2018-03-11 16:13:32 +00:00
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSkipTaskbarApplyNow()
|
2018-02-11 17:27:34 +00:00
|
|
|
{
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(!client->skipTaskbar());
|
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("skiptaskbar", true, int(Rules::ApplyNow));
|
2018-02-11 17:27:34 +00:00
|
|
|
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
// The client should not be on a taskbar now.
|
|
|
|
QVERIFY(client->skipTaskbar());
|
|
|
|
|
|
|
|
// Also, one change the skip-taskbar state.
|
|
|
|
client->setOriginalSkipTaskbar(false);
|
|
|
|
QVERIFY(!client->skipTaskbar());
|
|
|
|
|
|
|
|
// The rule should not be applied again.
|
|
|
|
client->evaluateWindowRules();
|
|
|
|
QVERIFY(!client->skipTaskbar());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSkipTaskbarForceTemporarily()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("skiptaskbar", true, int(Rules::ForceTemporarily));
|
2018-02-11 17:27:34 +00:00
|
|
|
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should not be included on a taskbar.
|
|
|
|
QVERIFY(client->skipTaskbar());
|
|
|
|
|
|
|
|
// Any attempt to change the skip-taskbar state should not succeed.
|
|
|
|
client->setOriginalSkipTaskbar(false);
|
|
|
|
QVERIFY(client->skipTaskbar());
|
|
|
|
|
|
|
|
// The rule should be discarded when the client is closed.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(!client->skipTaskbar());
|
|
|
|
|
|
|
|
// The skip-taskbar state is no longer forced.
|
|
|
|
client->setOriginalSkipTaskbar(true);
|
|
|
|
QVERIFY(client->skipTaskbar());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSkipPagerDontAffect()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("skippager", true, int(Rules::DontAffect));
|
2018-02-11 17:27:34 +00:00
|
|
|
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should not be affected by the rule.
|
|
|
|
QVERIFY(!client->skipPager());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
2018-02-11 17:27:34 +00:00
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSkipPagerApply()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("skippager", true, int(Rules::Apply));
|
2018-02-11 17:27:34 +00:00
|
|
|
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should not be included on a pager.
|
|
|
|
QVERIFY(client->skipPager());
|
|
|
|
|
|
|
|
// Though one can change that.
|
|
|
|
client->setSkipPager(false);
|
|
|
|
QVERIFY(!client->skipPager());
|
|
|
|
|
|
|
|
// Reopen the client, the rule should be applied again.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->skipPager());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
2018-02-11 17:27:34 +00:00
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSkipPagerRemember()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("skippager", true, int(Rules::Remember));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should not be included on a pager.
|
|
|
|
QVERIFY(client->skipPager());
|
|
|
|
|
|
|
|
// Change the skip-pager state.
|
|
|
|
client->setSkipPager(false);
|
|
|
|
QVERIFY(!client->skipPager());
|
|
|
|
|
|
|
|
// Reopen the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should be included on a pager.
|
|
|
|
QVERIFY(!client->skipPager());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSkipPagerForce()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("skippager", true, int(Rules::Force));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should not be included on a pager.
|
|
|
|
QVERIFY(client->skipPager());
|
|
|
|
|
|
|
|
// Any attempt to change the skip-pager state should not succeed.
|
|
|
|
client->setSkipPager(false);
|
|
|
|
QVERIFY(client->skipPager());
|
|
|
|
|
|
|
|
// Reopen the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The skip-pager state should be still forced.
|
|
|
|
QVERIFY(client->skipPager());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSkipPagerApplyNow()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(!client->skipPager());
|
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("skippager", true, int(Rules::ApplyNow));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// The client should not be on a pager now.
|
|
|
|
QVERIFY(client->skipPager());
|
|
|
|
|
|
|
|
// Also, one change the skip-pager state.
|
|
|
|
client->setSkipPager(false);
|
|
|
|
QVERIFY(!client->skipPager());
|
|
|
|
|
|
|
|
// The rule should not be applied again.
|
|
|
|
client->evaluateWindowRules();
|
|
|
|
QVERIFY(!client->skipPager());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSkipPagerForceTemporarily()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("skippager", true, int(Rules::ForceTemporarily));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should not be included on a pager.
|
|
|
|
QVERIFY(client->skipPager());
|
|
|
|
|
|
|
|
// Any attempt to change the skip-pager state should not succeed.
|
|
|
|
client->setSkipPager(false);
|
|
|
|
QVERIFY(client->skipPager());
|
|
|
|
|
|
|
|
// The rule should be discarded when the client is closed.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(!client->skipPager());
|
|
|
|
|
|
|
|
// The skip-pager state is no longer forced.
|
|
|
|
client->setSkipPager(true);
|
|
|
|
QVERIFY(client->skipPager());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSkipSwitcherDontAffect()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("skipswitcher", true, int(Rules::DontAffect));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should not be affected by the rule.
|
|
|
|
QVERIFY(!client->skipSwitcher());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSkipSwitcherApply()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("skipswitcher", true, int(Rules::Apply));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should be excluded from window switching effects.
|
|
|
|
QVERIFY(client->skipSwitcher());
|
|
|
|
|
|
|
|
// Though one can change that.
|
|
|
|
client->setSkipSwitcher(false);
|
|
|
|
QVERIFY(!client->skipSwitcher());
|
|
|
|
|
|
|
|
// Reopen the client, the rule should be applied again.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->skipSwitcher());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSkipSwitcherRemember()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("skipswitcher", true, int(Rules::Remember));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should be excluded from window switching effects.
|
|
|
|
QVERIFY(client->skipSwitcher());
|
|
|
|
|
|
|
|
// Change the skip-switcher state.
|
|
|
|
client->setSkipSwitcher(false);
|
|
|
|
QVERIFY(!client->skipSwitcher());
|
|
|
|
|
|
|
|
// Reopen the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should be included in window switching effects.
|
|
|
|
QVERIFY(!client->skipSwitcher());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSkipSwitcherForce()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("skipswitcher", true, int(Rules::Force));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should be excluded from window switching effects.
|
|
|
|
QVERIFY(client->skipSwitcher());
|
|
|
|
|
|
|
|
// Any attempt to change the skip-switcher state should not succeed.
|
|
|
|
client->setSkipSwitcher(false);
|
|
|
|
QVERIFY(client->skipSwitcher());
|
|
|
|
|
|
|
|
// Reopen the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The skip-switcher state should be still forced.
|
|
|
|
QVERIFY(client->skipSwitcher());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSkipSwitcherApplyNow()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(!client->skipSwitcher());
|
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("skipswitcher", true, int(Rules::ApplyNow));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// The client should be excluded from window switching effects now.
|
|
|
|
QVERIFY(client->skipSwitcher());
|
|
|
|
|
|
|
|
// Also, one change the skip-switcher state.
|
|
|
|
client->setSkipSwitcher(false);
|
|
|
|
QVERIFY(!client->skipSwitcher());
|
|
|
|
|
|
|
|
// The rule should not be applied again.
|
|
|
|
client->evaluateWindowRules();
|
|
|
|
QVERIFY(!client->skipSwitcher());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testSkipSwitcherForceTemporarily()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("skipswitcher", true, int(Rules::ForceTemporarily));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should be excluded from window switching effects.
|
|
|
|
QVERIFY(client->skipSwitcher());
|
|
|
|
|
|
|
|
// Any attempt to change the skip-switcher state should not succeed.
|
|
|
|
client->setSkipSwitcher(false);
|
|
|
|
QVERIFY(client->skipSwitcher());
|
|
|
|
|
|
|
|
// The rule should be discarded when the client is closed.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(!client->skipSwitcher());
|
|
|
|
|
|
|
|
// The skip-switcher state is no longer forced.
|
|
|
|
client->setSkipSwitcher(true);
|
|
|
|
QVERIFY(client->skipSwitcher());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testKeepAboveDontAffect()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("above", true, int(Rules::DontAffect));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The keep-above state of the client should not be affected by the rule.
|
|
|
|
QVERIFY(!client->keepAbove());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testKeepAboveApply()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("above", true, int(Rules::Apply));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// Initially, the client should be kept above.
|
|
|
|
QVERIFY(client->keepAbove());
|
|
|
|
|
|
|
|
// One should also be able to alter the keep-above state.
|
|
|
|
client->setKeepAbove(false);
|
|
|
|
QVERIFY(!client->keepAbove());
|
|
|
|
|
|
|
|
// If one re-opens the client, it should be kept above back again.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->keepAbove());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testKeepAboveRemember()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("above", true, int(Rules::Remember));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// Initially, the client should be kept above.
|
|
|
|
QVERIFY(client->keepAbove());
|
|
|
|
|
|
|
|
// Unset the keep-above state.
|
|
|
|
client->setKeepAbove(false);
|
|
|
|
QVERIFY(!client->keepAbove());
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
|
|
|
|
// Re-open the client, it should not be kept above.
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(!client->keepAbove());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testKeepAboveForce()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("above", true, int(Rules::Force));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// Initially, the client should be kept above.
|
|
|
|
QVERIFY(client->keepAbove());
|
|
|
|
|
|
|
|
// Any attemt to unset the keep-above should not succeed.
|
|
|
|
client->setKeepAbove(false);
|
|
|
|
QVERIFY(client->keepAbove());
|
|
|
|
|
|
|
|
// If we re-open the client, it should still be kept above.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->keepAbove());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testKeepAboveApplyNow()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(!client->keepAbove());
|
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("above", true, int(Rules::ApplyNow));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// The client should now be kept above other clients.
|
|
|
|
QVERIFY(client->keepAbove());
|
|
|
|
|
|
|
|
// One is still able to change the keep-above state of the client.
|
|
|
|
client->setKeepAbove(false);
|
|
|
|
QVERIFY(!client->keepAbove());
|
|
|
|
|
|
|
|
// The rule should not be applied again.
|
|
|
|
client->evaluateWindowRules();
|
|
|
|
QVERIFY(!client->keepAbove());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testKeepAboveForceTemporarily()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("above", true, int(Rules::ForceTemporarily));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// Initially, the client should be kept above.
|
|
|
|
QVERIFY(client->keepAbove());
|
|
|
|
|
|
|
|
// Any attempt to alter the keep-above state should not succeed.
|
|
|
|
client->setKeepAbove(false);
|
|
|
|
QVERIFY(client->keepAbove());
|
|
|
|
|
|
|
|
// The rule should be discarded when the client is closed.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(!client->keepAbove());
|
|
|
|
|
|
|
|
// The keep-above state is no longer forced.
|
|
|
|
client->setKeepAbove(true);
|
|
|
|
QVERIFY(client->keepAbove());
|
|
|
|
client->setKeepAbove(false);
|
|
|
|
QVERIFY(!client->keepAbove());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testKeepBelowDontAffect()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("below", true, int(Rules::DontAffect));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The keep-below state of the client should not be affected by the rule.
|
|
|
|
QVERIFY(!client->keepBelow());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testKeepBelowApply()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("below", true, int(Rules::Apply));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// Initially, the client should be kept below.
|
|
|
|
QVERIFY(client->keepBelow());
|
|
|
|
|
|
|
|
// One should also be able to alter the keep-below state.
|
|
|
|
client->setKeepBelow(false);
|
|
|
|
QVERIFY(!client->keepBelow());
|
|
|
|
|
|
|
|
// If one re-opens the client, it should be kept above back again.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->keepBelow());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testKeepBelowRemember()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("below", true, int(Rules::Remember));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// Initially, the client should be kept below.
|
|
|
|
QVERIFY(client->keepBelow());
|
|
|
|
|
|
|
|
// Unset the keep-below state.
|
|
|
|
client->setKeepBelow(false);
|
|
|
|
QVERIFY(!client->keepBelow());
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
|
|
|
|
// Re-open the client, it should not be kept below.
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(!client->keepBelow());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testKeepBelowForce()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("below", true, int(Rules::Force));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// Initially, the client should be kept below.
|
|
|
|
QVERIFY(client->keepBelow());
|
|
|
|
|
|
|
|
// Any attemt to unset the keep-below should not succeed.
|
|
|
|
client->setKeepBelow(false);
|
|
|
|
QVERIFY(client->keepBelow());
|
|
|
|
|
|
|
|
// If we re-open the client, it should still be kept below.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->keepBelow());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testKeepBelowApplyNow()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(!client->keepBelow());
|
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("below", true, int(Rules::ApplyNow));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// The client should now be kept below other clients.
|
|
|
|
QVERIFY(client->keepBelow());
|
|
|
|
|
|
|
|
// One is still able to change the keep-below state of the client.
|
|
|
|
client->setKeepBelow(false);
|
|
|
|
QVERIFY(!client->keepBelow());
|
|
|
|
|
|
|
|
// The rule should not be applied again.
|
|
|
|
client->evaluateWindowRules();
|
|
|
|
QVERIFY(!client->keepBelow());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testKeepBelowForceTemporarily()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("below", true, int(Rules::ForceTemporarily));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// Initially, the client should be kept below.
|
|
|
|
QVERIFY(client->keepBelow());
|
|
|
|
|
|
|
|
// Any attempt to alter the keep-below state should not succeed.
|
|
|
|
client->setKeepBelow(false);
|
|
|
|
QVERIFY(client->keepBelow());
|
|
|
|
|
|
|
|
// The rule should be discarded when the client is closed.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(!client->keepBelow());
|
|
|
|
|
|
|
|
// The keep-below state is no longer forced.
|
|
|
|
client->setKeepBelow(true);
|
|
|
|
QVERIFY(client->keepBelow());
|
|
|
|
client->setKeepBelow(false);
|
|
|
|
QVERIFY(!client->keepBelow());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testShortcutDontAffect()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("shortcut", "Ctrl+Alt+1", int(Rules::DontAffect));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QCOMPARE(client->shortcut(), QKeySequence());
|
|
|
|
client->minimize();
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
|
|
|
|
// If we press the window shortcut, nothing should happen.
|
|
|
|
QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized);
|
|
|
|
QVERIFY(clientUnminimizedSpy.isValid());
|
|
|
|
quint32 timestamp = 1;
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_1, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_1, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++);
|
|
|
|
QVERIFY(!clientUnminimizedSpy.wait(100));
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testShortcutApply()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("shortcut", "Ctrl+Alt+1", int(Rules::Apply));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// If we press the window shortcut, the window should be brought back to user.
|
|
|
|
QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized);
|
|
|
|
QVERIFY(clientUnminimizedSpy.isValid());
|
|
|
|
quint32 timestamp = 1;
|
|
|
|
QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1}));
|
|
|
|
client->minimize();
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_1, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_1, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++);
|
|
|
|
QVERIFY(clientUnminimizedSpy.wait());
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
|
|
|
// One can also change the shortcut.
|
|
|
|
client->setShortcut(QStringLiteral("Ctrl+Alt+2"));
|
|
|
|
QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_2}));
|
|
|
|
client->minimize();
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_2, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_2, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++);
|
|
|
|
QVERIFY(clientUnminimizedSpy.wait());
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
|
|
|
// The old shortcut should do nothing.
|
|
|
|
client->minimize();
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_1, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_1, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++);
|
|
|
|
QVERIFY(!clientUnminimizedSpy.wait(100));
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
|
|
|
|
// Reopen the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The window shortcut should be set back to Ctrl+Alt+1.
|
|
|
|
QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1}));
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testShortcutRemember()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
|
|
|
QSKIP("KWin core doesn't try to save the last used window shortcut");
|
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("shortcut", "Ctrl+Alt+1", int(Rules::Remember));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// If we press the window shortcut, the window should be brought back to user.
|
|
|
|
QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized);
|
|
|
|
QVERIFY(clientUnminimizedSpy.isValid());
|
|
|
|
quint32 timestamp = 1;
|
|
|
|
QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1}));
|
|
|
|
client->minimize();
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_1, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_1, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++);
|
|
|
|
QVERIFY(clientUnminimizedSpy.wait());
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
|
|
|
// Change the window shortcut to Ctrl+Alt+2.
|
|
|
|
client->setShortcut(QStringLiteral("Ctrl+Alt+2"));
|
|
|
|
QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_2}));
|
|
|
|
client->minimize();
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_2, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_2, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++);
|
|
|
|
QVERIFY(clientUnminimizedSpy.wait());
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
|
|
|
// Reopen the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The window shortcut should be set to the last known value.
|
|
|
|
QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_2}));
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testShortcutForce()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
|
|
|
QSKIP("KWin core can't release forced window shortcuts");
|
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("shortcut", "Ctrl+Alt+1", int(Rules::Force));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// If we press the window shortcut, the window should be brought back to user.
|
|
|
|
QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized);
|
|
|
|
QVERIFY(clientUnminimizedSpy.isValid());
|
|
|
|
quint32 timestamp = 1;
|
|
|
|
QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1}));
|
|
|
|
client->minimize();
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_1, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_1, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++);
|
|
|
|
QVERIFY(clientUnminimizedSpy.wait());
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
|
|
|
// Any attempt to change the window shortcut should not succeed.
|
|
|
|
client->setShortcut(QStringLiteral("Ctrl+Alt+2"));
|
|
|
|
QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1}));
|
|
|
|
client->minimize();
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_2, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_2, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++);
|
|
|
|
QVERIFY(!clientUnminimizedSpy.wait(100));
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
|
|
|
|
// Reopen the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The window shortcut should still be forced.
|
|
|
|
QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1}));
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testShortcutApplyNow()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->shortcut().isEmpty());
|
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("shortcut", "Ctrl+Alt+1", int(Rules::ApplyNow));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// The client should now have a window shortcut assigned.
|
|
|
|
QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1}));
|
|
|
|
QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized);
|
|
|
|
QVERIFY(clientUnminimizedSpy.isValid());
|
|
|
|
quint32 timestamp = 1;
|
|
|
|
client->minimize();
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_1, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_1, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++);
|
|
|
|
QVERIFY(clientUnminimizedSpy.wait());
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
|
|
|
// Assign a different shortcut.
|
|
|
|
client->setShortcut(QStringLiteral("Ctrl+Alt+2"));
|
|
|
|
QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_2}));
|
|
|
|
client->minimize();
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_2, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_2, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++);
|
|
|
|
QVERIFY(clientUnminimizedSpy.wait());
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
|
|
|
// The rule should not be applied again.
|
|
|
|
client->evaluateWindowRules();
|
|
|
|
QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_2}));
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testShortcutForceTemporarily()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
|
|
|
QSKIP("KWin core can't release forced window shortcuts");
|
|
|
|
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("shortcut", "Ctrl+Alt+1", int(Rules::ForceTemporarily));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// If we press the window shortcut, the window should be brought back to user.
|
|
|
|
QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized);
|
|
|
|
QVERIFY(clientUnminimizedSpy.isValid());
|
|
|
|
quint32 timestamp = 1;
|
|
|
|
QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1}));
|
|
|
|
client->minimize();
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_1, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_1, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++);
|
|
|
|
QVERIFY(clientUnminimizedSpy.wait());
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
|
|
|
|
// Any attempt to change the window shortcut should not succeed.
|
|
|
|
client->setShortcut(QStringLiteral("Ctrl+Alt+2"));
|
|
|
|
QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1}));
|
|
|
|
client->minimize();
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyPressed(KEY_2, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_2, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++);
|
|
|
|
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++);
|
|
|
|
QVERIFY(!clientUnminimizedSpy.wait(100));
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
|
|
|
|
// The rule should be discarded when the client is closed.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->shortcut().isEmpty());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testDesktopFileDontAffect()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
|
|
|
// Currently, the desktop file name is derived from the app id. If the app id is
|
|
|
|
// changed, then the old rules will be lost. Either setDesktopFileName should
|
|
|
|
// be exposed or the desktop file name rule should be removed for wayland clients.
|
|
|
|
QSKIP("Needs changes in KWin core to pass");
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testDesktopFileApply()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
|
|
|
// Currently, the desktop file name is derived from the app id. If the app id is
|
|
|
|
// changed, then the old rules will be lost. Either setDesktopFileName should
|
|
|
|
// be exposed or the desktop file name rule should be removed for wayland clients.
|
|
|
|
QSKIP("Needs changes in KWin core to pass");
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testDesktopFileRemember()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
|
|
|
// Currently, the desktop file name is derived from the app id. If the app id is
|
|
|
|
// changed, then the old rules will be lost. Either setDesktopFileName should
|
|
|
|
// be exposed or the desktop file name rule should be removed for wayland clients.
|
|
|
|
QSKIP("Needs changes in KWin core to pass");
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testDesktopFileForce()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
|
|
|
// Currently, the desktop file name is derived from the app id. If the app id is
|
|
|
|
// changed, then the old rules will be lost. Either setDesktopFileName should
|
|
|
|
// be exposed or the desktop file name rule should be removed for wayland clients.
|
|
|
|
QSKIP("Needs changes in KWin core to pass");
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testDesktopFileApplyNow()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
|
|
|
// Currently, the desktop file name is derived from the app id. If the app id is
|
|
|
|
// changed, then the old rules will be lost. Either setDesktopFileName should
|
|
|
|
// be exposed or the desktop file name rule should be removed for wayland clients.
|
|
|
|
QSKIP("Needs changes in KWin core to pass");
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testDesktopFileForceTemporarily()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
|
|
|
// Currently, the desktop file name is derived from the app id. If the app id is
|
|
|
|
// changed, then the old rules will be lost. Either setDesktopFileName should
|
|
|
|
// be exposed or the desktop file name rule should be removed for wayland clients.
|
|
|
|
QSKIP("Needs changes in KWin core to pass");
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testActiveOpacityDontAffect()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("opacityactive", 90, int(Rules::DontAffect));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
|
|
|
|
// The opacity should not be affected by the rule.
|
|
|
|
QCOMPARE(client->opacity(), 1.0);
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testActiveOpacityForce()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("opacityactive", 90, int(Rules::Force));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QCOMPARE(client->opacity(), 0.9);
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testActiveOpacityForceTemporarily()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("opacityactive", 90, int(Rules::ForceTemporarily));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QCOMPARE(client->opacity(), 0.9);
|
|
|
|
|
|
|
|
// The rule should be discarded when the client is closed.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QCOMPARE(client->opacity(), 1.0);
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testInactiveOpacityDontAffect()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("opacityinactive", 80, int(Rules::DontAffect));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
|
|
|
|
// Make the client inactive.
|
|
|
|
workspace()->setActiveClient(nullptr);
|
|
|
|
QVERIFY(!client->isActive());
|
|
|
|
|
|
|
|
// The opacity of the client should not be affected by the rule.
|
|
|
|
QCOMPARE(client->opacity(), 1.0);
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testInactiveOpacityForce()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("opacityinactive", 80, int(Rules::Force));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QCOMPARE(client->opacity(), 1.0);
|
|
|
|
|
|
|
|
// Make the client inactive.
|
|
|
|
workspace()->setActiveClient(nullptr);
|
|
|
|
QVERIFY(!client->isActive());
|
|
|
|
|
|
|
|
// The opacity should be forced by the rule.
|
|
|
|
QCOMPARE(client->opacity(), 0.8);
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testInactiveOpacityForceTemporarily()
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("opacityinactive", 80, int(Rules::ForceTemporarily));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2021-09-03 17:54:03 +00:00
|
|
|
KWayland::Client::Surface *surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QCOMPARE(client->opacity(), 1.0);
|
|
|
|
|
|
|
|
// Make the client inactive.
|
|
|
|
workspace()->setActiveClient(nullptr);
|
|
|
|
QVERIFY(!client->isActive());
|
|
|
|
|
|
|
|
// The opacity should be forced by the rule.
|
|
|
|
QCOMPARE(client->opacity(), 0.8);
|
|
|
|
|
|
|
|
// The rule should be discarded when the client is closed.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
2021-05-11 05:26:51 +00:00
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
QCOMPARE(client->opacity(), 1.0);
|
|
|
|
workspace()->setActiveClient(nullptr);
|
|
|
|
QVERIFY(!client->isActive());
|
|
|
|
QCOMPARE(client->opacity(), 1.0);
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
2018-02-11 17:27:34 +00:00
|
|
|
}
|
|
|
|
|
2021-12-11 13:29:35 +00:00
|
|
|
void TestXdgShellClientRules::testNoBorderDontAffect()
|
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("noborder", true, int(Rules::DontAffect));
|
2021-12-11 13:29:35 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
AbstractClient *client;
|
|
|
|
KWayland::Client::Surface *surface;
|
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"), Test::XdgToplevelDecorationV1::mode_server_side);
|
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should not be affected by the rule.
|
|
|
|
QVERIFY(!client->noBorder());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestXdgShellClientRules::testNoBorderApply()
|
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("noborder", true, int(Rules::Apply));
|
2021-12-11 13:29:35 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
AbstractClient *client;
|
|
|
|
KWayland::Client::Surface *surface;
|
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"), Test::XdgToplevelDecorationV1::mode_server_side);
|
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// Initially, the client should not be decorated.
|
|
|
|
QVERIFY(client->noBorder());
|
|
|
|
QVERIFY(!client->isDecorated());
|
|
|
|
|
|
|
|
// But you should be able to change "no border" property afterwards.
|
|
|
|
QVERIFY(client->userCanSetNoBorder());
|
|
|
|
client->setNoBorder(false);
|
|
|
|
QVERIFY(!client->noBorder());
|
|
|
|
|
|
|
|
// If one re-opens the client, it should have no border again.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"), Test::XdgToplevelDecorationV1::mode_server_side);
|
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->noBorder());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestXdgShellClientRules::testNoBorderRemember()
|
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("noborder", true, int(Rules::Remember));
|
2021-12-11 13:29:35 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
AbstractClient *client;
|
|
|
|
KWayland::Client::Surface *surface;
|
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"), Test::XdgToplevelDecorationV1::mode_server_side);
|
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// Initially, the client should not be decorated.
|
|
|
|
QVERIFY(client->noBorder());
|
|
|
|
QVERIFY(!client->isDecorated());
|
|
|
|
|
|
|
|
// Unset the "no border" property.
|
|
|
|
QVERIFY(client->userCanSetNoBorder());
|
|
|
|
client->setNoBorder(false);
|
|
|
|
QVERIFY(!client->noBorder());
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
|
|
|
|
// Re-open the client, it should be decorated.
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"), Test::XdgToplevelDecorationV1::mode_server_side);
|
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isDecorated());
|
|
|
|
QVERIFY(!client->noBorder());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestXdgShellClientRules::testNoBorderForce()
|
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("noborder", true, int(Rules::Force));
|
2021-12-11 13:29:35 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
AbstractClient *client;
|
|
|
|
KWayland::Client::Surface *surface;
|
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"), Test::XdgToplevelDecorationV1::mode_server_side);
|
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should not be decorated.
|
|
|
|
QVERIFY(client->noBorder());
|
|
|
|
QVERIFY(!client->isDecorated());
|
|
|
|
|
|
|
|
// And the user should not be able to change the "no border" property.
|
|
|
|
client->setNoBorder(false);
|
|
|
|
QVERIFY(client->noBorder());
|
|
|
|
|
|
|
|
// Reopen the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"), Test::XdgToplevelDecorationV1::mode_server_side);
|
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The "no border" property should be still forced.
|
|
|
|
QVERIFY(client->noBorder());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestXdgShellClientRules::testNoBorderApplyNow()
|
|
|
|
{
|
|
|
|
// Create the test client.
|
|
|
|
AbstractClient *client;
|
|
|
|
KWayland::Client::Surface *surface;
|
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"), Test::XdgToplevelDecorationV1::mode_server_side);
|
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(!client->noBorder());
|
|
|
|
|
|
|
|
// Initialize RuleBook with the test rule.
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("noborder", true, int(Rules::ApplyNow));
|
2021-12-11 13:29:35 +00:00
|
|
|
|
|
|
|
// The "no border" property should be set now.
|
|
|
|
QVERIFY(client->noBorder());
|
|
|
|
|
|
|
|
// One should be still able to change the "no border" property.
|
|
|
|
client->setNoBorder(false);
|
|
|
|
QVERIFY(!client->noBorder());
|
|
|
|
|
|
|
|
// The rule should not be applied again.
|
|
|
|
client->evaluateWindowRules();
|
|
|
|
QVERIFY(!client->noBorder());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestXdgShellClientRules::testNoBorderForceTemporarily()
|
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("noborder", true, int(Rules::ForceTemporarily));
|
2021-12-11 13:29:35 +00:00
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
AbstractClient *client;
|
|
|
|
KWayland::Client::Surface *surface;
|
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"), Test::XdgToplevelDecorationV1::mode_server_side);
|
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The "no border" property should be set.
|
|
|
|
QVERIFY(client->noBorder());
|
|
|
|
|
|
|
|
// And you should not be able to change it.
|
|
|
|
client->setNoBorder(false);
|
|
|
|
QVERIFY(client->noBorder());
|
|
|
|
|
|
|
|
// The rule should be discarded when the client is closed.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"), Test::XdgToplevelDecorationV1::mode_server_side);
|
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(!client->noBorder());
|
|
|
|
|
|
|
|
// The "no border" property is no longer forced.
|
|
|
|
client->setNoBorder(true);
|
|
|
|
QVERIFY(client->noBorder());
|
|
|
|
client->setNoBorder(false);
|
|
|
|
QVERIFY(!client->noBorder());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2022-02-05 16:38:24 +00:00
|
|
|
void TestXdgShellClientRules::testScreenDontAffect()
|
|
|
|
{
|
|
|
|
const KWin::Outputs outputs = kwinApp()->platform()->enabledOutputs();
|
|
|
|
|
|
|
|
setWindowRule("screen", int(1), int(Rules::DontAffect));
|
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
AbstractClient *client;
|
|
|
|
KWayland::Client::Surface *surface;
|
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should not be affected by the rule.
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(0)->name());
|
|
|
|
|
|
|
|
// The user can still move the client to another screen.
|
|
|
|
workspace()->sendClientToOutput(client, outputs.at(1));
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(1)->name());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestXdgShellClientRules::testScreenApply()
|
|
|
|
{
|
|
|
|
const KWin::Outputs outputs = kwinApp()->platform()->enabledOutputs();
|
|
|
|
|
|
|
|
setWindowRule("screen", int(1), int(Rules::Apply));
|
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
AbstractClient *client;
|
|
|
|
KWayland::Client::Surface *surface;
|
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The client should be in the screen specified by the rule.
|
|
|
|
QEXPECT_FAIL("", "Applying a screen rule on a new client fails on Wayland", Continue);
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(1)->name());
|
|
|
|
|
|
|
|
// The user can move the client to another screen.
|
|
|
|
workspace()->sendClientToOutput(client, outputs.at(0));
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(0)->name());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestXdgShellClientRules::testScreenRemember()
|
|
|
|
{
|
|
|
|
const KWin::Outputs outputs = kwinApp()->platform()->enabledOutputs();
|
|
|
|
|
|
|
|
setWindowRule("screen", int(1), int(Rules::Remember));
|
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
AbstractClient *client;
|
|
|
|
KWayland::Client::Surface *surface;
|
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// Initially, the client should be in the first screen
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(0)->name());
|
|
|
|
|
|
|
|
// Move the client to the second screen.
|
|
|
|
workspace()->sendClientToOutput(client, outputs.at(1));
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(1)->name());
|
|
|
|
|
|
|
|
// Close and reopen the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
QEXPECT_FAIL("", "Applying a screen rule on a new client fails on Wayland", Continue);
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(1)->name());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestXdgShellClientRules::testScreenForce()
|
|
|
|
{
|
|
|
|
const KWin::Outputs outputs = kwinApp()->platform()->enabledOutputs();
|
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
AbstractClient *client;
|
|
|
|
KWayland::Client::Surface *surface;
|
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
|
|
|
QVERIFY(client);
|
|
|
|
QVERIFY(client->isActive());
|
|
|
|
|
|
|
|
setWindowRule("screen", int(1), int(Rules::Force));
|
|
|
|
|
|
|
|
// The client should be forced to the screen specified by the rule.
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(1)->name());
|
|
|
|
|
|
|
|
// User should not be able to move the client to another screen.
|
|
|
|
workspace()->sendClientToOutput(client, outputs.at(0));
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(1)->name());
|
|
|
|
|
|
|
|
// Disable the output where the window is on, so the client is moved the other screen
|
|
|
|
WaylandOutputConfig config;
|
|
|
|
auto changeSet = config.changeSet(static_cast<AbstractWaylandOutput *>(outputs.at(1)));
|
|
|
|
changeSet->enabled = false;
|
|
|
|
kwinApp()->platform()->applyOutputChanges(config);
|
|
|
|
|
|
|
|
QVERIFY(!outputs.at(1)->isEnabled());
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(0)->name());
|
|
|
|
|
|
|
|
// Enable the output and check that the client is moved there again
|
|
|
|
changeSet->enabled = true;
|
|
|
|
kwinApp()->platform()->applyOutputChanges(config);
|
|
|
|
|
|
|
|
QVERIFY(outputs.at(1)->isEnabled());
|
|
|
|
QEXPECT_FAIL("", "Disabling and enabling an output does not move the client to the Forced screen", Continue);
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(1)->name());
|
|
|
|
|
|
|
|
// Close and reopen the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
QEXPECT_FAIL("", "Applying a screen rule on a new client fails on Wayland", Continue);
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(1)->name());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestXdgShellClientRules::testScreenApplyNow()
|
|
|
|
{
|
|
|
|
const KWin::Outputs outputs = kwinApp()->platform()->enabledOutputs();
|
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
AbstractClient *client;
|
|
|
|
KWayland::Client::Surface *surface;
|
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(0)->name());
|
|
|
|
|
|
|
|
// Set the rule so the client should move to the screen specified by the rule.
|
|
|
|
setWindowRule("screen", int(1), int(Rules::ApplyNow));
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(1)->name());
|
|
|
|
|
|
|
|
// The user can move the client to another screen.
|
|
|
|
workspace()->sendClientToOutput(client, outputs.at(0));
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(0)->name());
|
|
|
|
|
|
|
|
// The rule should not be applied again.
|
|
|
|
client->evaluateWindowRules();
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(0)->name());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestXdgShellClientRules::testScreenForceTemporarily()
|
|
|
|
{
|
|
|
|
const KWin::Outputs outputs = kwinApp()->platform()->enabledOutputs();
|
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
AbstractClient *client;
|
|
|
|
KWayland::Client::Surface *surface;
|
|
|
|
Test::XdgToplevel *shellSurface;
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
setWindowRule("screen", int(1), int(Rules::ForceTemporarily));
|
|
|
|
|
|
|
|
// The client should be forced the second screen
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(1)->name());
|
|
|
|
|
|
|
|
// User is not allowed to move it
|
|
|
|
workspace()->sendClientToOutput(client, outputs.at(0));
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(1)->name());
|
|
|
|
|
|
|
|
// Close and reopen the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
std::tie(client, surface, shellSurface) = createWindow(QStringLiteral("org.kde.foo"));
|
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// The rule should be discarded now
|
|
|
|
QCOMPARE(client->output()->name(), outputs.at(0)->name());
|
|
|
|
|
|
|
|
// Destroy the client.
|
|
|
|
delete shellSurface;
|
|
|
|
delete surface;
|
|
|
|
QVERIFY(Test::waitForWindowDestroyed(client));
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testMatchAfterNameChange()
|
2018-03-12 17:06:33 +00:00
|
|
|
{
|
2021-09-02 22:19:43 +00:00
|
|
|
setWindowRule("above", true, int(Rules::Force));
|
2018-03-12 17:06:33 +00:00
|
|
|
|
2021-09-03 17:54:03 +00:00
|
|
|
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
|
2018-03-12 17:06:33 +00:00
|
|
|
|
|
|
|
auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
|
|
|
QVERIFY(c);
|
|
|
|
QVERIFY(c->isActive());
|
|
|
|
QCOMPARE(c->keepAbove(), false);
|
|
|
|
|
|
|
|
QSignalSpy desktopFileNameSpy(c, &AbstractClient::desktopFileNameChanged);
|
|
|
|
QVERIFY(desktopFileNameSpy.isValid());
|
|
|
|
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
2018-03-12 17:06:33 +00:00
|
|
|
QVERIFY(desktopFileNameSpy.wait());
|
|
|
|
QCOMPARE(c->keepAbove(), true);
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
WAYLANDTEST_MAIN(TestXdgShellClientRules)
|
|
|
|
#include "xdgshellclient_rules_test.moc"
|