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"
|
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 "screens.h"
|
|
|
|
#include "virtualdesktops.h"
|
|
|
|
#include "wayland_server.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();
|
|
|
|
|
2018-03-12 17:06:33 +00:00
|
|
|
void testMatchAfterNameChange();
|
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());
|
2017-10-07 12:09:07 +00:00
|
|
|
QCOMPARE(screens()->count(), 2);
|
|
|
|
QCOMPARE(screens()->geometry(0), QRect(0, 0, 1280, 1024));
|
|
|
|
QCOMPARE(screens()->geometry(1), QRect(1280, 0, 1280, 1024));
|
2021-05-08 00:08:22 +00:00
|
|
|
Test::initWaylandWorkspace();
|
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());
|
2017-10-07 12:09:07 +00:00
|
|
|
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Decoration));
|
|
|
|
|
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
|
|
|
|
|
|
|
// Unreference the previous config.
|
|
|
|
RuleBook::self()->setConfig({});
|
|
|
|
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-05-11 05:26:51 +00:00
|
|
|
std::tuple<AbstractClient *, Surface *, Test::XdgToplevel *> createWindow(const QString &appId)
|
[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.
|
|
|
|
Surface *surface = Test::createSurface();
|
2021-05-11 05:26:51 +00:00
|
|
|
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface, surface, Test::CreationSetup::CreateOnly);
|
[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
|
|
|
|
|
|
|
// Assign the desired app id.
|
2021-05-11 05:26:51 +00:00
|
|
|
shellSurface->set_app_id(appId);
|
[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);
|
[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
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
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
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testPositionDontAffect()
|
2019-07-09 17:28:05 +00:00
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("position", QPoint(42, 42));
|
|
|
|
group.writeEntry("positionrule", int(Rules::DontAffect));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2019-07-09 17:28:05 +00:00
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("position", QPoint(42, 42));
|
|
|
|
group.writeEntry("positionrule", int(Rules::Apply));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2019-07-09 17:28:05 +00:00
|
|
|
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.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("position", QPoint(42, 42));
|
|
|
|
group.writeEntry("positionrule", int(Rules::Remember));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2019-07-09 17:28:05 +00:00
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("position", QPoint(42, 42));
|
|
|
|
group.writeEntry("positionrule", int(Rules::Force));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2019-07-09 17:28:05 +00:00
|
|
|
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;
|
2019-07-09 17:28:05 +00:00
|
|
|
Surface *surface;
|
|
|
|
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));
|
|
|
|
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("position", QPoint(42, 42));
|
|
|
|
group.writeEntry("positionrule", int(Rules::ApplyNow));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
|
|
|
|
// The client should be moved to the position specified by the rule.
|
2020-02-05 09:28:50 +00:00
|
|
|
QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged);
|
|
|
|
QVERIFY(frameGeometryChangedSpy.isValid());
|
2019-07-09 17:28:05 +00:00
|
|
|
workspace()->slotReconfigure();
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("position", QPoint(42, 42));
|
|
|
|
group.writeEntry("positionrule", int(Rules::ForceTemporarily));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
2019-07-09 17:28:05 +00:00
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("size", QSize(480, 640));
|
|
|
|
group.writeEntry("sizerule", int(Rules::DontAffect));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
QScopedPointer<Surface> surface;
|
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 17:28:05 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
|
|
|
// 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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("size", QSize(480, 640));
|
|
|
|
group.writeEntry("sizerule", int(Rules::Apply));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
QScopedPointer<Surface> surface;
|
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 17:28:05 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
|
|
|
// 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));
|
2019-07-09 17:28:05 +00:00
|
|
|
QCOMPARE(clientStepUserMovedResizedSpy.count(), 0);
|
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-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait(10));
|
|
|
|
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-05-11 05:26:51 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 17:28:05 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("size", QSize(480, 640));
|
|
|
|
group.writeEntry("sizerule", int(Rules::Remember));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
QScopedPointer<Surface> surface;
|
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 17:28:05 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
|
|
|
// 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));
|
2019-07-09 17:28:05 +00:00
|
|
|
QCOMPARE(clientStepUserMovedResizedSpy.count(), 0);
|
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-05-11 05:26:51 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy->wait(10));
|
|
|
|
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-05-11 05:26:51 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 17:28:05 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("size", QSize(480, 640));
|
|
|
|
group.writeEntry("sizerule", int(Rules::Force));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
QScopedPointer<Surface> surface;
|
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 17:28:05 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
|
|
|
// 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-05-11 05:26:51 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 17:28:05 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
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.
|
|
|
|
QScopedPointer<Surface> surface;
|
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 17:28:05 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("size", QSize(480, 640));
|
|
|
|
group.writeEntry("sizerule", int(Rules::ApplyNow));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// 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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("size", QSize(480, 640));
|
|
|
|
group.writeEntry("sizerule", int(Rules::ForceTemporarily));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
QScopedPointer<Surface> surface;
|
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 17:28:05 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
|
|
|
// 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-05-11 05:26:51 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 17:28:05 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("maximizehoriz", true);
|
|
|
|
group.writeEntry("maximizehorizrule", int(Rules::DontAffect));
|
|
|
|
group.writeEntry("maximizevert", true);
|
|
|
|
group.writeEntry("maximizevertrule", int(Rules::DontAffect));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
QScopedPointer<Surface> surface;
|
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 18:07:21 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
|
|
|
// 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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("maximizehoriz", true);
|
|
|
|
group.writeEntry("maximizehorizrule", int(Rules::Apply));
|
|
|
|
group.writeEntry("maximizevert", true);
|
|
|
|
group.writeEntry("maximizevertrule", int(Rules::Apply));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
QScopedPointer<Surface> surface;
|
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 18:07:21 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
|
|
|
// 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);
|
2020-02-17 18:39:17 +00:00
|
|
|
QEXPECT_FAIL("", "Geometry restore is set to the first valid geometry", Continue);
|
2021-05-11 05:26:51 +00:00
|
|
|
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-05-11 05:26:51 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 18:07:21 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("maximizehoriz", true);
|
|
|
|
group.writeEntry("maximizehorizrule", int(Rules::Remember));
|
|
|
|
group.writeEntry("maximizevert", true);
|
|
|
|
group.writeEntry("maximizevertrule", int(Rules::Remember));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
QScopedPointer<Surface> surface;
|
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 18:07:21 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
|
|
|
// 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);
|
2020-02-17 18:39:17 +00:00
|
|
|
QEXPECT_FAIL("", "Geometry restore is set to the first valid geometry", Continue);
|
2021-05-11 05:26:51 +00:00
|
|
|
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-05-11 05:26:51 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 18:07:21 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("maximizehoriz", true);
|
|
|
|
group.writeEntry("maximizehorizrule", int(Rules::Force));
|
|
|
|
group.writeEntry("maximizevert", true);
|
|
|
|
group.writeEntry("maximizevertrule", int(Rules::Force));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
QScopedPointer<Surface> surface;
|
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 18:07:21 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
|
|
|
// 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-05-11 05:26:51 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 18:07:21 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
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.
|
|
|
|
QScopedPointer<Surface> surface;
|
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 18:07:21 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("maximizehoriz", true);
|
|
|
|
group.writeEntry("maximizehorizrule", int(Rules::ApplyNow));
|
|
|
|
group.writeEntry("maximizevert", true);
|
|
|
|
group.writeEntry("maximizevertrule", int(Rules::ApplyNow));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// 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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("maximizehoriz", true);
|
|
|
|
group.writeEntry("maximizehorizrule", int(Rules::ForceTemporarily));
|
|
|
|
group.writeEntry("maximizevert", true);
|
|
|
|
group.writeEntry("maximizevertrule", int(Rules::ForceTemporarily));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
|
|
|
QScopedPointer<Surface> surface;
|
|
|
|
surface.reset(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface;
|
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 18:07:21 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
|
|
|
// 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-05-11 05:26:51 +00:00
|
|
|
shellSurface.reset(Test::createXdgToplevelSurface(surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
|
|
|
|
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"));
|
2019-07-09 18:07:21 +00:00
|
|
|
surface->commit(Surface::CommitFlag::None);
|
|
|
|
|
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
|
|
|
{
|
[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
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("desktop", 2);
|
|
|
|
group.writeEntry("desktoprule", int(Rules::DontAffect));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
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
|
|
|
// 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);
|
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;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("desktop", 2);
|
|
|
|
group.writeEntry("desktoprule", int(Rules::Apply));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
[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
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("desktop", 2);
|
|
|
|
group.writeEntry("desktoprule", int(Rules::Remember));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
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
|
|
|
// 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);
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("desktop", 2);
|
|
|
|
group.writeEntry("desktoprule", int(Rules::Force));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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;
|
[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
|
|
|
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);
|
|
|
|
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("desktop", 2);
|
|
|
|
group.writeEntry("desktoprule", int(Rules::ApplyNow));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
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
|
|
|
{
|
[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
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("desktop", 2);
|
|
|
|
group.writeEntry("desktoprule", int(Rules::ForceTemporarily));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
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);
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("minimize", true);
|
|
|
|
group.writeEntry("minimizerule", int(Rules::DontAffect));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
[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
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("minimize", true);
|
|
|
|
group.writeEntry("minimizerule", int(Rules::Apply));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
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;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("minimize", false);
|
|
|
|
group.writeEntry("minimizerule", int(Rules::Remember));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
[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
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("minimize", false);
|
|
|
|
group.writeEntry("minimizerule", int(Rules::Force));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
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;
|
[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
|
|
|
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;
|
[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
|
|
|
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());
|
|
|
|
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("minimize", true);
|
|
|
|
group.writeEntry("minimizerule", int(Rules::ApplyNow));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// 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
|
|
|
{
|
[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
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("minimize", false);
|
|
|
|
group.writeEntry("minimizerule", int(Rules::ForceTemporarily));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
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;
|
[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
|
|
|
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
|
|
|
{
|
[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
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("skiptaskbar", true);
|
|
|
|
group.writeEntry("skiptaskbarrule", int(Rules::DontAffect));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
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;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("skiptaskbar", true);
|
|
|
|
group.writeEntry("skiptaskbarrule", int(Rules::Apply));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
[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
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("skiptaskbar", true);
|
|
|
|
group.writeEntry("skiptaskbarrule", int(Rules::Remember));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
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;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("skiptaskbar", true);
|
|
|
|
group.writeEntry("skiptaskbarrule", int(Rules::Force));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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;
|
[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
|
|
|
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());
|
|
|
|
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
2018-02-11 17:27:34 +00:00
|
|
|
config->group("General").writeEntry("count", 1);
|
[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
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("skiptaskbar", true);
|
|
|
|
group.writeEntry("skiptaskbarrule", int(Rules::ApplyNow));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("skiptaskbar", true);
|
|
|
|
group.writeEntry("skiptaskbarrule", int(Rules::ForceTemporarily));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
2018-02-11 17:27:34 +00:00
|
|
|
group.sync();
|
[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
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
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;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("skippager", true);
|
|
|
|
group.writeEntry("skippagerrule", int(Rules::DontAffect));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
2018-02-11 17:27:34 +00:00
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
[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;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("skippager", true);
|
|
|
|
group.writeEntry("skippagerrule", int(Rules::Apply));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
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;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("skippager", true);
|
|
|
|
group.writeEntry("skippagerrule", int(Rules::Remember));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("skippager", true);
|
|
|
|
group.writeEntry("skippagerrule", int(Rules::Force));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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;
|
[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
|
|
|
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());
|
|
|
|
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("skippager", true);
|
|
|
|
group.writeEntry("skippagerrule", int(Rules::ApplyNow));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// 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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("skippager", true);
|
|
|
|
group.writeEntry("skippagerrule", int(Rules::ForceTemporarily));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("skipswitcher", true);
|
|
|
|
group.writeEntry("skipswitcherrule", int(Rules::DontAffect));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("skipswitcher", true);
|
|
|
|
group.writeEntry("skipswitcherrule", int(Rules::Apply));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("skipswitcher", true);
|
|
|
|
group.writeEntry("skipswitcherrule", int(Rules::Remember));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("skipswitcher", true);
|
|
|
|
group.writeEntry("skipswitcherrule", int(Rules::Force));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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;
|
[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
|
|
|
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());
|
|
|
|
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("skipswitcher", true);
|
|
|
|
group.writeEntry("skipswitcherrule", int(Rules::ApplyNow));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// 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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("skipswitcher", true);
|
|
|
|
group.writeEntry("skipswitcherrule", int(Rules::ForceTemporarily));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("above", true);
|
|
|
|
group.writeEntry("aboverule", int(Rules::DontAffect));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("above", true);
|
|
|
|
group.writeEntry("aboverule", int(Rules::Apply));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("above", true);
|
|
|
|
group.writeEntry("aboverule", int(Rules::Remember));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("above", true);
|
|
|
|
group.writeEntry("aboverule", int(Rules::Force));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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;
|
[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
|
|
|
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());
|
|
|
|
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("above", true);
|
|
|
|
group.writeEntry("aboverule", int(Rules::ApplyNow));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// 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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("above", true);
|
|
|
|
group.writeEntry("aboverule", int(Rules::ForceTemporarily));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("below", true);
|
|
|
|
group.writeEntry("belowrule", int(Rules::DontAffect));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("below", true);
|
|
|
|
group.writeEntry("belowrule", int(Rules::Apply));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("below", true);
|
|
|
|
group.writeEntry("belowrule", int(Rules::Remember));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("below", true);
|
|
|
|
group.writeEntry("belowrule", int(Rules::Force));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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;
|
[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
|
|
|
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());
|
|
|
|
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("below", true);
|
|
|
|
group.writeEntry("belowrule", int(Rules::ApplyNow));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// 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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("below", true);
|
|
|
|
group.writeEntry("belowrule", int(Rules::ForceTemporarily));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("shortcut", "Ctrl+Alt+1");
|
|
|
|
group.writeEntry("shortcutrule", int(Rules::DontAffect));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("shortcut", "Ctrl+Alt+1");
|
|
|
|
group.writeEntry("shortcutrule", int(Rules::Apply));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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");
|
|
|
|
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("shortcut", "Ctrl+Alt+1");
|
|
|
|
group.writeEntry("shortcutrule", int(Rules::Remember));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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");
|
|
|
|
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("shortcut", "Ctrl+Alt+1");
|
|
|
|
group.writeEntry("shortcutrule", int(Rules::Force));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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;
|
[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
|
|
|
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());
|
|
|
|
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("shortcut", "Ctrl+Alt+1");
|
|
|
|
group.writeEntry("shortcutrule", int(Rules::ApplyNow));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// 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");
|
|
|
|
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("shortcut", "Ctrl+Alt+1");
|
|
|
|
group.writeEntry("shortcutrule", int(Rules::ForceTemporarily));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("opacityactive", 90);
|
|
|
|
group.writeEntry("opacityactiverule", int(Rules::DontAffect));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("opacityactive", 90);
|
|
|
|
group.writeEntry("opacityactiverule", int(Rules::Force));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("opacityactive", 90);
|
|
|
|
group.writeEntry("opacityactiverule", int(Rules::ForceTemporarily));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("opacityinactive", 80);
|
|
|
|
group.writeEntry("opacityinactiverule", int(Rules::DontAffect));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("opacityinactive", 80);
|
|
|
|
group.writeEntry("opacityinactiverule", int(Rules::Force));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
{
|
|
|
|
// Initialize RuleBook with the test rule.
|
|
|
|
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
KConfigGroup group = config->group("1");
|
|
|
|
group.writeEntry("opacityinactive", 80);
|
|
|
|
group.writeEntry("opacityinactiverule", int(Rules::ForceTemporarily));
|
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
|
|
|
group.sync();
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// Create the test client.
|
2020-03-04 07:55:26 +00:00
|
|
|
AbstractClient *client;
|
[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
|
|
|
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
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestXdgShellClientRules::testMatchAfterNameChange()
|
2018-03-12 17:06:33 +00:00
|
|
|
{
|
|
|
|
KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
|
|
|
config->group("General").writeEntry("count", 1);
|
|
|
|
|
[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
|
|
|
KConfigGroup group = config->group("1");
|
2018-03-12 17:06:33 +00:00
|
|
|
group.writeEntry("above", true);
|
[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
|
|
|
group.writeEntry("aboverule", int(Rules::Force));
|
2018-03-12 17:06:33 +00:00
|
|
|
group.writeEntry("wmclass", "org.kde.foo");
|
|
|
|
group.writeEntry("wmclasscomplete", false);
|
[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
|
|
|
group.writeEntry("wmclassmatch", int(Rules::ExactMatch));
|
2018-03-12 17:06:33 +00:00
|
|
|
group.sync();
|
|
|
|
|
|
|
|
RuleBook::self()->setConfig(config);
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
QScopedPointer<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"
|