Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/xdgshellclient_test.cpp
Show First 20 Lines • Show All 455 Lines • ▼ Show 20 Line(s) | 437 | { | |||
---|---|---|---|---|---|
456 | QVERIFY(c->isActive()); | 456 | QVERIFY(c->isActive()); | ||
457 | QCOMPARE(c->layer(), NormalLayer); | 457 | QCOMPARE(c->layer(), NormalLayer); | ||
458 | QVERIFY(!c->isFullScreen()); | 458 | QVERIFY(!c->isFullScreen()); | ||
459 | QCOMPARE(c->clientSize(), QSize(100, 50)); | 459 | QCOMPARE(c->clientSize(), QSize(100, 50)); | ||
460 | QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); | 460 | QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); | ||
461 | QCOMPARE(c->sizeForClientSize(c->clientSize()), c->frameGeometry().size()); | 461 | QCOMPARE(c->sizeForClientSize(c->clientSize()), c->frameGeometry().size()); | ||
462 | QSignalSpy fullscreenChangedSpy(c, &XdgShellClient::fullScreenChanged); | 462 | QSignalSpy fullscreenChangedSpy(c, &XdgShellClient::fullScreenChanged); | ||
463 | QVERIFY(fullscreenChangedSpy.isValid()); | 463 | QVERIFY(fullscreenChangedSpy.isValid()); | ||
464 | QSignalSpy geometryChangedSpy(c, &XdgShellClient::geometryChanged); | 464 | QSignalSpy frameGeometryChangedSpy(c, &XdgShellClient::frameGeometryChanged); | ||
465 | QVERIFY(geometryChangedSpy.isValid()); | 465 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
466 | QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); | 466 | QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); | ||
467 | QVERIFY(sizeChangeRequestedSpy.isValid()); | 467 | QVERIFY(sizeChangeRequestedSpy.isValid()); | ||
468 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | 468 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||
469 | QVERIFY(configureRequestedSpy.isValid()); | 469 | QVERIFY(configureRequestedSpy.isValid()); | ||
470 | 470 | | |||
471 | shellSurface->setFullscreen(true); | 471 | shellSurface->setFullscreen(true); | ||
472 | QVERIFY(fullscreenChangedSpy.wait()); | 472 | QVERIFY(fullscreenChangedSpy.wait()); | ||
473 | QVERIFY(sizeChangeRequestedSpy.wait()); | 473 | QVERIFY(sizeChangeRequestedSpy.wait()); | ||
474 | QCOMPARE(sizeChangeRequestedSpy.count(), 1); | 474 | QCOMPARE(sizeChangeRequestedSpy.count(), 1); | ||
475 | QCOMPARE(sizeChangeRequestedSpy.first().first().toSize(), QSize(screens()->size(0))); | 475 | QCOMPARE(sizeChangeRequestedSpy.first().first().toSize(), QSize(screens()->size(0))); | ||
476 | // TODO: should switch to fullscreen once it's updated | 476 | // TODO: should switch to fullscreen once it's updated | ||
477 | QVERIFY(c->isFullScreen()); | 477 | QVERIFY(c->isFullScreen()); | ||
478 | QCOMPARE(c->clientSize(), QSize(100, 50)); | 478 | QCOMPARE(c->clientSize(), QSize(100, 50)); | ||
479 | QVERIFY(geometryChangedSpy.isEmpty()); | 479 | QVERIFY(frameGeometryChangedSpy.isEmpty()); | ||
480 | 480 | | |||
481 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 481 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
482 | Test::render(surface.data(), sizeChangeRequestedSpy.first().first().toSize(), Qt::red); | 482 | Test::render(surface.data(), sizeChangeRequestedSpy.first().first().toSize(), Qt::red); | ||
483 | QVERIFY(geometryChangedSpy.wait()); | 483 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
484 | QCOMPARE(geometryChangedSpy.count(), 1); | 484 | QCOMPARE(frameGeometryChangedSpy.count(), 1); | ||
485 | QVERIFY(c->isFullScreen()); | 485 | QVERIFY(c->isFullScreen()); | ||
486 | QVERIFY(!c->isDecorated()); | 486 | QVERIFY(!c->isDecorated()); | ||
487 | QCOMPARE(c->frameGeometry(), QRect(QPoint(0, 0), sizeChangeRequestedSpy.first().first().toSize())); | 487 | QCOMPARE(c->frameGeometry(), QRect(QPoint(0, 0), sizeChangeRequestedSpy.first().first().toSize())); | ||
488 | QCOMPARE(c->layer(), ActiveLayer); | 488 | QCOMPARE(c->layer(), ActiveLayer); | ||
489 | 489 | | |||
490 | // swap back to normal | 490 | // swap back to normal | ||
491 | shellSurface->setFullscreen(false); | 491 | shellSurface->setFullscreen(false); | ||
492 | QVERIFY(fullscreenChangedSpy.wait()); | 492 | QVERIFY(fullscreenChangedSpy.wait()); | ||
Show All 39 Lines | 511 | { | |||
532 | auto c = Test::renderAndWaitForShown(surface.data(), size, Qt::blue); | 532 | auto c = Test::renderAndWaitForShown(surface.data(), size, Qt::blue); | ||
533 | QVERIFY(c); | 533 | QVERIFY(c); | ||
534 | QVERIFY(c->isFullScreen()); | 534 | QVERIFY(c->isFullScreen()); | ||
535 | 535 | | |||
536 | configureRequestedSpy.wait(100); | 536 | configureRequestedSpy.wait(100); | ||
537 | 537 | | |||
538 | QSignalSpy fullscreenChangedSpy(c, &XdgShellClient::fullScreenChanged); | 538 | QSignalSpy fullscreenChangedSpy(c, &XdgShellClient::fullScreenChanged); | ||
539 | QVERIFY(fullscreenChangedSpy.isValid()); | 539 | QVERIFY(fullscreenChangedSpy.isValid()); | ||
540 | QSignalSpy geometryChangedSpy(c, &XdgShellClient::geometryChanged); | 540 | QSignalSpy frameGeometryChangedSpy(c, &XdgShellClient::frameGeometryChanged); | ||
541 | QVERIFY(geometryChangedSpy.isValid()); | 541 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
542 | 542 | | |||
543 | // swap back to normal | 543 | // swap back to normal | ||
544 | configureRequestedSpy.clear(); | 544 | configureRequestedSpy.clear(); | ||
545 | xdgShellSurface->setFullscreen(false); | 545 | xdgShellSurface->setFullscreen(false); | ||
546 | 546 | | |||
547 | QVERIFY(fullscreenChangedSpy.wait()); | 547 | QVERIFY(fullscreenChangedSpy.wait()); | ||
548 | QVERIFY(configureRequestedSpy.wait()); | 548 | QVERIFY(configureRequestedSpy.wait()); | ||
549 | QCOMPARE(configureRequestedSpy.last().first().toSize(), QSize(0, 0)); | 549 | QCOMPARE(configureRequestedSpy.last().first().toSize(), QSize(0, 0)); | ||
550 | QVERIFY(!c->isFullScreen()); | 550 | QVERIFY(!c->isFullScreen()); | ||
551 | 551 | | |||
552 | for (const auto &it: configureRequestedSpy) { | 552 | for (const auto &it: configureRequestedSpy) { | ||
553 | xdgShellSurface->ackConfigure(it[2].toUInt()); | 553 | xdgShellSurface->ackConfigure(it[2].toUInt()); | ||
554 | } | 554 | } | ||
555 | 555 | | |||
556 | Test::render(surface.data(), QSize(100, 50), Qt::red); | 556 | Test::render(surface.data(), QSize(100, 50), Qt::red); | ||
557 | QVERIFY(geometryChangedSpy.wait()); | 557 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
558 | QCOMPARE(geometryChangedSpy.count(), 1); | 558 | QCOMPARE(frameGeometryChangedSpy.count(), 1); | ||
559 | QVERIFY(!c->isFullScreen()); | 559 | QVERIFY(!c->isFullScreen()); | ||
560 | QCOMPARE(c->frameGeometry().size(), QSize(100, 50)); | 560 | QCOMPARE(c->frameGeometry().size(), QSize(100, 50)); | ||
561 | } | 561 | } | ||
562 | 562 | | |||
563 | void TestXdgShellClient::testUserCanSetFullscreen_data() | 563 | void TestXdgShellClient::testUserCanSetFullscreen_data() | ||
564 | { | 564 | { | ||
565 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | 565 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | ||
566 | 566 | | |||
▲ Show 20 Lines • Show All 108 Lines • ▼ Show 20 Line(s) | 658 | { | |||
675 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 675 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
676 | QVERIFY(c); | 676 | QVERIFY(c); | ||
677 | QVERIFY(c->isActive()); | 677 | QVERIFY(c->isActive()); | ||
678 | QVERIFY(!c->isFullScreen()); | 678 | QVERIFY(!c->isFullScreen()); | ||
679 | QCOMPARE(c->clientSize(), QSize(100, 50)); | 679 | QCOMPARE(c->clientSize(), QSize(100, 50)); | ||
680 | QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); | 680 | QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); | ||
681 | QSignalSpy fullscreenChangedSpy(c, &XdgShellClient::fullScreenChanged); | 681 | QSignalSpy fullscreenChangedSpy(c, &XdgShellClient::fullScreenChanged); | ||
682 | QVERIFY(fullscreenChangedSpy.isValid()); | 682 | QVERIFY(fullscreenChangedSpy.isValid()); | ||
683 | QSignalSpy geometryChangedSpy(c, &XdgShellClient::geometryChanged); | 683 | QSignalSpy frameGeometryChangedSpy(c, &XdgShellClient::frameGeometryChanged); | ||
684 | QVERIFY(geometryChangedSpy.isValid()); | 684 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
685 | QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); | 685 | QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); | ||
686 | QVERIFY(sizeChangeRequestedSpy.isValid()); | 686 | QVERIFY(sizeChangeRequestedSpy.isValid()); | ||
687 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | 687 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||
688 | QVERIFY(configureRequestedSpy.isValid()); | 688 | QVERIFY(configureRequestedSpy.isValid()); | ||
689 | shellSurface->setMaximized(true); | 689 | shellSurface->setMaximized(true); | ||
690 | QVERIFY(sizeChangeRequestedSpy.wait()); | 690 | QVERIFY(sizeChangeRequestedSpy.wait()); | ||
691 | QCOMPARE(sizeChangeRequestedSpy.count(), 1); | 691 | QCOMPARE(sizeChangeRequestedSpy.count(), 1); | ||
692 | 692 | | |||
693 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 693 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
694 | Test::render(surface.data(), sizeChangeRequestedSpy.last().first().toSize(), Qt::red); | 694 | Test::render(surface.data(), sizeChangeRequestedSpy.last().first().toSize(), Qt::red); | ||
695 | QVERIFY(geometryChangedSpy.wait()); | 695 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
696 | 696 | | |||
697 | QCOMPARE(c->maximizeMode(), MaximizeFull); | 697 | QCOMPARE(c->maximizeMode(), MaximizeFull); | ||
698 | QCOMPARE(geometryChangedSpy.isEmpty(), false); | 698 | QCOMPARE(frameGeometryChangedSpy.isEmpty(), false); | ||
699 | geometryChangedSpy.clear(); | 699 | frameGeometryChangedSpy.clear(); | ||
700 | 700 | | |||
701 | // fullscreen the window | 701 | // fullscreen the window | ||
702 | shellSurface->setFullscreen(true); | 702 | shellSurface->setFullscreen(true); | ||
703 | QVERIFY(fullscreenChangedSpy.wait()); | 703 | QVERIFY(fullscreenChangedSpy.wait()); | ||
704 | if (decoMode == ServerSideDecoration::Mode::Server) { | 704 | if (decoMode == ServerSideDecoration::Mode::Server) { | ||
705 | QVERIFY(sizeChangeRequestedSpy.wait()); | 705 | QVERIFY(sizeChangeRequestedSpy.wait()); | ||
706 | QCOMPARE(sizeChangeRequestedSpy.count(), 2); | 706 | QCOMPARE(sizeChangeRequestedSpy.count(), 2); | ||
707 | } | 707 | } | ||
▲ Show 20 Lines • Show All 605 Lines • ▼ Show 20 Line(s) | 1307 | { | |||
1313 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 1313 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
1314 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | 1314 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | ||
1315 | QVERIFY(client); | 1315 | QVERIFY(client); | ||
1316 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1316 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1317 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | 1317 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | ||
1318 | 1318 | | |||
1319 | const QPoint oldPosition = client->pos(); | 1319 | const QPoint oldPosition = client->pos(); | ||
1320 | 1320 | | |||
1321 | QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); | 1321 | QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); | ||
1322 | QVERIFY(geometryChangedSpy.isValid()); | 1322 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
1323 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | 1323 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | ||
1324 | QVERIFY(geometryChangedSpy.wait()); | 1324 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1325 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | 1325 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | ||
1326 | QCOMPARE(client->frameGeometry().size(), QSize(100, 50)); | 1326 | QCOMPARE(client->frameGeometry().size(), QSize(100, 50)); | ||
1327 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition); | 1327 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition); | ||
1328 | QCOMPARE(client->bufferGeometry().size(), QSize(100, 50)); | 1328 | QCOMPARE(client->bufferGeometry().size(), QSize(100, 50)); | ||
1329 | 1329 | | |||
1330 | QScopedPointer<Surface> childSurface(Test::createSurface()); | 1330 | QScopedPointer<Surface> childSurface(Test::createSurface()); | ||
1331 | QScopedPointer<SubSurface> subSurface(Test::createSubSurface(childSurface.data(), surface.data())); | 1331 | QScopedPointer<SubSurface> subSurface(Test::createSubSurface(childSurface.data(), surface.data())); | ||
1332 | QVERIFY(subSurface); | 1332 | QVERIFY(subSurface); | ||
1333 | subSurface->setPosition(QPoint(-20, -10)); | 1333 | subSurface->setPosition(QPoint(-20, -10)); | ||
1334 | Test::render(childSurface.data(), QSize(100, 50), Qt::blue); | 1334 | Test::render(childSurface.data(), QSize(100, 50), Qt::blue); | ||
1335 | surface->commit(Surface::CommitFlag::None); | 1335 | surface->commit(Surface::CommitFlag::None); | ||
1336 | QVERIFY(geometryChangedSpy.wait()); | 1336 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1337 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | 1337 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | ||
1338 | QCOMPARE(client->frameGeometry().size(), QSize(120, 60)); | 1338 | QCOMPARE(client->frameGeometry().size(), QSize(120, 60)); | ||
1339 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition + QPoint(20, 10)); | 1339 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition + QPoint(20, 10)); | ||
1340 | QCOMPARE(client->bufferGeometry().size(), QSize(100, 50)); | 1340 | QCOMPARE(client->bufferGeometry().size(), QSize(100, 50)); | ||
1341 | } | 1341 | } | ||
1342 | 1342 | | |||
1343 | void TestXdgShellClient::testXdgWindowGeometryAttachBuffer() | 1343 | void TestXdgShellClient::testXdgWindowGeometryAttachBuffer() | ||
1344 | { | 1344 | { | ||
1345 | // This test verifies that the effective window geometry remains the same when | 1345 | // This test verifies that the effective window geometry remains the same when | ||
1346 | // a new buffer is attached and xdg_surface.set_window_geometry is not called | 1346 | // a new buffer is attached and xdg_surface.set_window_geometry is not called | ||
1347 | // again. Notice that the window geometry must remain the same even if the new | 1347 | // again. Notice that the window geometry must remain the same even if the new | ||
1348 | // buffer is smaller. | 1348 | // buffer is smaller. | ||
1349 | 1349 | | |||
1350 | QScopedPointer<Surface> surface(Test::createSurface()); | 1350 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
1351 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 1351 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
1352 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | 1352 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | ||
1353 | QVERIFY(client); | 1353 | QVERIFY(client); | ||
1354 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1354 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1355 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | 1355 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | ||
1356 | 1356 | | |||
1357 | const QPoint oldPosition = client->pos(); | 1357 | const QPoint oldPosition = client->pos(); | ||
1358 | 1358 | | |||
1359 | QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); | 1359 | QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); | ||
1360 | QVERIFY(geometryChangedSpy.isValid()); | 1360 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
1361 | shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); | 1361 | shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); | ||
1362 | surface->commit(Surface::CommitFlag::None); | 1362 | surface->commit(Surface::CommitFlag::None); | ||
1363 | QVERIFY(geometryChangedSpy.wait()); | 1363 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1364 | QCOMPARE(frameGeometryChangedSpy.count(), 1); | ||||
1364 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | 1365 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | ||
1365 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | 1366 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | ||
1366 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(10, 10)); | 1367 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(10, 10)); | ||
1367 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1368 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1368 | 1369 | | |||
1369 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | 1370 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | ||
1370 | QVERIFY(geometryChangedSpy.wait()); | 1371 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1372 | QCOMPARE(frameGeometryChangedSpy.count(), 2); | ||||
1371 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | 1373 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | ||
1372 | QEXPECT_FAIL("", "Ask on wayland-devel what effective window geometry should be here", Continue); | 1374 | QCOMPARE(client->frameGeometry().size(), QSize(100, 50)); | ||
1373 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | | |||
1374 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(10, 10)); | 1375 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(10, 10)); | ||
1375 | QCOMPARE(client->bufferGeometry().size(), QSize(100, 50)); | 1376 | QCOMPARE(client->bufferGeometry().size(), QSize(100, 50)); | ||
1376 | 1377 | | |||
1377 | shellSurface->setWindowGeometry(QRect(5, 5, 90, 40)); | 1378 | shellSurface->setWindowGeometry(QRect(5, 5, 90, 40)); | ||
1378 | surface->commit(Surface::CommitFlag::None); | 1379 | surface->commit(Surface::CommitFlag::None); | ||
1379 | QVERIFY(geometryChangedSpy.wait()); | 1380 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1381 | QCOMPARE(frameGeometryChangedSpy.count(), 3); | ||||
1380 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | 1382 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | ||
1381 | QCOMPARE(client->frameGeometry().size(), QSize(90, 40)); | 1383 | QCOMPARE(client->frameGeometry().size(), QSize(90, 40)); | ||
1382 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(5, 5)); | 1384 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(5, 5)); | ||
1383 | QCOMPARE(client->bufferGeometry().size(), QSize(100, 50)); | 1385 | QCOMPARE(client->bufferGeometry().size(), QSize(100, 50)); | ||
1384 | 1386 | | |||
1385 | shellSurface.reset(); | 1387 | shellSurface.reset(); | ||
1386 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1388 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1387 | } | 1389 | } | ||
1388 | 1390 | | |||
1389 | void TestXdgShellClient::testXdgWindowGeometryAttachSubSurface() | 1391 | void TestXdgShellClient::testXdgWindowGeometryAttachSubSurface() | ||
1390 | { | 1392 | { | ||
1391 | // This test verifies that the effective window geometry remains the same | 1393 | // This test verifies that the effective window geometry remains the same | ||
1392 | // when a new sub-surface is added and xdg_surface.set_window_geometry is | 1394 | // when a new sub-surface is added and xdg_surface.set_window_geometry is | ||
1393 | // not called again. | 1395 | // not called again. | ||
1394 | 1396 | | |||
1395 | QScopedPointer<Surface> surface(Test::createSurface()); | 1397 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
1396 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 1398 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
1397 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | 1399 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | ||
1398 | QVERIFY(client); | 1400 | QVERIFY(client); | ||
1399 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1401 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1400 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | 1402 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | ||
1401 | 1403 | | |||
1402 | const QPoint oldPosition = client->pos(); | 1404 | const QPoint oldPosition = client->pos(); | ||
1403 | 1405 | | |||
1404 | QSignalSpy geometryChangedSpy(client, &XdgShellClient::geometryChanged); | 1406 | QSignalSpy frameGeometryChangedSpy(client, &XdgShellClient::frameGeometryChanged); | ||
1405 | QVERIFY(geometryChangedSpy.isValid()); | 1407 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
1406 | shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); | 1408 | shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); | ||
1407 | surface->commit(Surface::CommitFlag::None); | 1409 | surface->commit(Surface::CommitFlag::None); | ||
1408 | QVERIFY(geometryChangedSpy.wait()); | 1410 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1409 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | 1411 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | ||
1410 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | 1412 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | ||
1411 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(10, 10)); | 1413 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(10, 10)); | ||
1412 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1414 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1413 | 1415 | | |||
1414 | QScopedPointer<Surface> childSurface(Test::createSurface()); | 1416 | QScopedPointer<Surface> childSurface(Test::createSurface()); | ||
1415 | QScopedPointer<SubSurface> subSurface(Test::createSubSurface(childSurface.data(), surface.data())); | 1417 | QScopedPointer<SubSurface> subSurface(Test::createSubSurface(childSurface.data(), surface.data())); | ||
1416 | QVERIFY(subSurface); | 1418 | QVERIFY(subSurface); | ||
1417 | subSurface->setPosition(QPoint(-20, -20)); | 1419 | subSurface->setPosition(QPoint(-20, -20)); | ||
1418 | Test::render(childSurface.data(), QSize(100, 50), Qt::blue); | 1420 | Test::render(childSurface.data(), QSize(100, 50), Qt::blue); | ||
1419 | surface->commit(Surface::CommitFlag::None); | 1421 | surface->commit(Surface::CommitFlag::None); | ||
1420 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | 1422 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | ||
1421 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | 1423 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | ||
1422 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(10, 10)); | 1424 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(10, 10)); | ||
1423 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1425 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1424 | 1426 | | |||
1425 | shellSurface->setWindowGeometry(QRect(-15, -15, 50, 40)); | 1427 | shellSurface->setWindowGeometry(QRect(-15, -15, 50, 40)); | ||
1426 | surface->commit(Surface::CommitFlag::None); | 1428 | surface->commit(Surface::CommitFlag::None); | ||
1427 | QVERIFY(geometryChangedSpy.wait()); | 1429 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1428 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | 1430 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | ||
1429 | QCOMPARE(client->frameGeometry().size(), QSize(50, 40)); | 1431 | QCOMPARE(client->frameGeometry().size(), QSize(50, 40)); | ||
1430 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(-15, -15)); | 1432 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(-15, -15)); | ||
1431 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1433 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1432 | } | 1434 | } | ||
1433 | 1435 | | |||
1434 | void TestXdgShellClient::testXdgWindowGeometryInteractiveResize() | 1436 | void TestXdgShellClient::testXdgWindowGeometryInteractiveResize() | ||
1435 | { | 1437 | { | ||
1436 | // This test verifies that correct window geometry is provided along each | 1438 | // This test verifies that correct window geometry is provided along each | ||
1437 | // configure event when an xdg-shell is being interactively resized. | 1439 | // configure event when an xdg-shell is being interactively resized. | ||
1438 | 1440 | | |||
1439 | QScopedPointer<Surface> surface(Test::createSurface()); | 1441 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
1440 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 1442 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
1441 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | 1443 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | ||
1442 | QVERIFY(client); | 1444 | QVERIFY(client); | ||
1443 | QVERIFY(client->isActive()); | 1445 | QVERIFY(client->isActive()); | ||
1444 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1446 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1445 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | 1447 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | ||
1446 | 1448 | | |||
1447 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | 1449 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||
1448 | QVERIFY(configureRequestedSpy.isValid()); | 1450 | QVERIFY(configureRequestedSpy.isValid()); | ||
1449 | QVERIFY(configureRequestedSpy.wait()); | 1451 | QVERIFY(configureRequestedSpy.wait()); | ||
1450 | QCOMPARE(configureRequestedSpy.count(), 1); | 1452 | QCOMPARE(configureRequestedSpy.count(), 1); | ||
1451 | 1453 | | |||
1452 | QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); | 1454 | QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); | ||
1453 | QVERIFY(geometryChangedSpy.isValid()); | 1455 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
1454 | shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); | 1456 | shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); | ||
1455 | surface->commit(Surface::CommitFlag::None); | 1457 | surface->commit(Surface::CommitFlag::None); | ||
1456 | QVERIFY(geometryChangedSpy.wait()); | 1458 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1457 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1459 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1458 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | 1460 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | ||
1459 | 1461 | | |||
1460 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | 1462 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||
1461 | QVERIFY(clientStartMoveResizedSpy.isValid()); | 1463 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||
1462 | QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized); | 1464 | QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized); | ||
1463 | QVERIFY(clientStepUserMovedResizedSpy.isValid()); | 1465 | QVERIFY(clientStepUserMovedResizedSpy.isValid()); | ||
1464 | QSignalSpy clientFinishUserMovedResizedSpy(client, &AbstractClient::clientFinishUserMovedResized); | 1466 | QSignalSpy clientFinishUserMovedResizedSpy(client, &AbstractClient::clientFinishUserMovedResized); | ||
Show All 17 Lines | |||||
1482 | QVERIFY(configureRequestedSpy.wait()); | 1484 | QVERIFY(configureRequestedSpy.wait()); | ||
1483 | QCOMPARE(configureRequestedSpy.count(), 3); | 1485 | QCOMPARE(configureRequestedSpy.count(), 3); | ||
1484 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | 1486 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||
1485 | QVERIFY(states.testFlag(XdgShellSurface::State::Resizing)); | 1487 | QVERIFY(states.testFlag(XdgShellSurface::State::Resizing)); | ||
1486 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(188, 80)); | 1488 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(188, 80)); | ||
1487 | shellSurface->setWindowGeometry(QRect(10, 10, 188, 80)); | 1489 | shellSurface->setWindowGeometry(QRect(10, 10, 188, 80)); | ||
1488 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 1490 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
1489 | Test::render(surface.data(), QSize(208, 100), Qt::blue); | 1491 | Test::render(surface.data(), QSize(208, 100), Qt::blue); | ||
1490 | QVERIFY(geometryChangedSpy.wait()); | 1492 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1491 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); | 1493 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); | ||
1492 | QCOMPARE(client->bufferGeometry().size(), QSize(208, 100)); | 1494 | QCOMPARE(client->bufferGeometry().size(), QSize(208, 100)); | ||
1493 | QCOMPARE(client->frameGeometry().size(), QSize(188, 80)); | 1495 | QCOMPARE(client->frameGeometry().size(), QSize(188, 80)); | ||
1494 | 1496 | | |||
1495 | // Go down. | 1497 | // Go down. | ||
1496 | cursorPos = KWin::Cursor::pos(); | 1498 | cursorPos = KWin::Cursor::pos(); | ||
1497 | client->keyPressEvent(Qt::Key_Down); | 1499 | client->keyPressEvent(Qt::Key_Down); | ||
1498 | client->updateMoveResize(KWin::Cursor::pos()); | 1500 | client->updateMoveResize(KWin::Cursor::pos()); | ||
1499 | QCOMPARE(KWin::Cursor::pos(), cursorPos + QPoint(0, 8)); | 1501 | QCOMPARE(KWin::Cursor::pos(), cursorPos + QPoint(0, 8)); | ||
1500 | QVERIFY(configureRequestedSpy.wait()); | 1502 | QVERIFY(configureRequestedSpy.wait()); | ||
1501 | QCOMPARE(configureRequestedSpy.count(), 4); | 1503 | QCOMPARE(configureRequestedSpy.count(), 4); | ||
1502 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | 1504 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||
1503 | QVERIFY(states.testFlag(XdgShellSurface::State::Resizing)); | 1505 | QVERIFY(states.testFlag(XdgShellSurface::State::Resizing)); | ||
1504 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(188, 88)); | 1506 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(188, 88)); | ||
1505 | shellSurface->setWindowGeometry(QRect(10, 10, 188, 88)); | 1507 | shellSurface->setWindowGeometry(QRect(10, 10, 188, 88)); | ||
1506 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 1508 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
1507 | Test::render(surface.data(), QSize(208, 108), Qt::blue); | 1509 | Test::render(surface.data(), QSize(208, 108), Qt::blue); | ||
1508 | QVERIFY(geometryChangedSpy.wait()); | 1510 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1509 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 2); | 1511 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 2); | ||
1510 | QCOMPARE(client->bufferGeometry().size(), QSize(208, 108)); | 1512 | QCOMPARE(client->bufferGeometry().size(), QSize(208, 108)); | ||
1511 | QCOMPARE(client->frameGeometry().size(), QSize(188, 88)); | 1513 | QCOMPARE(client->frameGeometry().size(), QSize(188, 88)); | ||
1512 | 1514 | | |||
1513 | // Finish resizing the client. | 1515 | // Finish resizing the client. | ||
1514 | client->keyPressEvent(Qt::Key_Enter); | 1516 | client->keyPressEvent(Qt::Key_Enter); | ||
1515 | QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1); | 1517 | QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1); | ||
1516 | QCOMPARE(workspace()->moveResizeClient(), nullptr); | 1518 | QCOMPARE(workspace()->moveResizeClient(), nullptr); | ||
Show All 22 Lines | 1532 | { | |||
1539 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1541 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1540 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | 1542 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | ||
1541 | 1543 | | |||
1542 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | 1544 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||
1543 | QVERIFY(configureRequestedSpy.isValid()); | 1545 | QVERIFY(configureRequestedSpy.isValid()); | ||
1544 | QVERIFY(configureRequestedSpy.wait()); | 1546 | QVERIFY(configureRequestedSpy.wait()); | ||
1545 | QCOMPARE(configureRequestedSpy.count(), 1); | 1547 | QCOMPARE(configureRequestedSpy.count(), 1); | ||
1546 | 1548 | | |||
1547 | QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); | 1549 | QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); | ||
1548 | QVERIFY(geometryChangedSpy.isValid()); | 1550 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
1549 | shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); | 1551 | shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); | ||
1550 | surface->commit(Surface::CommitFlag::None); | 1552 | surface->commit(Surface::CommitFlag::None); | ||
1551 | QVERIFY(geometryChangedSpy.wait()); | 1553 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1552 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1554 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1553 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | 1555 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | ||
1554 | 1556 | | |||
1555 | workspace()->slotWindowFullScreen(); | 1557 | workspace()->slotWindowFullScreen(); | ||
1556 | QVERIFY(configureRequestedSpy.wait()); | 1558 | QVERIFY(configureRequestedSpy.wait()); | ||
1557 | QCOMPARE(configureRequestedSpy.count(), 2); | 1559 | QCOMPARE(configureRequestedSpy.count(), 2); | ||
1558 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(1280, 1024)); | 1560 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(1280, 1024)); | ||
1559 | XdgShellSurface::States states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | 1561 | XdgShellSurface::States states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||
1560 | QVERIFY(states.testFlag(XdgShellSurface::State::Fullscreen)); | 1562 | QVERIFY(states.testFlag(XdgShellSurface::State::Fullscreen)); | ||
1561 | shellSurface->setWindowGeometry(QRect(0, 0, 1280, 1024)); | 1563 | shellSurface->setWindowGeometry(QRect(0, 0, 1280, 1024)); | ||
1562 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 1564 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
1563 | Test::render(surface.data(), QSize(1280, 1024), Qt::blue); | 1565 | Test::render(surface.data(), QSize(1280, 1024), Qt::blue); | ||
1564 | QVERIFY(geometryChangedSpy.wait()); | 1566 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1565 | QCOMPARE(client->bufferGeometry().size(), QSize(1280, 1024)); | 1567 | QCOMPARE(client->bufferGeometry().size(), QSize(1280, 1024)); | ||
1566 | QCOMPARE(client->frameGeometry().size(), QSize(1280, 1024)); | 1568 | QCOMPARE(client->frameGeometry().size(), QSize(1280, 1024)); | ||
1567 | 1569 | | |||
1568 | workspace()->slotWindowFullScreen(); | 1570 | workspace()->slotWindowFullScreen(); | ||
1569 | QVERIFY(configureRequestedSpy.wait()); | 1571 | QVERIFY(configureRequestedSpy.wait()); | ||
1570 | QCOMPARE(configureRequestedSpy.count(), 3); | 1572 | QCOMPARE(configureRequestedSpy.count(), 3); | ||
1571 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(180, 80)); | 1573 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(180, 80)); | ||
1572 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | 1574 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||
1573 | QVERIFY(!states.testFlag(XdgShellSurface::State::Fullscreen)); | 1575 | QVERIFY(!states.testFlag(XdgShellSurface::State::Fullscreen)); | ||
1574 | shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); | 1576 | shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); | ||
1575 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 1577 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
1576 | Test::render(surface.data(), QSize(200, 100), Qt::blue); | 1578 | Test::render(surface.data(), QSize(200, 100), Qt::blue); | ||
1577 | QVERIFY(geometryChangedSpy.wait()); | 1579 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1578 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1580 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1579 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | 1581 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | ||
1580 | 1582 | | |||
1581 | shellSurface.reset(); | 1583 | shellSurface.reset(); | ||
1582 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1584 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1583 | } | 1585 | } | ||
1584 | 1586 | | |||
1585 | void TestXdgShellClient::testXdgWindowGeometryMaximize() | 1587 | void TestXdgShellClient::testXdgWindowGeometryMaximize() | ||
Show All 9 Lines | 1588 | { | |||
1595 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1597 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1596 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | 1598 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | ||
1597 | 1599 | | |||
1598 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | 1600 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||
1599 | QVERIFY(configureRequestedSpy.isValid()); | 1601 | QVERIFY(configureRequestedSpy.isValid()); | ||
1600 | QVERIFY(configureRequestedSpy.wait()); | 1602 | QVERIFY(configureRequestedSpy.wait()); | ||
1601 | QCOMPARE(configureRequestedSpy.count(), 1); | 1603 | QCOMPARE(configureRequestedSpy.count(), 1); | ||
1602 | 1604 | | |||
1603 | QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); | 1605 | QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); | ||
1604 | QVERIFY(geometryChangedSpy.isValid()); | 1606 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
1605 | shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); | 1607 | shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); | ||
1606 | surface->commit(Surface::CommitFlag::None); | 1608 | surface->commit(Surface::CommitFlag::None); | ||
1607 | QVERIFY(geometryChangedSpy.wait()); | 1609 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1608 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1610 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1609 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | 1611 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | ||
1610 | 1612 | | |||
1611 | workspace()->slotWindowMaximize(); | 1613 | workspace()->slotWindowMaximize(); | ||
1612 | QVERIFY(configureRequestedSpy.wait()); | 1614 | QVERIFY(configureRequestedSpy.wait()); | ||
1613 | QCOMPARE(configureRequestedSpy.count(), 2); | 1615 | QCOMPARE(configureRequestedSpy.count(), 2); | ||
1614 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(1280, 1024)); | 1616 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(1280, 1024)); | ||
1615 | XdgShellSurface::States states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | 1617 | XdgShellSurface::States states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||
1616 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | 1618 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||
1617 | shellSurface->setWindowGeometry(QRect(0, 0, 1280, 1024)); | 1619 | shellSurface->setWindowGeometry(QRect(0, 0, 1280, 1024)); | ||
1618 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 1620 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
1619 | Test::render(surface.data(), QSize(1280, 1024), Qt::blue); | 1621 | Test::render(surface.data(), QSize(1280, 1024), Qt::blue); | ||
1620 | QVERIFY(geometryChangedSpy.wait()); | 1622 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1621 | QCOMPARE(client->bufferGeometry().size(), QSize(1280, 1024)); | 1623 | QCOMPARE(client->bufferGeometry().size(), QSize(1280, 1024)); | ||
1622 | QCOMPARE(client->frameGeometry().size(), QSize(1280, 1024)); | 1624 | QCOMPARE(client->frameGeometry().size(), QSize(1280, 1024)); | ||
1623 | 1625 | | |||
1624 | workspace()->slotWindowMaximize(); | 1626 | workspace()->slotWindowMaximize(); | ||
1625 | QVERIFY(configureRequestedSpy.wait()); | 1627 | QVERIFY(configureRequestedSpy.wait()); | ||
1626 | QCOMPARE(configureRequestedSpy.count(), 3); | 1628 | QCOMPARE(configureRequestedSpy.count(), 3); | ||
1627 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(180, 80)); | 1629 | QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(180, 80)); | ||
1628 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | 1630 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||
1629 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | 1631 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | ||
1630 | shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); | 1632 | shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); | ||
1631 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 1633 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
1632 | Test::render(surface.data(), QSize(200, 100), Qt::blue); | 1634 | Test::render(surface.data(), QSize(200, 100), Qt::blue); | ||
1633 | QVERIFY(geometryChangedSpy.wait()); | 1635 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1634 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1636 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1635 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | 1637 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | ||
1636 | 1638 | | |||
1637 | shellSurface.reset(); | 1639 | shellSurface.reset(); | ||
1638 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1640 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1639 | } | 1641 | } | ||
1640 | 1642 | | |||
1641 | WAYLANDTEST_MAIN(TestXdgShellClient) | 1643 | WAYLANDTEST_MAIN(TestXdgShellClient) | ||
1642 | #include "xdgshellclient_test.moc" | 1644 | #include "xdgshellclient_test.moc" |