Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/effects/popup_open_close_animation_test.cpp
Show All 18 Lines | |||||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | 20 | | |||
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 "deleted.h" | 24 | #include "deleted.h" | ||
25 | #include "effectloader.h" | 25 | #include "effectloader.h" | ||
26 | #include "effects.h" | 26 | #include "effects.h" | ||
27 | #include "internal_client.h" | ||||
27 | #include "platform.h" | 28 | #include "platform.h" | ||
28 | #include "shell_client.h" | 29 | #include "shell_client.h" | ||
29 | #include "useractions.h" | 30 | #include "useractions.h" | ||
30 | #include "wayland_server.h" | 31 | #include "wayland_server.h" | ||
31 | #include "workspace.h" | 32 | #include "workspace.h" | ||
32 | 33 | | |||
33 | #include "decorations/decoratedclient.h" | 34 | #include "decorations/decoratedclient.h" | ||
34 | 35 | | |||
Show All 24 Lines | |||||
59 | }; | 60 | }; | ||
60 | 61 | | |||
61 | void PopupOpenCloseAnimationTest::initTestCase() | 62 | void PopupOpenCloseAnimationTest::initTestCase() | ||
62 | { | 63 | { | ||
63 | qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8()); | 64 | qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8()); | ||
64 | 65 | | |||
65 | qRegisterMetaType<KWin::AbstractClient *>(); | 66 | qRegisterMetaType<KWin::AbstractClient *>(); | ||
66 | qRegisterMetaType<KWin::Deleted *>(); | 67 | qRegisterMetaType<KWin::Deleted *>(); | ||
68 | qRegisterMetaType<KWin::InternalClient *>(); | ||||
67 | qRegisterMetaType<KWin::ShellClient *>(); | 69 | qRegisterMetaType<KWin::ShellClient *>(); | ||
68 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 70 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
69 | QVERIFY(workspaceCreatedSpy.isValid()); | 71 | QVERIFY(workspaceCreatedSpy.isValid()); | ||
70 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | 72 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | ||
71 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | 73 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | ||
72 | 74 | | |||
73 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 75 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
74 | KConfigGroup plugins(config, QStringLiteral("Plugins")); | 76 | KConfigGroup plugins(config, QStringLiteral("Plugins")); | ||
▲ Show 20 Lines • Show All 168 Lines • ▼ Show 20 Line(s) | 222 | { | |||
243 | QVERIFY(effectsImpl->loadEffect(effectName)); | 245 | QVERIFY(effectsImpl->loadEffect(effectName)); | ||
244 | QCOMPARE(effectsImpl->loadedEffects().count(), 1); | 246 | QCOMPARE(effectsImpl->loadedEffects().count(), 1); | ||
245 | QCOMPARE(effectsImpl->loadedEffects().first(), effectName); | 247 | QCOMPARE(effectsImpl->loadedEffects().first(), effectName); | ||
246 | Effect *effect = effectsImpl->findEffect(effectName); | 248 | Effect *effect = effectsImpl->findEffect(effectName); | ||
247 | QVERIFY(effect); | 249 | QVERIFY(effect); | ||
248 | QVERIFY(!effect->isActive()); | 250 | QVERIFY(!effect->isActive()); | ||
249 | 251 | | |||
250 | // Show a decoration tooltip. | 252 | // Show a decoration tooltip. | ||
251 | QSignalSpy tooltipAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 253 | QSignalSpy tooltipAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
252 | QVERIFY(tooltipAddedSpy.isValid()); | 254 | QVERIFY(tooltipAddedSpy.isValid()); | ||
253 | client->decoratedClient()->requestShowToolTip(QStringLiteral("KWin rocks!")); | 255 | client->decoratedClient()->requestShowToolTip(QStringLiteral("KWin rocks!")); | ||
254 | QVERIFY(tooltipAddedSpy.wait()); | 256 | QVERIFY(tooltipAddedSpy.wait()); | ||
255 | ShellClient *tooltip = tooltipAddedSpy.first().first().value<ShellClient *>(); | 257 | InternalClient *tooltip = tooltipAddedSpy.first().first().value<InternalClient *>(); | ||
256 | QVERIFY(tooltip->isInternal()); | 258 | QVERIFY(tooltip->isInternal()); | ||
257 | QVERIFY(tooltip->isPopupWindow()); | 259 | QVERIFY(tooltip->isPopupWindow()); | ||
258 | QVERIFY(tooltip->internalWindow()->flags().testFlag(Qt::ToolTip)); | 260 | QVERIFY(tooltip->internalWindow()->flags().testFlag(Qt::ToolTip)); | ||
259 | QVERIFY(effect->isActive()); | 261 | QVERIFY(effect->isActive()); | ||
260 | 262 | | |||
261 | // Eventually, the animation will be complete. | 263 | // Eventually, the animation will be complete. | ||
262 | QTRY_VERIFY(!effect->isActive()); | 264 | QTRY_VERIFY(!effect->isActive()); | ||
263 | 265 | | |||
264 | // Hide the decoration tooltip. | 266 | // Hide the decoration tooltip. | ||
265 | QSignalSpy tooltipClosedSpy(tooltip, &ShellClient::windowClosed); | 267 | QSignalSpy tooltipClosedSpy(tooltip, &InternalClient::windowClosed); | ||
266 | QVERIFY(tooltipClosedSpy.isValid()); | 268 | QVERIFY(tooltipClosedSpy.isValid()); | ||
267 | client->decoratedClient()->requestHideToolTip(); | 269 | client->decoratedClient()->requestHideToolTip(); | ||
268 | QVERIFY(tooltipClosedSpy.wait()); | 270 | QVERIFY(tooltipClosedSpy.wait()); | ||
269 | QVERIFY(effect->isActive()); | 271 | QVERIFY(effect->isActive()); | ||
270 | 272 | | |||
271 | // Eventually, the animation will be complete. | 273 | // Eventually, the animation will be complete. | ||
272 | QTRY_VERIFY(!effect->isActive()); | 274 | QTRY_VERIFY(!effect->isActive()); | ||
273 | 275 | | |||
274 | // Destroy the test client. | 276 | // Destroy the test client. | ||
275 | surface.reset(); | 277 | surface.reset(); | ||
276 | QVERIFY(Test::waitForWindowDestroyed(client)); | 278 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
277 | } | 279 | } | ||
278 | 280 | | |||
279 | WAYLANDTEST_MAIN(PopupOpenCloseAnimationTest) | 281 | WAYLANDTEST_MAIN(PopupOpenCloseAnimationTest) | ||
280 | #include "popup_open_close_animation_test.moc" | 282 | #include "popup_open_close_animation_test.moc" |