18#include <KWayland/Client/surface.h>
22static const QString s_socketName = QStringLiteral(
"wayland_test_effects_toplevel_open_close_animation-0");
33 void testAnimateToplevels_data();
34 void testAnimateToplevels();
35 void testDontAnimatePopups_data();
36 void testDontAnimatePopups();
39void ToplevelOpenCloseAnimationTest::initTestCase()
42 QSKIP(
"no render node available");
45 qputenv(
"XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
47 qRegisterMetaType<KWin::Window *>();
51 QRect(0, 0, 1280, 1024),
52 QRect(1280, 0, 1280, 1024),
55 auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
56 KConfigGroup plugins(config, QStringLiteral(
"Plugins"));
58 for (
const QString &name : builtinNames) {
59 plugins.writeEntry(name + QStringLiteral(
"Enabled"),
false);
62 kwinApp()->setConfig(config);
64 qputenv(
"KWIN_COMPOSE", QByteArrayLiteral(
"O2"));
65 qputenv(
"KWIN_EFFECTS_FORCE_ANIMATIONS", QByteArrayLiteral(
"1"));
68 QVERIFY(applicationStartedSpy.wait());
71void ToplevelOpenCloseAnimationTest::init()
76void ToplevelOpenCloseAnimationTest::cleanup()
84void ToplevelOpenCloseAnimationTest::testAnimateToplevels_data()
86 QTest::addColumn<QString>(
"effectName");
88 QTest::newRow(
"Fade") << QStringLiteral(
"fade");
89 QTest::newRow(
"Glide") << QStringLiteral(
"glide");
90 QTest::newRow(
"Scale") << QStringLiteral(
"scale");
93void ToplevelOpenCloseAnimationTest::testAnimateToplevels()
99 QFETCH(QString, effectName);
109 QVERIFY(surface !=
nullptr);
111 QVERIFY(shellSurface !=
nullptr);
121 QSignalSpy windowClosedSpy(window, &Window::closed);
122 shellSurface.reset();
124 QVERIFY(windowClosedSpy.wait());
131void ToplevelOpenCloseAnimationTest::testDontAnimatePopups_data()
133 QTest::addColumn<QString>(
"effectName");
135 QTest::newRow(
"Fade") << QStringLiteral(
"fade");
136 QTest::newRow(
"Glide") << QStringLiteral(
"glide");
137 QTest::newRow(
"Scale") << QStringLiteral(
"scale");
140void ToplevelOpenCloseAnimationTest::testDontAnimatePopups()
147 QVERIFY(mainWindowSurface !=
nullptr);
149 QVERIFY(mainWindowShellSurface !=
nullptr);
154 QFETCH(QString, effectName);
164 QVERIFY(popupSurface !=
nullptr);
167 positioner->set_size(20, 20);
168 positioner->set_anchor_rect(0, 0, 10, 10);
169 positioner->set_gravity(Test::XdgPositioner::gravity_bottom_right);
170 positioner->set_anchor(Test::XdgPositioner::anchor_bottom_left);
171 std::unique_ptr<Test::XdgPopup> popupShellSurface(
Test::createXdgPopupSurface(popupSurface.get(), mainWindowShellSurface->xdgSurface(), positioner.get()));
172 QVERIFY(popupShellSurface !=
nullptr);
175 QVERIFY(popup->isPopupWindow());
176 QCOMPARE(popup->transientFor(), mainWindow);
180 QSignalSpy popupClosedSpy(popup, &Window::closed);
181 popupShellSurface.reset();
182 popupSurface.reset();
183 QVERIFY(popupClosedSpy.wait());
187 mainWindowSurface.reset();
192#include "toplevel_open_close_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
virtual bool isActive() const
#define WAYLANDTEST_MAIN(TestObject)
XdgPositioner * createXdgPositioner()
Window * renderAndWaitForShown(KWayland::Client::Surface *surface, const QSize &size, const QColor &color, const QImage::Format &format=QImage::Format_ARGB32, int timeout=5000)
XdgPopup * createXdgPopupSurface(KWayland::Client::Surface *surface, XdgSurface *parentSurface, XdgPositioner *positioner, CreationSetup configureMode=CreationSetup::CreateAndConfigure, QObject *parent=nullptr)
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()