Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/effects/scripted_effects_test.cpp
Show First 20 Lines • Show All 174 Lines • ▼ Show 20 Line(s) | |||||
175 | } | 175 | } | ||
176 | 176 | | |||
177 | void ScriptedEffectsTest::testEffectsHandler() | 177 | void ScriptedEffectsTest::testEffectsHandler() | ||
178 | { | 178 | { | ||
179 | // this triggers and tests some of the signals in EffectHandler, which is exposed to JS as context property "effects" | 179 | // this triggers and tests some of the signals in EffectHandler, which is exposed to JS as context property "effects" | ||
180 | auto *effect = new ScriptedEffectWithDebugSpy; // cleaned up in ::clean | 180 | auto *effect = new ScriptedEffectWithDebugSpy; // cleaned up in ::clean | ||
181 | QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput); | 181 | QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput); | ||
182 | auto waitFor = [&effectOutputSpy, this](const QString &expected) { | 182 | auto waitFor = [&effectOutputSpy, this](const QString &expected) { | ||
183 | QVERIFY(effectOutputSpy.count() == 1 || effectOutputSpy.wait()); | 183 | QVERIFY(effectOutputSpy.count() > 0 || effectOutputSpy.wait()); | ||
184 | QCOMPARE(effectOutputSpy.last().first(), expected); | 184 | QCOMPARE(effectOutputSpy.first().first(), expected); | ||
185 | effectOutputSpy.clear(); | 185 | effectOutputSpy.removeFirst(); | ||
186 | }; | 186 | }; | ||
187 | QVERIFY(effect->load("effectsHandler")); | 187 | QVERIFY(effect->load("effectsHandler")); | ||
188 | 188 | | |||
189 | // trigger windowAdded signal | 189 | // trigger windowAdded signal | ||
190 | 190 | | |||
191 | // create a window | 191 | // create a window | ||
192 | using namespace KWayland::Client; | 192 | using namespace KWayland::Client; | ||
193 | auto *surface = Test::createSurface(Test::waylandCompositor()); | 193 | auto *surface = Test::createSurface(Test::waylandCompositor()); | ||
194 | QVERIFY(surface); | 194 | QVERIFY(surface); | ||
195 | auto *shellSurface = Test::createXdgShellV6Surface(surface, surface); | 195 | auto *shellSurface = Test::createXdgShellV6Surface(surface, surface); | ||
196 | QVERIFY(shellSurface); | 196 | QVERIFY(shellSurface); | ||
197 | shellSurface->setTitle("Window 1"); | 197 | shellSurface->setTitle("WindowA"); | ||
198 | auto *c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue); | 198 | auto *c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue); | ||
199 | QVERIFY(c); | 199 | QVERIFY(c); | ||
200 | QCOMPARE(workspace()->activeClient(), c); | 200 | QCOMPARE(workspace()->activeClient(), c); | ||
201 | 201 | | |||
202 | waitFor("windowAdded - Window 1"); | 202 | waitFor("windowAdded - WindowA"); | ||
203 | waitFor("stackingOrder - 1 WindowA"); | ||||
203 | 204 | | |||
204 | // windowMinimsed | 205 | // windowMinimsed | ||
205 | c->minimize(); | 206 | c->minimize(); | ||
206 | waitFor("windowMinimized - Window 1"); | 207 | waitFor("windowMinimized - WindowA"); | ||
207 | 208 | | |||
208 | c->unminimize(); | 209 | c->unminimize(); | ||
209 | waitFor("windowUnminimized - Window 1"); | 210 | waitFor("windowUnminimized - WindowA"); | ||
210 | 211 | | |||
211 | surface->deleteLater(); | 212 | surface->deleteLater(); | ||
212 | waitFor("windowClosed - Window 1"); | 213 | waitFor("windowClosed - WindowA"); | ||
213 | 214 | | |||
214 | // desktop management | 215 | // desktop management | ||
215 | KWin::VirtualDesktopManager::self()->setCurrent(2); | 216 | KWin::VirtualDesktopManager::self()->setCurrent(2); | ||
216 | waitFor("desktopChanged - 1 2"); | 217 | waitFor("desktopChanged - 1 2"); | ||
217 | } | 218 | } | ||
218 | 219 | | |||
219 | void ScriptedEffectsTest::testEffectsContext() | 220 | void ScriptedEffectsTest::testEffectsContext() | ||
220 | { | 221 | { | ||
▲ Show 20 Lines • Show All 134 Lines • Show Last 20 Lines |