Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/dont_crash_reinitialize_compositor.cpp
Show All 21 Lines | |||||
22 | 22 | | |||
23 | #include "abstract_client.h" | 23 | #include "abstract_client.h" | ||
24 | #include "composite.h" | 24 | #include "composite.h" | ||
25 | #include "deleted.h" | 25 | #include "deleted.h" | ||
26 | #include "effectloader.h" | 26 | #include "effectloader.h" | ||
27 | #include "effects.h" | 27 | #include "effects.h" | ||
28 | #include "platform.h" | 28 | #include "platform.h" | ||
29 | #include "screens.h" | 29 | #include "screens.h" | ||
30 | #include "shell_client.h" | 30 | #include "xdgshellclient.h" | ||
31 | #include "wayland_server.h" | 31 | #include "wayland_server.h" | ||
32 | #include "workspace.h" | 32 | #include "workspace.h" | ||
33 | 33 | | |||
34 | #include "effect_builtins.h" | 34 | #include "effect_builtins.h" | ||
35 | 35 | | |||
36 | #include <KWayland/Client/surface.h> | 36 | #include <KWayland/Client/surface.h> | ||
37 | #include <KWayland/Client/xdgshell.h> | 37 | #include <KWayland/Client/xdgshell.h> | ||
38 | 38 | | |||
Show All 16 Lines | |||||
55 | }; | 55 | }; | ||
56 | 56 | | |||
57 | void DontCrashReinitializeCompositorTest::initTestCase() | 57 | void DontCrashReinitializeCompositorTest::initTestCase() | ||
58 | { | 58 | { | ||
59 | qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8()); | 59 | qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8()); | ||
60 | 60 | | |||
61 | qRegisterMetaType<KWin::AbstractClient *>(); | 61 | qRegisterMetaType<KWin::AbstractClient *>(); | ||
62 | qRegisterMetaType<KWin::Deleted *>(); | 62 | qRegisterMetaType<KWin::Deleted *>(); | ||
63 | qRegisterMetaType<KWin::ShellClient *>(); | 63 | qRegisterMetaType<KWin::XdgShellClient *>(); | ||
64 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 64 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
65 | QVERIFY(workspaceCreatedSpy.isValid()); | 65 | QVERIFY(workspaceCreatedSpy.isValid()); | ||
66 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | 66 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | ||
67 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | 67 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | ||
68 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | 68 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | ||
69 | 69 | | |||
70 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 70 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
71 | KConfigGroup plugins(config, QStringLiteral("Plugins")); | 71 | KConfigGroup plugins(config, QStringLiteral("Plugins")); | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 121 | { | |||
129 | 129 | | |||
130 | // Create the test client. | 130 | // Create the test client. | ||
131 | using namespace KWayland::Client; | 131 | using namespace KWayland::Client; | ||
132 | 132 | | |||
133 | QScopedPointer<Surface> surface(Test::createSurface()); | 133 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
134 | QVERIFY(!surface.isNull()); | 134 | QVERIFY(!surface.isNull()); | ||
135 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 135 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
136 | QVERIFY(!shellSurface.isNull()); | 136 | QVERIFY(!shellSurface.isNull()); | ||
137 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 137 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
138 | QVERIFY(client); | 138 | QVERIFY(client); | ||
139 | 139 | | |||
140 | // Make sure that only the test effect is loaded. | 140 | // Make sure that only the test effect is loaded. | ||
141 | QFETCH(QString, effectName); | 141 | QFETCH(QString, effectName); | ||
142 | QVERIFY(effectsImpl->loadEffect(effectName)); | 142 | QVERIFY(effectsImpl->loadEffect(effectName)); | ||
143 | QCOMPARE(effectsImpl->loadedEffects().count(), 1); | 143 | QCOMPARE(effectsImpl->loadedEffects().count(), 1); | ||
144 | QCOMPARE(effectsImpl->loadedEffects().first(), effectName); | 144 | QCOMPARE(effectsImpl->loadedEffects().first(), effectName); | ||
145 | Effect *effect = effectsImpl->findEffect(effectName); | 145 | Effect *effect = effectsImpl->findEffect(effectName); | ||
146 | QVERIFY(effect); | 146 | QVERIFY(effect); | ||
147 | QVERIFY(!effect->isActive()); | 147 | QVERIFY(!effect->isActive()); | ||
148 | 148 | | |||
149 | // Close the test client. | 149 | // Close the test client. | ||
150 | QSignalSpy windowClosedSpy(client, &ShellClient::windowClosed); | 150 | QSignalSpy windowClosedSpy(client, &XdgShellClient::windowClosed); | ||
151 | QVERIFY(windowClosedSpy.isValid()); | 151 | QVERIFY(windowClosedSpy.isValid()); | ||
152 | shellSurface.reset(); | 152 | shellSurface.reset(); | ||
153 | surface.reset(); | 153 | surface.reset(); | ||
154 | QVERIFY(windowClosedSpy.wait()); | 154 | QVERIFY(windowClosedSpy.wait()); | ||
155 | 155 | | |||
156 | // The test effect should start animating the test client. Is there a better | 156 | // The test effect should start animating the test client. Is there a better | ||
157 | // way to verify that the test effect actually animates the test client? | 157 | // way to verify that the test effect actually animates the test client? | ||
158 | QVERIFY(effect->isActive()); | 158 | QVERIFY(effect->isActive()); | ||
Show All 11 Lines |