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