Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/effects/desktop_switching_animation_test.cpp
Show All 20 Lines | |||||
21 | #include "kwin_wayland_test.h" | 21 | #include "kwin_wayland_test.h" | ||
22 | 22 | | |||
23 | #include "abstract_client.h" | 23 | #include "abstract_client.h" | ||
24 | #include "composite.h" | 24 | #include "composite.h" | ||
25 | #include "effectloader.h" | 25 | #include "effectloader.h" | ||
26 | #include "effects.h" | 26 | #include "effects.h" | ||
27 | #include "platform.h" | 27 | #include "platform.h" | ||
28 | #include "scene.h" | 28 | #include "scene.h" | ||
29 | #include "xdgshellclient.h" | | |||
30 | #include "wayland_server.h" | 29 | #include "wayland_server.h" | ||
31 | #include "workspace.h" | 30 | #include "workspace.h" | ||
32 | 31 | | |||
33 | #include "effect_builtins.h" | 32 | #include "effect_builtins.h" | ||
34 | 33 | | |||
35 | #include <KWayland/Client/surface.h> | 34 | #include <KWayland/Client/surface.h> | ||
36 | #include <KWayland/Client/xdgshell.h> | 35 | #include <KWayland/Client/xdgshell.h> | ||
37 | 36 | | |||
Show All 14 Lines | 45 | private Q_SLOTS: | |||
52 | void testSwitchDesktops(); | 51 | void testSwitchDesktops(); | ||
53 | }; | 52 | }; | ||
54 | 53 | | |||
55 | void DesktopSwitchingAnimationTest::initTestCase() | 54 | void DesktopSwitchingAnimationTest::initTestCase() | ||
56 | { | 55 | { | ||
57 | qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8()); | 56 | qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8()); | ||
58 | 57 | | |||
59 | qRegisterMetaType<KWin::AbstractClient *>(); | 58 | qRegisterMetaType<KWin::AbstractClient *>(); | ||
60 | qRegisterMetaType<KWin::XdgShellClient *>(); | | |||
61 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 59 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
62 | QVERIFY(workspaceCreatedSpy.isValid()); | 60 | QVERIFY(workspaceCreatedSpy.isValid()); | ||
63 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | 61 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | ||
64 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | 62 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | ||
65 | 63 | | |||
66 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 64 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
67 | KConfigGroup plugins(config, QStringLiteral("Plugins")); | 65 | KConfigGroup plugins(config, QStringLiteral("Plugins")); | ||
68 | ScriptedEffectLoader loader; | 66 | ScriptedEffectLoader loader; | ||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | 113 | { | |||
123 | 121 | | |||
124 | // The Fade Desktop effect will do nothing if there are no clients to fade, | 122 | // The Fade Desktop effect will do nothing if there are no clients to fade, | ||
125 | // so we have to create a dummy test client. | 123 | // so we have to create a dummy test client. | ||
126 | using namespace KWayland::Client; | 124 | using namespace KWayland::Client; | ||
127 | QScopedPointer<Surface> surface(Test::createSurface()); | 125 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
128 | QVERIFY(!surface.isNull()); | 126 | QVERIFY(!surface.isNull()); | ||
129 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 127 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
130 | QVERIFY(!shellSurface.isNull()); | 128 | QVERIFY(!shellSurface.isNull()); | ||
131 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 129 | AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
132 | QVERIFY(client); | 130 | QVERIFY(client); | ||
133 | QCOMPARE(client->desktops().count(), 1); | 131 | QCOMPARE(client->desktops().count(), 1); | ||
134 | QCOMPARE(client->desktops().first(), VirtualDesktopManager::self()->desktops().first()); | 132 | QCOMPARE(client->desktops().first(), VirtualDesktopManager::self()->desktops().first()); | ||
135 | 133 | | |||
136 | // Load effect that will be tested. | 134 | // Load effect that will be tested. | ||
137 | QFETCH(QString, effectName); | 135 | QFETCH(QString, effectName); | ||
138 | auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects); | 136 | auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects); | ||
139 | QVERIFY(effectsImpl); | 137 | QVERIFY(effectsImpl); | ||
Show All 24 Lines |