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