18#include <KWayland/Client/plasmawindowmanagement.h>
19#include <KWayland/Client/surface.h>
23static const QString s_socketName = QStringLiteral(
"wayland_test_effects_minimize_animation-0");
34 void testMinimizeUnminimize_data();
35 void testMinimizeUnminimize();
38void MinimizeAnimationTest::initTestCase()
41 QSKIP(
"no render node available");
44 qputenv(
"XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
46 qRegisterMetaType<KWin::Window *>();
50 QRect(0, 0, 1280, 1024),
51 QRect(1280, 0, 1280, 1024),
54 auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
55 KConfigGroup plugins(config, QStringLiteral(
"Plugins"));
57 for (
const QString &name : builtinNames) {
58 plugins.writeEntry(name + QStringLiteral(
"Enabled"),
false);
61 kwinApp()->setConfig(config);
63 qputenv(
"KWIN_COMPOSE", QByteArrayLiteral(
"O2"));
64 qputenv(
"KWIN_EFFECTS_FORCE_ANIMATIONS", QByteArrayLiteral(
"1"));
67 QVERIFY(applicationStartedSpy.wait());
70void MinimizeAnimationTest::init()
72 QVERIFY(
Test::setupWaylandConnection(Test::AdditionalWaylandInterface::LayerShellV1 | Test::AdditionalWaylandInterface::WindowManagement));
75void MinimizeAnimationTest::cleanup()
84void MinimizeAnimationTest::testMinimizeUnminimize_data()
86 QTest::addColumn<QString>(
"effectName");
88 QTest::newRow(
"Magic Lamp") << QStringLiteral(
"magiclamp");
89 QTest::newRow(
"Squash") << QStringLiteral(
"squash");
92void MinimizeAnimationTest::testMinimizeUnminimize()
99 const QRect panelRect = QRect(0, 0, 1280, 36);
101 std::unique_ptr<Test::LayerSurfaceV1> panelShellSurface{
Test::createLayerSurfaceV1(panelSurface.get(), QStringLiteral(
"dock"))};
102 panelShellSurface->set_size(panelRect.width(), panelRect.height());
103 panelShellSurface->set_exclusive_zone(panelRect.height());
104 panelShellSurface->set_anchor(Test::LayerSurfaceV1::anchor_top);
105 panelSurface->commit(KWayland::Client::Surface::CommitFlag::None);
108 QVERIFY(panelConfigureRequestedSpy.wait());
111 QVERIFY(panel->isDock());
112 QCOMPARE(panel->frameGeometry(), panelRect);
117 QVERIFY(surface !=
nullptr);
119 QVERIFY(shellSurface !=
nullptr);
122 QVERIFY(plasmaWindowCreatedSpy.wait());
123 QCOMPARE(plasmaWindowCreatedSpy.count(), 1);
127 auto plasmaWindow = plasmaWindowCreatedSpy.last().first().value<KWayland::Client::PlasmaWindow *>();
128 QVERIFY(plasmaWindow);
129 const QRect iconRect = QRect(0, 0, 42, 36);
130 plasmaWindow->setMinimizedGeometry(panelSurface.get(), iconRect);
132 QTRY_COMPARE(window->iconGeometry(), iconRect.translated(panel->frameGeometry().topLeft().toPoint()));
135 QFETCH(QString, effectName);
145 window->setMinimized(
true);
152 window->setMinimized(
false);
159 panelSurface.reset();
168#include "minimize_animation_test.moc"
Base class for all KWin effects.
QStringList listOfKnownEffects() const override
All the Effects this loader knows of.
QStringList loadedEffects
Q_SCRIPTABLE bool loadEffect(const QString &name)
Effect * findEffect(const QString &name) const
void configureRequested(quint32 serial, const QSize &size)
virtual bool isActive() const
#define WAYLANDTEST_MAIN(TestObject)
Window * renderAndWaitForShown(KWayland::Client::Surface *surface, const QSize &size, const QColor &color, const QImage::Format &format=QImage::Format_ARGB32, int timeout=5000)
void destroyWaylandConnection()
void setOutputConfig(const QList< QRect > &geometries)
bool setupWaylandConnection(AdditionalWaylandInterfaces flags=AdditionalWaylandInterfaces())
KWayland::Client::PlasmaWindowManagement * waylandWindowManagement()
LayerSurfaceV1 * createLayerSurfaceV1(KWayland::Client::Surface *surface, const QString &scope, KWayland::Client::Output *output=nullptr, LayerShellV1::layer layer=LayerShellV1::layer_top)
bool renderNodeAvailable()
std::unique_ptr< KWayland::Client::Surface > createSurface()
XdgToplevel * createXdgToplevelSurface(KWayland::Client::Surface *surface, QObject *parent=nullptr)
void flushWaylandConnection()
bool waitForWindowClosed(Window *window)
WaylandServer * waylandServer()