Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/effects/maximize_animation_test.cpp
Show First 20 Lines • Show All 151 Lines • ▼ Show 20 Line(s) | 107 | { | |||
---|---|---|---|---|---|
152 | QVERIFY(effectsImpl->loadEffect(effectName)); | 152 | QVERIFY(effectsImpl->loadEffect(effectName)); | ||
153 | QCOMPARE(effectsImpl->loadedEffects().count(), 1); | 153 | QCOMPARE(effectsImpl->loadedEffects().count(), 1); | ||
154 | QCOMPARE(effectsImpl->loadedEffects().first(), effectName); | 154 | QCOMPARE(effectsImpl->loadedEffects().first(), effectName); | ||
155 | Effect *effect = effectsImpl->findEffect(effectName); | 155 | Effect *effect = effectsImpl->findEffect(effectName); | ||
156 | QVERIFY(effect); | 156 | QVERIFY(effect); | ||
157 | QVERIFY(!effect->isActive()); | 157 | QVERIFY(!effect->isActive()); | ||
158 | 158 | | |||
159 | // Maximize the client. | 159 | // Maximize the client. | ||
160 | QSignalSpy geometryChangedSpy(client, &XdgShellClient::geometryChanged); | 160 | QSignalSpy frameGeometryChangedSpy(client, &XdgShellClient::frameGeometryChanged); | ||
161 | QVERIFY(geometryChangedSpy.isValid()); | 161 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
162 | QSignalSpy maximizeChangedSpy(client, qOverload<AbstractClient *, bool, bool>(&XdgShellClient::clientMaximizedStateChanged)); | 162 | QSignalSpy maximizeChangedSpy(client, qOverload<AbstractClient *, bool, bool>(&XdgShellClient::clientMaximizedStateChanged)); | ||
163 | QVERIFY(maximizeChangedSpy.isValid()); | 163 | QVERIFY(maximizeChangedSpy.isValid()); | ||
164 | 164 | | |||
165 | workspace()->slotWindowMaximize(); | 165 | workspace()->slotWindowMaximize(); | ||
166 | QVERIFY(configureRequestedSpy.wait()); | 166 | QVERIFY(configureRequestedSpy.wait()); | ||
167 | QCOMPARE(configureRequestedSpy.count(), 3); | 167 | QCOMPARE(configureRequestedSpy.count(), 3); | ||
168 | QCOMPARE(configureRequestedSpy.last().at(0).value<QSize>(), QSize(1280, 1024)); | 168 | QCOMPARE(configureRequestedSpy.last().at(0).value<QSize>(), QSize(1280, 1024)); | ||
169 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | 169 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||
170 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | 170 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||
171 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | 171 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||
172 | 172 | | |||
173 | // Draw contents of the maximized client. | 173 | // Draw contents of the maximized client. | ||
174 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 174 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
175 | Test::render(surface.data(), QSize(1280, 1024), Qt::red); | 175 | Test::render(surface.data(), QSize(1280, 1024), Qt::red); | ||
176 | QVERIFY(geometryChangedSpy.wait()); | 176 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
177 | QCOMPARE(geometryChangedSpy.count(), 2); | 177 | QCOMPARE(frameGeometryChangedSpy.count(), 1); | ||
178 | QCOMPARE(maximizeChangedSpy.count(), 1); | 178 | QCOMPARE(maximizeChangedSpy.count(), 1); | ||
179 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | 179 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | ||
180 | QVERIFY(effect->isActive()); | 180 | QVERIFY(effect->isActive()); | ||
181 | 181 | | |||
182 | // Eventually, the animation will be complete. | 182 | // Eventually, the animation will be complete. | ||
183 | QTRY_VERIFY(!effect->isActive()); | 183 | QTRY_VERIFY(!effect->isActive()); | ||
184 | 184 | | |||
185 | // Restore the client. | 185 | // Restore the client. | ||
186 | workspace()->slotWindowMaximize(); | 186 | workspace()->slotWindowMaximize(); | ||
187 | QVERIFY(configureRequestedSpy.wait()); | 187 | QVERIFY(configureRequestedSpy.wait()); | ||
188 | QCOMPARE(configureRequestedSpy.count(), 4); | 188 | QCOMPARE(configureRequestedSpy.count(), 4); | ||
189 | QCOMPARE(configureRequestedSpy.last().at(0).value<QSize>(), QSize(100, 50)); | 189 | QCOMPARE(configureRequestedSpy.last().at(0).value<QSize>(), QSize(100, 50)); | ||
190 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | 190 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||
191 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | 191 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||
192 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | 192 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | ||
193 | 193 | | |||
194 | // Draw contents of the restored client. | 194 | // Draw contents of the restored client. | ||
195 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 195 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
196 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | 196 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | ||
197 | QVERIFY(geometryChangedSpy.wait()); | 197 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
198 | QCOMPARE(geometryChangedSpy.count(), 4); | 198 | QCOMPARE(frameGeometryChangedSpy.count(), 2); | ||
199 | QCOMPARE(maximizeChangedSpy.count(), 2); | 199 | QCOMPARE(maximizeChangedSpy.count(), 2); | ||
200 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); | 200 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); | ||
201 | QVERIFY(effect->isActive()); | 201 | QVERIFY(effect->isActive()); | ||
202 | 202 | | |||
203 | // Eventually, the animation will be complete. | 203 | // Eventually, the animation will be complete. | ||
204 | QTRY_VERIFY(!effect->isActive()); | 204 | QTRY_VERIFY(!effect->isActive()); | ||
205 | 205 | | |||
206 | // Destroy the test client. | 206 | // Destroy the test client. | ||
207 | surface.reset(); | 207 | surface.reset(); | ||
208 | QVERIFY(Test::waitForWindowDestroyed(client)); | 208 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
209 | } | 209 | } | ||
210 | 210 | | |||
211 | WAYLANDTEST_MAIN(MaximizeAnimationTest) | 211 | WAYLANDTEST_MAIN(MaximizeAnimationTest) | ||
212 | #include "maximize_animation_test.moc" | 212 | #include "maximize_animation_test.moc" |