Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/effects/popup_open_close_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 "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 "internal_client.h" | ||
28 | #include "platform.h" | 28 | #include "platform.h" | ||
29 | #include "shell_client.h" | 29 | #include "xdgshellclient.h" | ||
30 | #include "useractions.h" | 30 | #include "useractions.h" | ||
31 | #include "wayland_server.h" | 31 | #include "wayland_server.h" | ||
32 | #include "workspace.h" | 32 | #include "workspace.h" | ||
33 | 33 | | |||
34 | #include "decorations/decoratedclient.h" | 34 | #include "decorations/decoratedclient.h" | ||
35 | 35 | | |||
36 | #include "effect_builtins.h" | 36 | #include "effect_builtins.h" | ||
37 | 37 | | |||
Show All 23 Lines | |||||
61 | 61 | | |||
62 | void PopupOpenCloseAnimationTest::initTestCase() | 62 | void PopupOpenCloseAnimationTest::initTestCase() | ||
63 | { | 63 | { | ||
64 | qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8()); | 64 | qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8()); | ||
65 | 65 | | |||
66 | qRegisterMetaType<KWin::AbstractClient *>(); | 66 | qRegisterMetaType<KWin::AbstractClient *>(); | ||
67 | qRegisterMetaType<KWin::Deleted *>(); | 67 | qRegisterMetaType<KWin::Deleted *>(); | ||
68 | qRegisterMetaType<KWin::InternalClient *>(); | 68 | qRegisterMetaType<KWin::InternalClient *>(); | ||
69 | qRegisterMetaType<KWin::ShellClient *>(); | 69 | qRegisterMetaType<KWin::XdgShellClient *>(); | ||
70 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 70 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
71 | QVERIFY(workspaceCreatedSpy.isValid()); | 71 | QVERIFY(workspaceCreatedSpy.isValid()); | ||
72 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | 72 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | ||
73 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | 73 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | ||
74 | 74 | | |||
75 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 75 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
76 | KConfigGroup plugins(config, QStringLiteral("Plugins")); | 76 | KConfigGroup plugins(config, QStringLiteral("Plugins")); | ||
77 | ScriptedEffectLoader loader; | 77 | ScriptedEffectLoader loader; | ||
Show All 36 Lines | 108 | { | |||
114 | QVERIFY(effectsImpl); | 114 | QVERIFY(effectsImpl); | ||
115 | 115 | | |||
116 | // Create the main window. | 116 | // Create the main window. | ||
117 | using namespace KWayland::Client; | 117 | using namespace KWayland::Client; | ||
118 | QScopedPointer<Surface> mainWindowSurface(Test::createSurface()); | 118 | QScopedPointer<Surface> mainWindowSurface(Test::createSurface()); | ||
119 | QVERIFY(!mainWindowSurface.isNull()); | 119 | QVERIFY(!mainWindowSurface.isNull()); | ||
120 | QScopedPointer<XdgShellSurface> mainWindowShellSurface(Test::createXdgShellStableSurface(mainWindowSurface.data())); | 120 | QScopedPointer<XdgShellSurface> mainWindowShellSurface(Test::createXdgShellStableSurface(mainWindowSurface.data())); | ||
121 | QVERIFY(!mainWindowShellSurface.isNull()); | 121 | QVERIFY(!mainWindowShellSurface.isNull()); | ||
122 | ShellClient *mainWindow = Test::renderAndWaitForShown(mainWindowSurface.data(), QSize(100, 50), Qt::blue); | 122 | XdgShellClient *mainWindow = Test::renderAndWaitForShown(mainWindowSurface.data(), QSize(100, 50), Qt::blue); | ||
123 | QVERIFY(mainWindow); | 123 | QVERIFY(mainWindow); | ||
124 | 124 | | |||
125 | // Load effect that will be tested. | 125 | // Load effect that will be tested. | ||
126 | const QString effectName = QStringLiteral("kwin4_effect_fadingpopups"); | 126 | const QString effectName = QStringLiteral("kwin4_effect_fadingpopups"); | ||
127 | QVERIFY(effectsImpl->loadEffect(effectName)); | 127 | QVERIFY(effectsImpl->loadEffect(effectName)); | ||
128 | QCOMPARE(effectsImpl->loadedEffects().count(), 1); | 128 | QCOMPARE(effectsImpl->loadedEffects().count(), 1); | ||
129 | QCOMPARE(effectsImpl->loadedEffects().first(), effectName); | 129 | QCOMPARE(effectsImpl->loadedEffects().first(), effectName); | ||
130 | Effect *effect = effectsImpl->findEffect(effectName); | 130 | Effect *effect = effectsImpl->findEffect(effectName); | ||
131 | QVERIFY(effect); | 131 | QVERIFY(effect); | ||
132 | QVERIFY(!effect->isActive()); | 132 | QVERIFY(!effect->isActive()); | ||
133 | 133 | | |||
134 | // Create a popup, it should be animated. | 134 | // Create a popup, it should be animated. | ||
135 | QScopedPointer<Surface> popupSurface(Test::createSurface()); | 135 | QScopedPointer<Surface> popupSurface(Test::createSurface()); | ||
136 | QVERIFY(!popupSurface.isNull()); | 136 | QVERIFY(!popupSurface.isNull()); | ||
137 | XdgPositioner positioner(QSize(20, 20), QRect(0, 0, 10, 10)); | 137 | XdgPositioner positioner(QSize(20, 20), QRect(0, 0, 10, 10)); | ||
138 | positioner.setGravity(Qt::BottomEdge | Qt::RightEdge); | 138 | positioner.setGravity(Qt::BottomEdge | Qt::RightEdge); | ||
139 | positioner.setAnchorEdge(Qt::BottomEdge | Qt::LeftEdge); | 139 | positioner.setAnchorEdge(Qt::BottomEdge | Qt::LeftEdge); | ||
140 | QScopedPointer<XdgShellPopup> popupShellSurface(Test::createXdgShellStablePopup(popupSurface.data(), mainWindowShellSurface.data(), positioner)); | 140 | QScopedPointer<XdgShellPopup> popupShellSurface(Test::createXdgShellStablePopup(popupSurface.data(), mainWindowShellSurface.data(), positioner)); | ||
141 | QVERIFY(!popupShellSurface.isNull()); | 141 | QVERIFY(!popupShellSurface.isNull()); | ||
142 | ShellClient *popup = Test::renderAndWaitForShown(popupSurface.data(), positioner.initialSize(), Qt::red); | 142 | XdgShellClient *popup = Test::renderAndWaitForShown(popupSurface.data(), positioner.initialSize(), Qt::red); | ||
143 | QVERIFY(popup); | 143 | QVERIFY(popup); | ||
144 | QVERIFY(popup->isPopupWindow()); | 144 | QVERIFY(popup->isPopupWindow()); | ||
145 | QCOMPARE(popup->transientFor(), mainWindow); | 145 | QCOMPARE(popup->transientFor(), mainWindow); | ||
146 | QVERIFY(effect->isActive()); | 146 | QVERIFY(effect->isActive()); | ||
147 | 147 | | |||
148 | // Eventually, the animation will be complete. | 148 | // Eventually, the animation will be complete. | ||
149 | QTRY_VERIFY(!effect->isActive()); | 149 | QTRY_VERIFY(!effect->isActive()); | ||
150 | 150 | | |||
151 | // Destroy the popup, it should not be animated. | 151 | // Destroy the popup, it should not be animated. | ||
152 | QSignalSpy popupClosedSpy(popup, &ShellClient::windowClosed); | 152 | QSignalSpy popupClosedSpy(popup, &XdgShellClient::windowClosed); | ||
153 | QVERIFY(popupClosedSpy.isValid()); | 153 | QVERIFY(popupClosedSpy.isValid()); | ||
154 | popupShellSurface.reset(); | 154 | popupShellSurface.reset(); | ||
155 | popupSurface.reset(); | 155 | popupSurface.reset(); | ||
156 | QVERIFY(popupClosedSpy.wait()); | 156 | QVERIFY(popupClosedSpy.wait()); | ||
157 | QVERIFY(effect->isActive()); | 157 | QVERIFY(effect->isActive()); | ||
158 | 158 | | |||
159 | // Eventually, the animation will be complete. | 159 | // Eventually, the animation will be complete. | ||
160 | QTRY_VERIFY(!effect->isActive()); | 160 | QTRY_VERIFY(!effect->isActive()); | ||
Show All 15 Lines | 168 | { | |||
176 | QVERIFY(effectsImpl); | 176 | QVERIFY(effectsImpl); | ||
177 | 177 | | |||
178 | // Create the test client. | 178 | // Create the test client. | ||
179 | using namespace KWayland::Client; | 179 | using namespace KWayland::Client; | ||
180 | QScopedPointer<Surface> surface(Test::createSurface()); | 180 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
181 | QVERIFY(!surface.isNull()); | 181 | QVERIFY(!surface.isNull()); | ||
182 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 182 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
183 | QVERIFY(!shellSurface.isNull()); | 183 | QVERIFY(!shellSurface.isNull()); | ||
184 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 184 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
185 | QVERIFY(client); | 185 | QVERIFY(client); | ||
186 | 186 | | |||
187 | // Load effect that will be tested. | 187 | // Load effect that will be tested. | ||
188 | const QString effectName = QStringLiteral("kwin4_effect_fadingpopups"); | 188 | const QString effectName = QStringLiteral("kwin4_effect_fadingpopups"); | ||
189 | QVERIFY(effectsImpl->loadEffect(effectName)); | 189 | QVERIFY(effectsImpl->loadEffect(effectName)); | ||
190 | QCOMPARE(effectsImpl->loadedEffects().count(), 1); | 190 | QCOMPARE(effectsImpl->loadedEffects().count(), 1); | ||
191 | QCOMPARE(effectsImpl->loadedEffects().first(), effectName); | 191 | QCOMPARE(effectsImpl->loadedEffects().first(), effectName); | ||
192 | Effect *effect = effectsImpl->findEffect(effectName); | 192 | Effect *effect = effectsImpl->findEffect(effectName); | ||
Show All 38 Lines | 222 | { | |||
231 | using namespace KWayland::Client; | 231 | using namespace KWayland::Client; | ||
232 | QScopedPointer<Surface> surface(Test::createSurface()); | 232 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
233 | QVERIFY(!surface.isNull()); | 233 | QVERIFY(!surface.isNull()); | ||
234 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 234 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
235 | QVERIFY(!shellSurface.isNull()); | 235 | QVERIFY(!shellSurface.isNull()); | ||
236 | QScopedPointer<XdgDecoration> deco(Test::xdgDecorationManager()->getToplevelDecoration(shellSurface.data())); | 236 | QScopedPointer<XdgDecoration> deco(Test::xdgDecorationManager()->getToplevelDecoration(shellSurface.data())); | ||
237 | QVERIFY(!deco.isNull()); | 237 | QVERIFY(!deco.isNull()); | ||
238 | deco->setMode(XdgDecoration::Mode::ServerSide); | 238 | deco->setMode(XdgDecoration::Mode::ServerSide); | ||
239 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 239 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
240 | QVERIFY(client); | 240 | QVERIFY(client); | ||
241 | QVERIFY(client->isDecorated()); | 241 | QVERIFY(client->isDecorated()); | ||
242 | 242 | | |||
243 | // Load effect that will be tested. | 243 | // Load effect that will be tested. | ||
244 | const QString effectName = QStringLiteral("kwin4_effect_fadingpopups"); | 244 | const QString effectName = QStringLiteral("kwin4_effect_fadingpopups"); | ||
245 | QVERIFY(effectsImpl->loadEffect(effectName)); | 245 | QVERIFY(effectsImpl->loadEffect(effectName)); | ||
246 | QCOMPARE(effectsImpl->loadedEffects().count(), 1); | 246 | QCOMPARE(effectsImpl->loadedEffects().count(), 1); | ||
247 | QCOMPARE(effectsImpl->loadedEffects().first(), effectName); | 247 | QCOMPARE(effectsImpl->loadedEffects().first(), effectName); | ||
Show All 35 Lines |