Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/quick_tiling_test.cpp
Show First 20 Lines • Show All 174 Lines • ▼ Show 20 Line(s) | 160 | { | |||
---|---|---|---|---|---|
175 | // We have to receive a configure event when the client becomes active. | 175 | // We have to receive a configure event when the client becomes active. | ||
176 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | 176 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||
177 | QVERIFY(configureRequestedSpy.isValid()); | 177 | QVERIFY(configureRequestedSpy.isValid()); | ||
178 | QVERIFY(configureRequestedSpy.wait()); | 178 | QVERIFY(configureRequestedSpy.wait()); | ||
179 | QCOMPARE(configureRequestedSpy.count(), 1); | 179 | QCOMPARE(configureRequestedSpy.count(), 1); | ||
180 | 180 | | |||
181 | QSignalSpy quickTileChangedSpy(c, &AbstractClient::quickTileModeChanged); | 181 | QSignalSpy quickTileChangedSpy(c, &AbstractClient::quickTileModeChanged); | ||
182 | QVERIFY(quickTileChangedSpy.isValid()); | 182 | QVERIFY(quickTileChangedSpy.isValid()); | ||
183 | QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryChanged); | 183 | QSignalSpy frameGeometryChangedSpy(c, &AbstractClient::frameGeometryChanged); | ||
184 | QVERIFY(geometryChangedSpy.isValid()); | 184 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
185 | 185 | | |||
186 | QFETCH(QuickTileMode, mode); | 186 | QFETCH(QuickTileMode, mode); | ||
187 | QFETCH(QRect, expectedGeometry); | 187 | QFETCH(QRect, expectedGeometry); | ||
188 | c->setQuickTileMode(mode, true); | 188 | c->setQuickTileMode(mode, true); | ||
189 | QCOMPARE(quickTileChangedSpy.count(), 1); | 189 | QCOMPARE(quickTileChangedSpy.count(), 1); | ||
190 | // at this point the geometry did not yet change | 190 | // at this point the geometry did not yet change | ||
191 | QCOMPARE(c->frameGeometry(), QRect(0, 0, 100, 50)); | 191 | QCOMPARE(c->frameGeometry(), QRect(0, 0, 100, 50)); | ||
192 | // but quick tile mode already changed | 192 | // but quick tile mode already changed | ||
193 | QCOMPARE(c->quickTileMode(), mode); | 193 | QCOMPARE(c->quickTileMode(), mode); | ||
194 | 194 | | |||
195 | // but we got requested a new geometry | 195 | // but we got requested a new geometry | ||
196 | QVERIFY(configureRequestedSpy.wait()); | 196 | QVERIFY(configureRequestedSpy.wait()); | ||
197 | QEXPECT_FAIL("maximize", "Two configure events are sent for maximized", Continue); | 197 | QEXPECT_FAIL("maximize", "Two configure events are sent for maximized", Continue); | ||
198 | QCOMPARE(configureRequestedSpy.count(), 2); | 198 | QCOMPARE(configureRequestedSpy.count(), 2); | ||
199 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), expectedGeometry.size()); | 199 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), expectedGeometry.size()); | ||
200 | 200 | | |||
201 | // attach a new image | 201 | // attach a new image | ||
202 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 202 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
203 | Test::render(surface.data(), expectedGeometry.size(), Qt::red); | 203 | Test::render(surface.data(), expectedGeometry.size(), Qt::red); | ||
204 | 204 | | |||
205 | QVERIFY(geometryChangedSpy.wait()); | 205 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
206 | QEXPECT_FAIL("maximize", "Geometry changed called twice for maximize", Continue); | 206 | QCOMPARE(frameGeometryChangedSpy.count(), 1); | ||
207 | QCOMPARE(geometryChangedSpy.count(), 1); | | |||
208 | QCOMPARE(c->frameGeometry(), expectedGeometry); | 207 | QCOMPARE(c->frameGeometry(), expectedGeometry); | ||
209 | 208 | | |||
210 | // send window to other screen | 209 | // send window to other screen | ||
211 | QCOMPARE(c->screen(), 0); | 210 | QCOMPARE(c->screen(), 0); | ||
212 | c->sendToScreen(1); | 211 | c->sendToScreen(1); | ||
213 | QCOMPARE(c->screen(), 1); | 212 | QCOMPARE(c->screen(), 1); | ||
214 | // quick tile should not be changed | 213 | // quick tile should not be changed | ||
215 | QCOMPARE(c->quickTileMode(), mode); | 214 | QCOMPARE(c->quickTileMode(), mode); | ||
Show All 36 Lines | 235 | { | |||
252 | // We have to receive a configure event upon becoming active. | 251 | // We have to receive a configure event upon becoming active. | ||
253 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | 252 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||
254 | QVERIFY(configureRequestedSpy.isValid()); | 253 | QVERIFY(configureRequestedSpy.isValid()); | ||
255 | QVERIFY(configureRequestedSpy.wait()); | 254 | QVERIFY(configureRequestedSpy.wait()); | ||
256 | QCOMPARE(configureRequestedSpy.count(), 1); | 255 | QCOMPARE(configureRequestedSpy.count(), 1); | ||
257 | 256 | | |||
258 | QSignalSpy quickTileChangedSpy(c, &AbstractClient::quickTileModeChanged); | 257 | QSignalSpy quickTileChangedSpy(c, &AbstractClient::quickTileModeChanged); | ||
259 | QVERIFY(quickTileChangedSpy.isValid()); | 258 | QVERIFY(quickTileChangedSpy.isValid()); | ||
260 | QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryChanged); | 259 | QSignalSpy frameGeometryChangedSpy(c, &AbstractClient::frameGeometryChanged); | ||
261 | QVERIFY(geometryChangedSpy.isValid()); | 260 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
262 | QSignalSpy maximizeChangedSpy1(c, qOverload<AbstractClient *, MaximizeMode>(&AbstractClient::clientMaximizedStateChanged)); | 261 | QSignalSpy maximizeChangedSpy1(c, qOverload<AbstractClient *, MaximizeMode>(&AbstractClient::clientMaximizedStateChanged)); | ||
263 | QVERIFY(maximizeChangedSpy1.isValid()); | 262 | QVERIFY(maximizeChangedSpy1.isValid()); | ||
264 | QSignalSpy maximizeChangedSpy2(c, qOverload<AbstractClient *, bool, bool>(&AbstractClient::clientMaximizedStateChanged)); | 263 | QSignalSpy maximizeChangedSpy2(c, qOverload<AbstractClient *, bool, bool>(&AbstractClient::clientMaximizedStateChanged)); | ||
265 | QVERIFY(maximizeChangedSpy2.isValid()); | 264 | QVERIFY(maximizeChangedSpy2.isValid()); | ||
266 | 265 | | |||
267 | c->setQuickTileMode(QuickTileFlag::Maximize, true); | 266 | c->setQuickTileMode(QuickTileFlag::Maximize, true); | ||
268 | QCOMPARE(quickTileChangedSpy.count(), 1); | 267 | QCOMPARE(quickTileChangedSpy.count(), 1); | ||
269 | 268 | | |||
270 | // at this point the geometry did not yet change | 269 | // at this point the geometry did not yet change | ||
271 | QCOMPARE(c->frameGeometry(), QRect(0, 0, 100, 50)); | 270 | QCOMPARE(c->frameGeometry(), QRect(0, 0, 100, 50)); | ||
272 | // but quick tile mode already changed | 271 | // but quick tile mode already changed | ||
273 | QCOMPARE(c->quickTileMode(), QuickTileFlag::Maximize); | 272 | QCOMPARE(c->quickTileMode(), QuickTileFlag::Maximize); | ||
274 | QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); | 273 | QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); | ||
275 | 274 | | |||
276 | // but we got requested a new geometry | 275 | // but we got requested a new geometry | ||
277 | QVERIFY(configureRequestedSpy.wait()); | 276 | QVERIFY(configureRequestedSpy.wait()); | ||
278 | QEXPECT_FAIL("", "Two configure events are sent for maximized", Continue); | 277 | QEXPECT_FAIL("", "Two configure events are sent for maximized", Continue); | ||
279 | QCOMPARE(configureRequestedSpy.count(), 2); | 278 | QCOMPARE(configureRequestedSpy.count(), 2); | ||
280 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(1280, 1024)); | 279 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(1280, 1024)); | ||
281 | 280 | | |||
282 | // attach a new image | 281 | // attach a new image | ||
283 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 282 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
284 | Test::render(surface.data(), QSize(1280, 1024), Qt::red); | 283 | Test::render(surface.data(), QSize(1280, 1024), Qt::red); | ||
285 | 284 | | |||
286 | QVERIFY(geometryChangedSpy.wait()); | 285 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
287 | QCOMPARE(geometryChangedSpy.count(), 2); | 286 | QCOMPARE(frameGeometryChangedSpy.count(), 1); | ||
288 | QCOMPARE(c->frameGeometry(), QRect(0, 0, 1280, 1024)); | 287 | QCOMPARE(c->frameGeometry(), QRect(0, 0, 1280, 1024)); | ||
289 | QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); | 288 | QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); | ||
290 | 289 | | |||
291 | // client is now set to maximised | 290 | // client is now set to maximised | ||
292 | QCOMPARE(maximizeChangedSpy1.count(), 1); | 291 | QCOMPARE(maximizeChangedSpy1.count(), 1); | ||
293 | QCOMPARE(maximizeChangedSpy1.first().first().value<KWin::AbstractClient*>(), c); | 292 | QCOMPARE(maximizeChangedSpy1.first().first().value<KWin::AbstractClient*>(), c); | ||
294 | QCOMPARE(maximizeChangedSpy1.first().last().value<KWin::MaximizeMode>(), MaximizeFull); | 293 | QCOMPARE(maximizeChangedSpy1.first().last().value<KWin::MaximizeMode>(), MaximizeFull); | ||
295 | QCOMPARE(maximizeChangedSpy2.count(), 1); | 294 | QCOMPARE(maximizeChangedSpy2.count(), 1); | ||
Show All 15 Lines | |||||
311 | QEXPECT_FAIL("", "Two configure events are sent for maximized", Continue); | 310 | QEXPECT_FAIL("", "Two configure events are sent for maximized", Continue); | ||
312 | QCOMPARE(configureRequestedSpy.count(), 3); | 311 | QCOMPARE(configureRequestedSpy.count(), 3); | ||
313 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(100, 50)); | 312 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(100, 50)); | ||
314 | 313 | | |||
315 | // render again | 314 | // render again | ||
316 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 315 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
317 | Test::render(surface.data(), QSize(100, 50), Qt::yellow); | 316 | Test::render(surface.data(), QSize(100, 50), Qt::yellow); | ||
318 | 317 | | |||
319 | QVERIFY(geometryChangedSpy.wait()); | 318 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
320 | QCOMPARE(geometryChangedSpy.count(), 4); | 319 | QCOMPARE(frameGeometryChangedSpy.count(), 2); | ||
321 | QCOMPARE(c->frameGeometry(), QRect(0, 0, 100, 50)); | 320 | QCOMPARE(c->frameGeometry(), QRect(0, 0, 100, 50)); | ||
322 | QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); | 321 | QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); | ||
323 | QCOMPARE(maximizeChangedSpy1.count(), 2); | 322 | QCOMPARE(maximizeChangedSpy1.count(), 2); | ||
324 | QCOMPARE(maximizeChangedSpy1.last().first().value<KWin::AbstractClient*>(), c); | 323 | QCOMPARE(maximizeChangedSpy1.last().first().value<KWin::AbstractClient*>(), c); | ||
325 | QCOMPARE(maximizeChangedSpy1.last().last().value<KWin::MaximizeMode>(), MaximizeRestore); | 324 | QCOMPARE(maximizeChangedSpy1.last().last().value<KWin::MaximizeMode>(), MaximizeRestore); | ||
326 | QCOMPARE(maximizeChangedSpy2.count(), 2); | 325 | QCOMPARE(maximizeChangedSpy2.count(), 2); | ||
327 | QCOMPARE(maximizeChangedSpy2.last().first().value<KWin::AbstractClient*>(), c); | 326 | QCOMPARE(maximizeChangedSpy2.last().first().value<KWin::AbstractClient*>(), c); | ||
328 | QCOMPARE(maximizeChangedSpy2.last().at(1).toBool(), false); | 327 | QCOMPARE(maximizeChangedSpy2.last().at(1).toBool(), false); | ||
▲ Show 20 Lines • Show All 448 Lines • ▼ Show 20 Line(s) | 736 | { | |||
777 | QTEST(c->quickTileMode(), "expectedMode"); | 776 | QTEST(c->quickTileMode(), "expectedMode"); | ||
778 | 777 | | |||
779 | // but we got requested a new geometry | 778 | // but we got requested a new geometry | ||
780 | QVERIFY(configureRequestedSpy.wait()); | 779 | QVERIFY(configureRequestedSpy.wait()); | ||
781 | QCOMPARE(configureRequestedSpy.count(), 2); | 780 | QCOMPARE(configureRequestedSpy.count(), 2); | ||
782 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), expectedGeometry.size()); | 781 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), expectedGeometry.size()); | ||
783 | 782 | | |||
784 | // attach a new image | 783 | // attach a new image | ||
785 | QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryChanged); | 784 | QSignalSpy frameGeometryChangedSpy(c, &AbstractClient::frameGeometryChanged); | ||
786 | QVERIFY(geometryChangedSpy.isValid()); | 785 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
787 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 786 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
788 | Test::render(surface.data(), expectedGeometry.size(), Qt::red); | 787 | Test::render(surface.data(), expectedGeometry.size(), Qt::red); | ||
789 | 788 | | |||
790 | QVERIFY(geometryChangedSpy.wait()); | 789 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
791 | QEXPECT_FAIL("maximize", "Geometry changed called twice for maximize", Continue); | 790 | QEXPECT_FAIL("maximize", "Geometry changed called twice for maximize", Continue); | ||
792 | QCOMPARE(geometryChangedSpy.count(), 1); | 791 | QCOMPARE(frameGeometryChangedSpy.count(), 1); | ||
793 | QCOMPARE(c->frameGeometry(), expectedGeometry); | 792 | QCOMPARE(c->frameGeometry(), expectedGeometry); | ||
794 | } | 793 | } | ||
795 | 794 | | |||
796 | void QuickTilingTest::testScript_data() | 795 | void QuickTilingTest::testScript_data() | ||
797 | { | 796 | { | ||
798 | QTest::addColumn<QString>("action"); | 797 | QTest::addColumn<QString>("action"); | ||
799 | QTest::addColumn<QuickTileMode>("expectedMode"); | 798 | QTest::addColumn<QuickTileMode>("expectedMode"); | ||
800 | QTest::addColumn<QRect>("expectedGeometry"); | 799 | QTest::addColumn<QRect>("expectedGeometry"); | ||
Show All 31 Lines | 816 | { | |||
832 | // We have to receive a configure event upon the client becoming active. | 831 | // We have to receive a configure event upon the client becoming active. | ||
833 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | 832 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||
834 | QVERIFY(configureRequestedSpy.isValid()); | 833 | QVERIFY(configureRequestedSpy.isValid()); | ||
835 | QVERIFY(configureRequestedSpy.wait()); | 834 | QVERIFY(configureRequestedSpy.wait()); | ||
836 | QCOMPARE(configureRequestedSpy.count(), 1); | 835 | QCOMPARE(configureRequestedSpy.count(), 1); | ||
837 | 836 | | |||
838 | QSignalSpy quickTileChangedSpy(c, &AbstractClient::quickTileModeChanged); | 837 | QSignalSpy quickTileChangedSpy(c, &AbstractClient::quickTileModeChanged); | ||
839 | QVERIFY(quickTileChangedSpy.isValid()); | 838 | QVERIFY(quickTileChangedSpy.isValid()); | ||
840 | QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryChanged); | 839 | QSignalSpy frameGeometryChangedSpy(c, &AbstractClient::frameGeometryChanged); | ||
841 | QVERIFY(geometryChangedSpy.isValid()); | 840 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
842 | 841 | | |||
843 | QVERIFY(Scripting::self()); | 842 | QVERIFY(Scripting::self()); | ||
844 | QTemporaryFile tmpFile; | 843 | QTemporaryFile tmpFile; | ||
845 | QVERIFY(tmpFile.open()); | 844 | QVERIFY(tmpFile.open()); | ||
846 | QTextStream out(&tmpFile); | 845 | QTextStream out(&tmpFile); | ||
847 | 846 | | |||
848 | QFETCH(QString, action); | 847 | QFETCH(QString, action); | ||
849 | out << "workspace.slotWindowQuickTile" << action << "()"; | 848 | out << "workspace.slotWindowQuickTile" << action << "()"; | ||
Show All 26 Lines | |||||
876 | QVERIFY(configureRequestedSpy.wait()); | 875 | QVERIFY(configureRequestedSpy.wait()); | ||
877 | QCOMPARE(configureRequestedSpy.count(), 2); | 876 | QCOMPARE(configureRequestedSpy.count(), 2); | ||
878 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), expectedGeometry.size()); | 877 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), expectedGeometry.size()); | ||
879 | 878 | | |||
880 | // attach a new image | 879 | // attach a new image | ||
881 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 880 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
882 | Test::render(surface.data(), expectedGeometry.size(), Qt::red); | 881 | Test::render(surface.data(), expectedGeometry.size(), Qt::red); | ||
883 | 882 | | |||
884 | QVERIFY(geometryChangedSpy.wait()); | 883 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
885 | QEXPECT_FAIL("maximize", "Geometry changed called twice for maximize", Continue); | 884 | QEXPECT_FAIL("maximize", "Geometry changed called twice for maximize", Continue); | ||
886 | QCOMPARE(geometryChangedSpy.count(), 1); | 885 | QCOMPARE(frameGeometryChangedSpy.count(), 1); | ||
887 | QCOMPARE(c->frameGeometry(), expectedGeometry); | 886 | QCOMPARE(c->frameGeometry(), expectedGeometry); | ||
888 | } | 887 | } | ||
889 | 888 | | |||
890 | } | 889 | } | ||
891 | 890 | | |||
892 | WAYLANDTEST_MAIN(KWin::QuickTilingTest) | 891 | WAYLANDTEST_MAIN(KWin::QuickTilingTest) | ||
893 | #include "quick_tiling_test.moc" | 892 | #include "quick_tiling_test.moc" |