14#include "virtualdesktops.h"
19#include <KWayland/Client/surface.h>
23static const QString s_socketName = QStringLiteral(
"wayland_test_effects_desktop_switching_animation-0");
34 void testSwitchDesktops_data();
35 void testSwitchDesktops();
38void DesktopSwitchingAnimationTest::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 DesktopSwitchingAnimationTest::init()
75void DesktopSwitchingAnimationTest::cleanup()
81 VirtualDesktopManager::self()->setCount(1);
86void DesktopSwitchingAnimationTest::testSwitchDesktops_data()
88 QTest::addColumn<QString>(
"effectName");
90 QTest::newRow(
"Fade Desktop") << QStringLiteral(
"fadedesktop");
91 QTest::newRow(
"Slide") << QStringLiteral(
"slide");
94void DesktopSwitchingAnimationTest::testSwitchDesktops()
100 VirtualDesktopManager::self()->setCount(2);
101 QCOMPARE(VirtualDesktopManager::self()->current(), 1u);
102 QCOMPARE(VirtualDesktopManager::self()->count(), 2u);
107 QVERIFY(surface !=
nullptr);
109 QVERIFY(shellSurface !=
nullptr);
112 QCOMPARE(window->desktops().count(), 1);
113 QCOMPARE(window->desktops().first(), VirtualDesktopManager::self()->desktops().first());
116 QFETCH(QString, effectName);
126 VirtualDesktopManager::self()->setCurrent(2u);
127 QCOMPARE(VirtualDesktopManager::self()->current(), 2u);
141#include "desktop_switching_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
Effect * activeFullScreenEffect() const
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())
bool renderNodeAvailable()
std::unique_ptr< KWayland::Client::Surface > createSurface()
XdgToplevel * createXdgToplevelSurface(KWayland::Client::Surface *surface, QObject *parent=nullptr)
bool waitForWindowClosed(Window *window)
WaylandServer * waylandServer()