Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/shell_client_rules_test.cpp
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 46 | private Q_SLOTS: | |||
---|---|---|---|---|---|
69 | void testSizeRemember(); | 69 | void testSizeRemember(); | ||
70 | void testSizeForce_data(); | 70 | void testSizeForce_data(); | ||
71 | void testSizeForce(); | 71 | void testSizeForce(); | ||
72 | void testSizeApplyNow_data(); | 72 | void testSizeApplyNow_data(); | ||
73 | void testSizeApplyNow(); | 73 | void testSizeApplyNow(); | ||
74 | void testSizeForceTemporarily_data(); | 74 | void testSizeForceTemporarily_data(); | ||
75 | void testSizeForceTemporarily(); | 75 | void testSizeForceTemporarily(); | ||
76 | 76 | | |||
77 | void testMaximizeDontAffect_data(); | ||||
78 | void testMaximizeDontAffect(); | ||||
79 | void testMaximizeApply_data(); | ||||
80 | void testMaximizeApply(); | ||||
81 | void testMaximizeRemember_data(); | ||||
82 | void testMaximizeRemember(); | ||||
83 | void testMaximizeForce_data(); | ||||
84 | void testMaximizeForce(); | ||||
85 | void testMaximizeApplyNow_data(); | ||||
86 | void testMaximizeApplyNow(); | ||||
87 | void testMaximizeForceTemporarily_data(); | ||||
88 | void testMaximizeForceTemporarily(); | ||||
89 | | ||||
77 | void testDesktopDontAffect_data(); | 90 | void testDesktopDontAffect_data(); | ||
78 | void testDesktopDontAffect(); | 91 | void testDesktopDontAffect(); | ||
79 | void testDesktopApply_data(); | 92 | void testDesktopApply_data(); | ||
80 | void testDesktopApply(); | 93 | void testDesktopApply(); | ||
81 | void testDesktopRemember_data(); | 94 | void testDesktopRemember_data(); | ||
82 | void testDesktopRemember(); | 95 | void testDesktopRemember(); | ||
83 | void testDesktopForce_data(); | 96 | void testDesktopForce_data(); | ||
84 | void testDesktopForce(); | 97 | void testDesktopForce(); | ||
▲ Show 20 Lines • Show All 297 Lines • ▼ Show 20 Line(s) | 334 | { | |||
382 | QVERIFY(Test::waitForWindowDestroyed(client)); | 395 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
383 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 396 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
384 | QVERIFY(client); | 397 | QVERIFY(client); | ||
385 | QVERIFY(client->isActive()); | 398 | QVERIFY(client->isActive()); | ||
386 | QVERIFY(client->isMovableAcrossScreens()); | 399 | QVERIFY(client->isMovableAcrossScreens()); | ||
387 | QCOMPARE(client->pos(), QPoint(42, 42)); | 400 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||
388 | 401 | | |||
389 | // Destroy the client. | 402 | // Destroy the client. | ||
390 | delete shellSurface; | 403 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
391 | delete surface; | 404 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
392 | QVERIFY(Test::waitForWindowDestroyed(client)); | 405 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
393 | } | 406 | } | ||
394 | 407 | | |||
395 | TEST_DATA(testPositionRemember) | 408 | TEST_DATA(testPositionRemember) | ||
396 | 409 | | |||
397 | void TestShellClientRules::testPositionRemember() | 410 | void TestShellClientRules::testPositionRemember() | ||
398 | { | 411 | { | ||
399 | // Set the test rule. | 412 | // Set the test rule. | ||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | |||||
459 | QVERIFY(Test::waitForWindowDestroyed(client)); | 472 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
460 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 473 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
461 | QVERIFY(client); | 474 | QVERIFY(client); | ||
462 | QVERIFY(client->isActive()); | 475 | QVERIFY(client->isActive()); | ||
463 | QVERIFY(client->isMovableAcrossScreens()); | 476 | QVERIFY(client->isMovableAcrossScreens()); | ||
464 | QCOMPARE(client->pos(), QPoint(50, 42)); | 477 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||
465 | 478 | | |||
466 | // Destroy the client. | 479 | // Destroy the client. | ||
467 | delete shellSurface; | 480 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
468 | delete surface; | 481 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
469 | QVERIFY(Test::waitForWindowDestroyed(client)); | 482 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
470 | } | 483 | } | ||
471 | 484 | | |||
472 | TEST_DATA(testPositionForce) | 485 | TEST_DATA(testPositionForce) | ||
473 | 486 | | |||
474 | void TestShellClientRules::testPositionForce() | 487 | void TestShellClientRules::testPositionForce() | ||
475 | { | 488 | { | ||
476 | // Set the test rule. | 489 | // Set the test rule. | ||
Show All 40 Lines | |||||
517 | QVERIFY(Test::waitForWindowDestroyed(client)); | 530 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
518 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 531 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
519 | QVERIFY(client); | 532 | QVERIFY(client); | ||
520 | QVERIFY(client->isActive()); | 533 | QVERIFY(client->isActive()); | ||
521 | QVERIFY(!client->isMovableAcrossScreens()); | 534 | QVERIFY(!client->isMovableAcrossScreens()); | ||
522 | QCOMPARE(client->pos(), QPoint(42, 42)); | 535 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||
523 | 536 | | |||
524 | // Destroy the client. | 537 | // Destroy the client. | ||
525 | delete shellSurface; | 538 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
526 | delete surface; | 539 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
527 | QVERIFY(Test::waitForWindowDestroyed(client)); | 540 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
528 | } | 541 | } | ||
529 | 542 | | |||
530 | TEST_DATA(testPositionApplyNow) | 543 | TEST_DATA(testPositionApplyNow) | ||
531 | 544 | | |||
532 | void TestShellClientRules::testPositionApplyNow() | 545 | void TestShellClientRules::testPositionApplyNow() | ||
533 | { | 546 | { | ||
534 | // Create the test client. | 547 | // Create the test client. | ||
▲ Show 20 Lines • Show All 119 Lines • ▼ Show 20 Line(s) | 625 | { | |||
654 | QVERIFY(Test::waitForWindowDestroyed(client)); | 667 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
655 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 668 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
656 | QVERIFY(client); | 669 | QVERIFY(client); | ||
657 | QVERIFY(client->isActive()); | 670 | QVERIFY(client->isActive()); | ||
658 | QVERIFY(client->isMovableAcrossScreens()); | 671 | QVERIFY(client->isMovableAcrossScreens()); | ||
659 | QCOMPARE(client->pos(), QPoint(0, 0)); | 672 | QCOMPARE(client->pos(), QPoint(0, 0)); | ||
660 | 673 | | |||
661 | // Destroy the client. | 674 | // Destroy the client. | ||
662 | delete shellSurface; | 675 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
663 | delete surface; | 676 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
664 | QVERIFY(Test::waitForWindowDestroyed(client)); | 677 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
665 | } | 678 | } | ||
666 | 679 | | |||
667 | TEST_DATA(testSizeDontAffect) | 680 | TEST_DATA(testSizeDontAffect) | ||
668 | 681 | | |||
669 | void TestShellClientRules::testSizeDontAffect() | 682 | void TestShellClientRules::testSizeDontAffect() | ||
670 | { | 683 | { | ||
671 | // Set the test rule. | 684 | // Set the test rule. | ||
▲ Show 20 Lines • Show All 559 Lines • ▼ Show 20 Line(s) | 1167 | { | |||
1231 | QCOMPARE(configureRequestedSpy->count(), 2); | 1244 | QCOMPARE(configureRequestedSpy->count(), 2); | ||
1232 | 1245 | | |||
1233 | // Destroy the client. | 1246 | // Destroy the client. | ||
1234 | shellSurface.reset(); | 1247 | shellSurface.reset(); | ||
1235 | surface.reset(); | 1248 | surface.reset(); | ||
1236 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1249 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1237 | } | 1250 | } | ||
1238 | 1251 | | |||
1252 | TEST_DATA(testMaximizeDontAffect) | ||||
1253 | | ||||
1254 | void TestShellClientRules::testMaximizeDontAffect() | ||||
1255 | { | ||||
1256 | // Set the test rule. | ||||
1257 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
1258 | config->group("General").writeEntry("count", 1); | ||||
1259 | auto group = config->group("1"); | ||||
1260 | group.writeEntry("maximizehoriz", true); | ||||
1261 | group.writeEntry("maximizehorizrule", 1); | ||||
1262 | group.writeEntry("maximizevert", true); | ||||
1263 | group.writeEntry("maximizevertrule", 1); | ||||
1264 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
1265 | group.writeEntry("wmclasscomplete", false); | ||||
1266 | group.writeEntry("wmclassmatch", 1); | ||||
1267 | group.sync(); | ||||
1268 | RuleBook::self()->setConfig(config); | ||||
1269 | workspace()->slotReconfigure(); | ||||
1270 | | ||||
1271 | // Create the test surface. | ||||
1272 | QFETCH(Test::ShellSurfaceType, type); | ||||
1273 | QScopedPointer<Surface> surface; | ||||
1274 | surface.reset(Test::createSurface()); | ||||
1275 | QScopedPointer<XdgShellSurface> shellSurface; | ||||
1276 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1277 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||||
1278 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1279 | shellSurface->setAppId("org.kde.foo"); | ||||
1280 | surface->commit(Surface::CommitFlag::None); | ||||
1281 | | ||||
1282 | // Wait for the initial configure event. | ||||
1283 | XdgShellSurface::States states; | ||||
1284 | QVERIFY(configureRequestedSpy->wait()); | ||||
1285 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1286 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(0, 0)); | ||||
1287 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1288 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||||
1289 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1290 | | ||||
1291 | // Map the surface. | ||||
1292 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1293 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||||
1294 | QVERIFY(client); | ||||
1295 | QVERIFY(client->isActive()); | ||||
1296 | QVERIFY(client->isMaximizable()); | ||||
1297 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); | ||||
1298 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); | ||||
1299 | QCOMPARE(client->size(), QSize(100, 50)); | ||||
1300 | | ||||
1301 | // We should receive a configure event when the client becomes active. | ||||
1302 | QVERIFY(configureRequestedSpy->wait()); | ||||
1303 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1304 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1305 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
1306 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1307 | | ||||
1308 | // Destroy the client. | ||||
1309 | shellSurface.reset(); | ||||
1310 | surface.reset(); | ||||
1311 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1312 | } | ||||
1313 | | ||||
1314 | TEST_DATA(testMaximizeApply) | ||||
1315 | | ||||
1316 | void TestShellClientRules::testMaximizeApply() | ||||
1317 | { | ||||
1318 | // Set the test rule. | ||||
1319 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
1320 | config->group("General").writeEntry("count", 1); | ||||
1321 | auto group = config->group("1"); | ||||
1322 | group.writeEntry("maximizehoriz", true); | ||||
1323 | group.writeEntry("maximizehorizrule", 3); | ||||
1324 | group.writeEntry("maximizevert", true); | ||||
1325 | group.writeEntry("maximizevertrule", 3); | ||||
1326 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
1327 | group.writeEntry("wmclasscomplete", false); | ||||
1328 | group.writeEntry("wmclassmatch", 1); | ||||
1329 | group.sync(); | ||||
1330 | RuleBook::self()->setConfig(config); | ||||
1331 | workspace()->slotReconfigure(); | ||||
1332 | | ||||
1333 | // Create the test surface. | ||||
1334 | QFETCH(Test::ShellSurfaceType, type); | ||||
1335 | QScopedPointer<Surface> surface; | ||||
1336 | surface.reset(Test::createSurface()); | ||||
1337 | QScopedPointer<XdgShellSurface> shellSurface; | ||||
1338 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1339 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||||
1340 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1341 | shellSurface->setAppId("org.kde.foo"); | ||||
1342 | surface->commit(Surface::CommitFlag::None); | ||||
1343 | | ||||
1344 | // Wait for the initial configure event. | ||||
1345 | XdgShellSurface::States states; | ||||
1346 | QVERIFY(configureRequestedSpy->wait()); | ||||
1347 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1348 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024)); | ||||
1349 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1350 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||||
1351 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1352 | | ||||
1353 | // Map the surface. | ||||
1354 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1355 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue); | ||||
1356 | QVERIFY(client); | ||||
1357 | QVERIFY(client->isActive()); | ||||
1358 | QVERIFY(client->isMaximizable()); | ||||
1359 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | ||||
1360 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); | ||||
1361 | QCOMPARE(client->size(), QSize(1280, 1024)); | ||||
1362 | | ||||
1363 | // We should receive a configure event when the client becomes active. | ||||
1364 | QVERIFY(configureRequestedSpy->wait()); | ||||
1365 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1366 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1367 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
1368 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1369 | | ||||
1370 | // One should still be able to change the maximize state of the client. | ||||
1371 | workspace()->slotWindowMaximize(); | ||||
1372 | QVERIFY(configureRequestedSpy->wait()); | ||||
1373 | QCOMPARE(configureRequestedSpy->count(), 3); | ||||
1374 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(0, 0)); | ||||
1375 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1376 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
1377 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1378 | | ||||
1379 | QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); | ||||
1380 | QVERIFY(geometryChangedSpy.isValid()); | ||||
1381 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1382 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | ||||
1383 | QVERIFY(geometryChangedSpy.wait()); | ||||
1384 | QCOMPARE(client->size(), QSize(100, 50)); | ||||
1385 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); | ||||
1386 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); | ||||
1387 | | ||||
1388 | // If we create the client again, it should be initially maximized. | ||||
1389 | shellSurface.reset(); | ||||
1390 | surface.reset(); | ||||
1391 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1392 | surface.reset(Test::createSurface()); | ||||
1393 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1394 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1395 | shellSurface->setAppId("org.kde.foo"); | ||||
1396 | surface->commit(Surface::CommitFlag::None); | ||||
1397 | | ||||
1398 | QVERIFY(configureRequestedSpy->wait()); | ||||
1399 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1400 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024)); | ||||
1401 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1402 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||||
1403 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1404 | | ||||
1405 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1406 | client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue); | ||||
1407 | QVERIFY(client); | ||||
1408 | QVERIFY(client->isActive()); | ||||
1409 | QVERIFY(client->isMaximizable()); | ||||
1410 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | ||||
1411 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); | ||||
1412 | QCOMPARE(client->size(), QSize(1280, 1024)); | ||||
1413 | | ||||
1414 | QVERIFY(configureRequestedSpy->wait()); | ||||
1415 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1416 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1417 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
1418 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1419 | | ||||
1420 | // Destroy the client. | ||||
1421 | shellSurface.reset(); | ||||
1422 | surface.reset(); | ||||
1423 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1424 | } | ||||
1425 | | ||||
1426 | TEST_DATA(testMaximizeRemember) | ||||
1427 | | ||||
1428 | void TestShellClientRules::testMaximizeRemember() | ||||
1429 | { | ||||
1430 | // Set the test rule. | ||||
1431 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
1432 | config->group("General").writeEntry("count", 1); | ||||
1433 | auto group = config->group("1"); | ||||
1434 | group.writeEntry("maximizehoriz", true); | ||||
1435 | group.writeEntry("maximizehorizrule", 4); | ||||
1436 | group.writeEntry("maximizevert", true); | ||||
1437 | group.writeEntry("maximizevertrule", 4); | ||||
1438 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
1439 | group.writeEntry("wmclasscomplete", false); | ||||
1440 | group.writeEntry("wmclassmatch", 1); | ||||
1441 | group.sync(); | ||||
1442 | RuleBook::self()->setConfig(config); | ||||
1443 | workspace()->slotReconfigure(); | ||||
1444 | | ||||
1445 | // Create the test surface. | ||||
1446 | QFETCH(Test::ShellSurfaceType, type); | ||||
1447 | QScopedPointer<Surface> surface; | ||||
1448 | surface.reset(Test::createSurface()); | ||||
1449 | QScopedPointer<XdgShellSurface> shellSurface; | ||||
1450 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1451 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||||
1452 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1453 | shellSurface->setAppId("org.kde.foo"); | ||||
1454 | surface->commit(Surface::CommitFlag::None); | ||||
1455 | | ||||
1456 | // Wait for the initial configure event. | ||||
1457 | XdgShellSurface::States states; | ||||
1458 | QVERIFY(configureRequestedSpy->wait()); | ||||
1459 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1460 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024)); | ||||
1461 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1462 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||||
1463 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1464 | | ||||
1465 | // Map the surface. | ||||
1466 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1467 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue); | ||||
1468 | QVERIFY(client); | ||||
1469 | QVERIFY(client->isActive()); | ||||
1470 | QVERIFY(client->isMaximizable()); | ||||
1471 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | ||||
1472 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); | ||||
1473 | QCOMPARE(client->size(), QSize(1280, 1024)); | ||||
1474 | | ||||
1475 | // We should receive a configure event when the client becomes active. | ||||
1476 | QVERIFY(configureRequestedSpy->wait()); | ||||
1477 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1478 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1479 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
1480 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1481 | | ||||
1482 | // One should still be able to change the maximize state of the client. | ||||
1483 | workspace()->slotWindowMaximize(); | ||||
1484 | QVERIFY(configureRequestedSpy->wait()); | ||||
1485 | QCOMPARE(configureRequestedSpy->count(), 3); | ||||
1486 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(0, 0)); | ||||
1487 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1488 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
1489 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1490 | | ||||
1491 | QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); | ||||
1492 | QVERIFY(geometryChangedSpy.isValid()); | ||||
1493 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1494 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | ||||
1495 | QVERIFY(geometryChangedSpy.wait()); | ||||
1496 | QCOMPARE(client->size(), QSize(100, 50)); | ||||
1497 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); | ||||
1498 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); | ||||
1499 | | ||||
1500 | // If we create the client again, it should not be maximized (because last time it wasn't). | ||||
1501 | shellSurface.reset(); | ||||
1502 | surface.reset(); | ||||
1503 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1504 | surface.reset(Test::createSurface()); | ||||
1505 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1506 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1507 | shellSurface->setAppId("org.kde.foo"); | ||||
1508 | surface->commit(Surface::CommitFlag::None); | ||||
1509 | | ||||
1510 | QVERIFY(configureRequestedSpy->wait()); | ||||
1511 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1512 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(0, 0)); | ||||
1513 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1514 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||||
1515 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1516 | | ||||
1517 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1518 | client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||||
1519 | QVERIFY(client); | ||||
1520 | QVERIFY(client->isActive()); | ||||
1521 | QVERIFY(client->isMaximizable()); | ||||
1522 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); | ||||
1523 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); | ||||
1524 | QCOMPARE(client->size(), QSize(100, 50)); | ||||
1525 | | ||||
1526 | QVERIFY(configureRequestedSpy->wait()); | ||||
1527 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1528 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1529 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
1530 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1531 | | ||||
1532 | // Destroy the client. | ||||
1533 | shellSurface.reset(); | ||||
1534 | surface.reset(); | ||||
1535 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1536 | } | ||||
1537 | | ||||
1538 | TEST_DATA(testMaximizeForce) | ||||
1539 | | ||||
1540 | void TestShellClientRules::testMaximizeForce() | ||||
1541 | { | ||||
1542 | // Set the test rule. | ||||
1543 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
1544 | config->group("General").writeEntry("count", 1); | ||||
1545 | auto group = config->group("1"); | ||||
1546 | group.writeEntry("maximizehoriz", true); | ||||
1547 | group.writeEntry("maximizehorizrule", 2); | ||||
1548 | group.writeEntry("maximizevert", true); | ||||
1549 | group.writeEntry("maximizevertrule", 2); | ||||
1550 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
1551 | group.writeEntry("wmclasscomplete", false); | ||||
1552 | group.writeEntry("wmclassmatch", 1); | ||||
1553 | group.sync(); | ||||
1554 | RuleBook::self()->setConfig(config); | ||||
1555 | workspace()->slotReconfigure(); | ||||
1556 | | ||||
1557 | // Create the test surface. | ||||
1558 | QFETCH(Test::ShellSurfaceType, type); | ||||
1559 | QScopedPointer<Surface> surface; | ||||
1560 | surface.reset(Test::createSurface()); | ||||
1561 | QScopedPointer<XdgShellSurface> shellSurface; | ||||
1562 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1563 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||||
1564 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1565 | shellSurface->setAppId("org.kde.foo"); | ||||
1566 | surface->commit(Surface::CommitFlag::None); | ||||
1567 | | ||||
1568 | // Wait for the initial configure event. | ||||
1569 | XdgShellSurface::States states; | ||||
1570 | QVERIFY(configureRequestedSpy->wait()); | ||||
1571 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1572 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024)); | ||||
1573 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1574 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||||
1575 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1576 | | ||||
1577 | // Map the surface. | ||||
1578 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1579 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue); | ||||
1580 | QVERIFY(client); | ||||
1581 | QVERIFY(client->isActive()); | ||||
1582 | QVERIFY(!client->isMaximizable()); | ||||
1583 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | ||||
1584 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); | ||||
1585 | QCOMPARE(client->size(), QSize(1280, 1024)); | ||||
1586 | | ||||
1587 | // We should receive a configure event when the client becomes active. | ||||
1588 | QVERIFY(configureRequestedSpy->wait()); | ||||
1589 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1590 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1591 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
1592 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1593 | | ||||
1594 | // Any attempt to change the maximize state should not succeed. | ||||
1595 | const QRect oldGeometry = client->geometry(); | ||||
1596 | workspace()->slotWindowMaximize(); | ||||
1597 | QVERIFY(!configureRequestedSpy->wait(100)); | ||||
1598 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | ||||
1599 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); | ||||
1600 | QCOMPARE(client->geometry(), oldGeometry); | ||||
1601 | | ||||
1602 | // If we create the client again, the maximize state should still be forced. | ||||
1603 | shellSurface.reset(); | ||||
1604 | surface.reset(); | ||||
1605 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1606 | surface.reset(Test::createSurface()); | ||||
1607 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1608 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1609 | shellSurface->setAppId("org.kde.foo"); | ||||
1610 | surface->commit(Surface::CommitFlag::None); | ||||
1611 | | ||||
1612 | QVERIFY(configureRequestedSpy->wait()); | ||||
1613 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1614 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024)); | ||||
1615 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1616 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||||
1617 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1618 | | ||||
1619 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1620 | client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue); | ||||
1621 | QVERIFY(client); | ||||
1622 | QVERIFY(client->isActive()); | ||||
1623 | QVERIFY(!client->isMaximizable()); | ||||
1624 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | ||||
1625 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); | ||||
1626 | QCOMPARE(client->size(), QSize(1280, 1024)); | ||||
1627 | | ||||
1628 | QVERIFY(configureRequestedSpy->wait()); | ||||
1629 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1630 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1631 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
1632 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1633 | | ||||
1634 | // Destroy the client. | ||||
1635 | shellSurface.reset(); | ||||
1636 | surface.reset(); | ||||
1637 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1638 | } | ||||
1639 | | ||||
1640 | TEST_DATA(testMaximizeApplyNow) | ||||
1641 | | ||||
1642 | void TestShellClientRules::testMaximizeApplyNow() | ||||
1643 | { | ||||
1644 | // Create the test surface. | ||||
1645 | QFETCH(Test::ShellSurfaceType, type); | ||||
1646 | QScopedPointer<Surface> surface; | ||||
1647 | surface.reset(Test::createSurface()); | ||||
1648 | QScopedPointer<XdgShellSurface> shellSurface; | ||||
1649 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1650 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||||
1651 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1652 | shellSurface->setAppId("org.kde.foo"); | ||||
1653 | surface->commit(Surface::CommitFlag::None); | ||||
1654 | | ||||
1655 | // Wait for the initial configure event. | ||||
1656 | XdgShellSurface::States states; | ||||
1657 | QVERIFY(configureRequestedSpy->wait()); | ||||
1658 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1659 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(0, 0)); | ||||
1660 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1661 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||||
1662 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1663 | | ||||
1664 | // Map the surface. | ||||
1665 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1666 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||||
1667 | QVERIFY(client); | ||||
1668 | QVERIFY(client->isActive()); | ||||
1669 | QVERIFY(client->isMaximizable()); | ||||
1670 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); | ||||
1671 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); | ||||
1672 | QCOMPARE(client->size(), QSize(100, 50)); | ||||
1673 | | ||||
1674 | // We should receive a configure event when the client becomes active. | ||||
1675 | QVERIFY(configureRequestedSpy->wait()); | ||||
1676 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1677 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1678 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
1679 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1680 | | ||||
1681 | // Set the test rule. | ||||
1682 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
1683 | config->group("General").writeEntry("count", 1); | ||||
1684 | auto group = config->group("1"); | ||||
1685 | group.writeEntry("maximizehoriz", true); | ||||
1686 | group.writeEntry("maximizehorizrule", 5); | ||||
1687 | group.writeEntry("maximizevert", true); | ||||
1688 | group.writeEntry("maximizevertrule", 5); | ||||
1689 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
1690 | group.writeEntry("wmclasscomplete", false); | ||||
1691 | group.writeEntry("wmclassmatch", 1); | ||||
1692 | group.sync(); | ||||
1693 | RuleBook::self()->setConfig(config); | ||||
1694 | workspace()->slotReconfigure(); | ||||
1695 | | ||||
1696 | // We should receive a configure event with a new surface size. | ||||
1697 | QVERIFY(configureRequestedSpy->wait()); | ||||
1698 | QCOMPARE(configureRequestedSpy->count(), 3); | ||||
1699 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024)); | ||||
1700 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1701 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
1702 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1703 | | ||||
1704 | // Draw contents of the maximized client. | ||||
1705 | QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); | ||||
1706 | QVERIFY(geometryChangedSpy.isValid()); | ||||
1707 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1708 | Test::render(surface.data(), QSize(1280, 1024), Qt::blue); | ||||
1709 | QVERIFY(geometryChangedSpy.wait()); | ||||
1710 | QCOMPARE(client->size(), QSize(1280, 1024)); | ||||
1711 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | ||||
1712 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); | ||||
1713 | | ||||
1714 | // The client still has to be maximizeable. | ||||
1715 | QVERIFY(client->isMaximizable()); | ||||
1716 | | ||||
1717 | // Restore the client. | ||||
1718 | workspace()->slotWindowMaximize(); | ||||
1719 | QVERIFY(configureRequestedSpy->wait()); | ||||
1720 | QCOMPARE(configureRequestedSpy->count(), 4); | ||||
1721 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(100, 50)); | ||||
1722 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1723 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
1724 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1725 | | ||||
1726 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1727 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | ||||
1728 | QVERIFY(geometryChangedSpy.wait()); | ||||
1729 | QCOMPARE(client->size(), QSize(100, 50)); | ||||
1730 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); | ||||
1731 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); | ||||
1732 | | ||||
1733 | // The rule should be discarded after it's been applied. | ||||
1734 | const QRect oldGeometry = client->geometry(); | ||||
1735 | client->evaluateWindowRules(); | ||||
1736 | QVERIFY(!configureRequestedSpy->wait(100)); | ||||
1737 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); | ||||
1738 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); | ||||
1739 | QCOMPARE(client->geometry(), oldGeometry); | ||||
1740 | | ||||
1741 | // Destroy the client. | ||||
1742 | shellSurface.reset(); | ||||
1743 | surface.reset(); | ||||
1744 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1745 | } | ||||
1746 | | ||||
1747 | TEST_DATA(testMaximizeForceTemporarily) | ||||
1748 | | ||||
1749 | void TestShellClientRules::testMaximizeForceTemporarily() | ||||
1750 | { | ||||
1751 | // Set the test rule. | ||||
1752 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
1753 | config->group("General").writeEntry("count", 1); | ||||
1754 | auto group = config->group("1"); | ||||
1755 | group.writeEntry("maximizehoriz", true); | ||||
1756 | group.writeEntry("maximizehorizrule", 6); | ||||
1757 | group.writeEntry("maximizevert", true); | ||||
1758 | group.writeEntry("maximizevertrule", 6); | ||||
1759 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
1760 | group.writeEntry("wmclasscomplete", false); | ||||
1761 | group.writeEntry("wmclassmatch", 1); | ||||
1762 | group.sync(); | ||||
1763 | RuleBook::self()->setConfig(config); | ||||
1764 | workspace()->slotReconfigure(); | ||||
1765 | | ||||
1766 | // Create the test surface. | ||||
1767 | QFETCH(Test::ShellSurfaceType, type); | ||||
1768 | QScopedPointer<Surface> surface; | ||||
1769 | surface.reset(Test::createSurface()); | ||||
1770 | QScopedPointer<XdgShellSurface> shellSurface; | ||||
1771 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1772 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||||
1773 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1774 | shellSurface->setAppId("org.kde.foo"); | ||||
1775 | surface->commit(Surface::CommitFlag::None); | ||||
1776 | | ||||
1777 | // Wait for the initial configure event. | ||||
1778 | XdgShellSurface::States states; | ||||
1779 | QVERIFY(configureRequestedSpy->wait()); | ||||
1780 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1781 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(1280, 1024)); | ||||
1782 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1783 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||||
1784 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1785 | | ||||
1786 | // Map the surface. | ||||
1787 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1788 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::blue); | ||||
1789 | QVERIFY(client); | ||||
1790 | QVERIFY(client->isActive()); | ||||
1791 | QVERIFY(!client->isMaximizable()); | ||||
1792 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | ||||
1793 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); | ||||
1794 | QCOMPARE(client->size(), QSize(1280, 1024)); | ||||
1795 | | ||||
1796 | // We should receive a configure event when the client becomes active. | ||||
1797 | QVERIFY(configureRequestedSpy->wait()); | ||||
1798 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1799 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1800 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
1801 | QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1802 | | ||||
1803 | // Any attempt to change the maximize state should not succeed. | ||||
1804 | const QRect oldGeometry = client->geometry(); | ||||
1805 | workspace()->slotWindowMaximize(); | ||||
1806 | QVERIFY(!configureRequestedSpy->wait(100)); | ||||
1807 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); | ||||
1808 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); | ||||
1809 | QCOMPARE(client->geometry(), oldGeometry); | ||||
1810 | | ||||
1811 | // The rule should be discarded if we close the client. | ||||
1812 | shellSurface.reset(); | ||||
1813 | surface.reset(); | ||||
1814 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1815 | surface.reset(Test::createSurface()); | ||||
1816 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1817 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1818 | shellSurface->setAppId("org.kde.foo"); | ||||
1819 | surface->commit(Surface::CommitFlag::None); | ||||
1820 | | ||||
1821 | QVERIFY(configureRequestedSpy->wait()); | ||||
1822 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1823 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(0, 0)); | ||||
1824 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1825 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||||
1826 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1827 | | ||||
1828 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1829 | client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||||
1830 | QVERIFY(client); | ||||
1831 | QVERIFY(client->isActive()); | ||||
1832 | QVERIFY(client->isMaximizable()); | ||||
1833 | QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); | ||||
1834 | QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); | ||||
1835 | QCOMPARE(client->size(), QSize(100, 50)); | ||||
1836 | | ||||
1837 | QVERIFY(configureRequestedSpy->wait()); | ||||
1838 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1839 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
1840 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
1841 | QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); | ||||
1842 | | ||||
1843 | // Destroy the client. | ||||
1844 | shellSurface.reset(); | ||||
1845 | surface.reset(); | ||||
1846 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1847 | } | ||||
1848 | | ||||
1239 | TEST_DATA(testDesktopDontAffect) | 1849 | TEST_DATA(testDesktopDontAffect) | ||
1240 | 1850 | | |||
1241 | void TestShellClientRules::testDesktopDontAffect() | 1851 | void TestShellClientRules::testDesktopDontAffect() | ||
1242 | { | 1852 | { | ||
1243 | // Set the test rule. | 1853 | // Set the test rule. | ||
1244 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 1854 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
1245 | config->group("General").writeEntry("count", 1); | 1855 | config->group("General").writeEntry("count", 1); | ||
1246 | auto group = config->group("1"); | 1856 | auto group = config->group("1"); | ||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 1893 | { | |||
1324 | VirtualDesktopManager::self()->setCurrent(1); | 1934 | VirtualDesktopManager::self()->setCurrent(1); | ||
1325 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1935 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
1326 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1936 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1327 | QVERIFY(client); | 1937 | QVERIFY(client); | ||
1328 | QCOMPARE(client->desktop(), 2); | 1938 | QCOMPARE(client->desktop(), 2); | ||
1329 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | 1939 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | ||
1330 | 1940 | | |||
1331 | // Destroy the client. | 1941 | // Destroy the client. | ||
1332 | delete shellSurface; | 1942 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1333 | delete surface; | 1943 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1334 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1944 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1335 | } | 1945 | } | ||
1336 | 1946 | | |||
1337 | TEST_DATA(testDesktopRemember) | 1947 | TEST_DATA(testDesktopRemember) | ||
1338 | 1948 | | |||
1339 | void TestShellClientRules::testDesktopRemember() | 1949 | void TestShellClientRules::testDesktopRemember() | ||
1340 | { | 1950 | { | ||
1341 | // Set the test rule. | 1951 | // Set the test rule. | ||
Show All 35 Lines | |||||
1377 | 1987 | | |||
1378 | // If open the client again, it should appear on the first virtual desktop. | 1988 | // If open the client again, it should appear on the first virtual desktop. | ||
1379 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1989 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1380 | QVERIFY(client); | 1990 | QVERIFY(client); | ||
1381 | QCOMPARE(client->desktop(), 1); | 1991 | QCOMPARE(client->desktop(), 1); | ||
1382 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1992 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
1383 | 1993 | | |||
1384 | // Destroy the client. | 1994 | // Destroy the client. | ||
1385 | delete shellSurface; | 1995 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1386 | delete surface; | 1996 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1387 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1997 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1388 | } | 1998 | } | ||
1389 | 1999 | | |||
1390 | TEST_DATA(testDesktopForce) | 2000 | TEST_DATA(testDesktopForce) | ||
1391 | 2001 | | |||
1392 | void TestShellClientRules::testDesktopForce() | 2002 | void TestShellClientRules::testDesktopForce() | ||
1393 | { | 2003 | { | ||
1394 | // Set the test rule. | 2004 | // Set the test rule. | ||
Show All 39 Lines | |||||
1434 | VirtualDesktopManager::self()->setCurrent(1); | 2044 | VirtualDesktopManager::self()->setCurrent(1); | ||
1435 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2045 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
1436 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2046 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1437 | QVERIFY(client); | 2047 | QVERIFY(client); | ||
1438 | QCOMPARE(client->desktop(), 2); | 2048 | QCOMPARE(client->desktop(), 2); | ||
1439 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | 2049 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | ||
1440 | 2050 | | |||
1441 | // Destroy the client. | 2051 | // Destroy the client. | ||
1442 | delete shellSurface; | 2052 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1443 | delete surface; | 2053 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1444 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2054 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1445 | } | 2055 | } | ||
1446 | 2056 | | |||
1447 | TEST_DATA(testDesktopApplyNow) | 2057 | TEST_DATA(testDesktopApplyNow) | ||
1448 | 2058 | | |||
1449 | void TestShellClientRules::testDesktopApplyNow() | 2059 | void TestShellClientRules::testDesktopApplyNow() | ||
1450 | { | 2060 | { | ||
1451 | // We need at least two virtual desktop for this test. | 2061 | // We need at least two virtual desktop for this test. | ||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | 2113 | { | |||
1552 | workspace()->sendClientToDesktop(client, 2, true); | 2162 | workspace()->sendClientToDesktop(client, 2, true); | ||
1553 | QCOMPARE(client->desktop(), 2); | 2163 | QCOMPARE(client->desktop(), 2); | ||
1554 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2164 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
1555 | workspace()->sendClientToDesktop(client, 1, true); | 2165 | workspace()->sendClientToDesktop(client, 1, true); | ||
1556 | QCOMPARE(client->desktop(), 1); | 2166 | QCOMPARE(client->desktop(), 1); | ||
1557 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2167 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
1558 | 2168 | | |||
1559 | // Destroy the client. | 2169 | // Destroy the client. | ||
1560 | delete shellSurface; | 2170 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1561 | delete surface; | 2171 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1562 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2172 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1563 | } | 2173 | } | ||
1564 | 2174 | | |||
1565 | TEST_DATA(testMinimizeDontAffect) | 2175 | TEST_DATA(testMinimizeDontAffect) | ||
1566 | 2176 | | |||
1567 | void TestShellClientRules::testMinimizeDontAffect() | 2177 | void TestShellClientRules::testMinimizeDontAffect() | ||
1568 | { | 2178 | { | ||
1569 | // Set the test rule. | 2179 | // Set the test rule. | ||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 2213 | { | |||
1635 | delete surface; | 2245 | delete surface; | ||
1636 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2246 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1637 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2247 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1638 | QVERIFY(client); | 2248 | QVERIFY(client); | ||
1639 | QVERIFY(client->isMinimizable()); | 2249 | QVERIFY(client->isMinimizable()); | ||
1640 | QVERIFY(client->isMinimized()); | 2250 | QVERIFY(client->isMinimized()); | ||
1641 | 2251 | | |||
1642 | // Destroy the client. | 2252 | // Destroy the client. | ||
1643 | delete shellSurface; | 2253 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1644 | delete surface; | 2254 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1645 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2255 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1646 | } | 2256 | } | ||
1647 | 2257 | | |||
1648 | TEST_DATA(testMinimizeRemember) | 2258 | TEST_DATA(testMinimizeRemember) | ||
1649 | 2259 | | |||
1650 | void TestShellClientRules::testMinimizeRemember() | 2260 | void TestShellClientRules::testMinimizeRemember() | ||
1651 | { | 2261 | { | ||
1652 | // Set the test rule. | 2262 | // Set the test rule. | ||
Show All 28 Lines | |||||
1681 | delete surface; | 2291 | delete surface; | ||
1682 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2292 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1683 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2293 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1684 | QVERIFY(client); | 2294 | QVERIFY(client); | ||
1685 | QVERIFY(client->isMinimizable()); | 2295 | QVERIFY(client->isMinimizable()); | ||
1686 | QVERIFY(client->isMinimized()); | 2296 | QVERIFY(client->isMinimized()); | ||
1687 | 2297 | | |||
1688 | // Destroy the client. | 2298 | // Destroy the client. | ||
1689 | delete shellSurface; | 2299 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1690 | delete surface; | 2300 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1691 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2301 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1692 | } | 2302 | } | ||
1693 | 2303 | | |||
1694 | TEST_DATA(testMinimizeForce) | 2304 | TEST_DATA(testMinimizeForce) | ||
1695 | 2305 | | |||
1696 | void TestShellClientRules::testMinimizeForce() | 2306 | void TestShellClientRules::testMinimizeForce() | ||
1697 | { | 2307 | { | ||
1698 | // Set the test rule. | 2308 | // Set the test rule. | ||
Show All 30 Lines | |||||
1729 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2339 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1730 | QVERIFY(client); | 2340 | QVERIFY(client); | ||
1731 | QVERIFY(!client->isMinimizable()); | 2341 | QVERIFY(!client->isMinimizable()); | ||
1732 | QVERIFY(!client->isMinimized()); | 2342 | QVERIFY(!client->isMinimized()); | ||
1733 | client->minimize(); | 2343 | client->minimize(); | ||
1734 | QVERIFY(!client->isMinimized()); | 2344 | QVERIFY(!client->isMinimized()); | ||
1735 | 2345 | | |||
1736 | // Destroy the client. | 2346 | // Destroy the client. | ||
1737 | delete shellSurface; | 2347 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1738 | delete surface; | 2348 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1739 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2349 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1740 | } | 2350 | } | ||
1741 | 2351 | | |||
1742 | TEST_DATA(testMinimizeApplyNow) | 2352 | TEST_DATA(testMinimizeApplyNow) | ||
1743 | 2353 | | |||
1744 | void TestShellClientRules::testMinimizeApplyNow() | 2354 | void TestShellClientRules::testMinimizeApplyNow() | ||
1745 | { | 2355 | { | ||
1746 | // Create the test client. | 2356 | // Create the test client. | ||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Line(s) | 2401 | { | |||
1823 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2433 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1824 | QVERIFY(client); | 2434 | QVERIFY(client); | ||
1825 | QVERIFY(client->isMinimizable()); | 2435 | QVERIFY(client->isMinimizable()); | ||
1826 | QVERIFY(!client->isMinimized()); | 2436 | QVERIFY(!client->isMinimized()); | ||
1827 | client->minimize(); | 2437 | client->minimize(); | ||
1828 | QVERIFY(client->isMinimized()); | 2438 | QVERIFY(client->isMinimized()); | ||
1829 | 2439 | | |||
1830 | // Destroy the client. | 2440 | // Destroy the client. | ||
1831 | delete shellSurface; | 2441 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1832 | delete surface; | 2442 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1833 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2443 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1834 | } | 2444 | } | ||
1835 | 2445 | | |||
1836 | TEST_DATA(testSkipTaskbarDontAffect) | 2446 | TEST_DATA(testSkipTaskbarDontAffect) | ||
1837 | 2447 | | |||
1838 | void TestShellClientRules::testSkipTaskbarDontAffect() | 2448 | void TestShellClientRules::testSkipTaskbarDontAffect() | ||
1839 | { | 2449 | { | ||
1840 | // Set the test rule. | 2450 | // Set the test rule. | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 2483 | { | |||
1903 | delete shellSurface; | 2513 | delete shellSurface; | ||
1904 | delete surface; | 2514 | delete surface; | ||
1905 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2515 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1906 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2516 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1907 | QVERIFY(client); | 2517 | QVERIFY(client); | ||
1908 | QVERIFY(client->skipTaskbar()); | 2518 | QVERIFY(client->skipTaskbar()); | ||
1909 | 2519 | | |||
1910 | // Destroy the client. | 2520 | // Destroy the client. | ||
1911 | delete shellSurface; | 2521 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1912 | delete surface; | 2522 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1913 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2523 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1914 | } | 2524 | } | ||
1915 | 2525 | | |||
1916 | TEST_DATA(testSkipTaskbarRemember) | 2526 | TEST_DATA(testSkipTaskbarRemember) | ||
1917 | 2527 | | |||
1918 | void TestShellClientRules::testSkipTaskbarRemember() | 2528 | void TestShellClientRules::testSkipTaskbarRemember() | ||
1919 | { | 2529 | { | ||
1920 | // Set the test rule. | 2530 | // Set the test rule. | ||
Show All 30 Lines | |||||
1951 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2561 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1952 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2562 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1953 | QVERIFY(client); | 2563 | QVERIFY(client); | ||
1954 | 2564 | | |||
1955 | // The client should be included on a taskbar. | 2565 | // The client should be included on a taskbar. | ||
1956 | QVERIFY(!client->skipTaskbar()); | 2566 | QVERIFY(!client->skipTaskbar()); | ||
1957 | 2567 | | |||
1958 | // Destroy the client. | 2568 | // Destroy the client. | ||
1959 | delete shellSurface; | 2569 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1960 | delete surface; | 2570 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1961 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2571 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1962 | } | 2572 | } | ||
1963 | 2573 | | |||
1964 | TEST_DATA(testSkipTaskbarForce) | 2574 | TEST_DATA(testSkipTaskbarForce) | ||
1965 | 2575 | | |||
1966 | void TestShellClientRules::testSkipTaskbarForce() | 2576 | void TestShellClientRules::testSkipTaskbarForce() | ||
1967 | { | 2577 | { | ||
1968 | // Set the test rule. | 2578 | // Set the test rule. | ||
Show All 30 Lines | |||||
1999 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2609 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2000 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2610 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2001 | QVERIFY(client); | 2611 | QVERIFY(client); | ||
2002 | 2612 | | |||
2003 | // The skip-taskbar state should be still forced. | 2613 | // The skip-taskbar state should be still forced. | ||
2004 | QVERIFY(client->skipTaskbar()); | 2614 | QVERIFY(client->skipTaskbar()); | ||
2005 | 2615 | | |||
2006 | // Destroy the client. | 2616 | // Destroy the client. | ||
2007 | delete shellSurface; | 2617 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2008 | delete surface; | 2618 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2009 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2619 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2010 | } | 2620 | } | ||
2011 | 2621 | | |||
2012 | TEST_DATA(testSkipTaskbarApplyNow) | 2622 | TEST_DATA(testSkipTaskbarApplyNow) | ||
2013 | 2623 | | |||
2014 | void TestShellClientRules::testSkipTaskbarApplyNow() | 2624 | void TestShellClientRules::testSkipTaskbarApplyNow() | ||
2015 | { | 2625 | { | ||
2016 | // Create the test client. | 2626 | // Create the test client. | ||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 2668 | { | |||
2094 | // The client should be included on a taskbar now. | 2704 | // The client should be included on a taskbar now. | ||
2095 | QVERIFY(!client->skipTaskbar()); | 2705 | QVERIFY(!client->skipTaskbar()); | ||
2096 | 2706 | | |||
2097 | // Also, one can change that. | 2707 | // Also, one can change that. | ||
2098 | client->setOriginalSkipTaskbar(true); | 2708 | client->setOriginalSkipTaskbar(true); | ||
2099 | QVERIFY(client->skipTaskbar()); | 2709 | QVERIFY(client->skipTaskbar()); | ||
2100 | 2710 | | |||
2101 | // Destroy the client. | 2711 | // Destroy the client. | ||
2102 | delete shellSurface; | 2712 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2103 | delete surface; | 2713 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2104 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2714 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2105 | } | 2715 | } | ||
2106 | 2716 | | |||
2107 | TEST_DATA(testSkipPagerDontAffect) | 2717 | TEST_DATA(testSkipPagerDontAffect) | ||
2108 | 2718 | | |||
2109 | void TestShellClientRules::testSkipPagerDontAffect() | 2719 | void TestShellClientRules::testSkipPagerDontAffect() | ||
2110 | { | 2720 | { | ||
2111 | // Set the test rule. | 2721 | // Set the test rule. | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 2754 | { | |||
2174 | delete shellSurface; | 2784 | delete shellSurface; | ||
2175 | delete surface; | 2785 | delete surface; | ||
2176 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2786 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2177 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2787 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2178 | QVERIFY(client); | 2788 | QVERIFY(client); | ||
2179 | QVERIFY(client->skipPager()); | 2789 | QVERIFY(client->skipPager()); | ||
2180 | 2790 | | |||
2181 | // Destroy the client. | 2791 | // Destroy the client. | ||
2182 | delete shellSurface; | 2792 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2183 | delete surface; | 2793 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2184 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2794 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2185 | } | 2795 | } | ||
2186 | 2796 | | |||
2187 | TEST_DATA(testSkipPagerRemember) | 2797 | TEST_DATA(testSkipPagerRemember) | ||
2188 | 2798 | | |||
2189 | void TestShellClientRules::testSkipPagerRemember() | 2799 | void TestShellClientRules::testSkipPagerRemember() | ||
2190 | { | 2800 | { | ||
2191 | // Set the test rule. | 2801 | // Set the test rule. | ||
Show All 30 Lines | |||||
2222 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2832 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2223 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2833 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2224 | QVERIFY(client); | 2834 | QVERIFY(client); | ||
2225 | 2835 | | |||
2226 | // The client should be included on a pager. | 2836 | // The client should be included on a pager. | ||
2227 | QVERIFY(!client->skipPager()); | 2837 | QVERIFY(!client->skipPager()); | ||
2228 | 2838 | | |||
2229 | // Destroy the client. | 2839 | // Destroy the client. | ||
2230 | delete shellSurface; | 2840 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2231 | delete surface; | 2841 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2232 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2842 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2233 | } | 2843 | } | ||
2234 | 2844 | | |||
2235 | TEST_DATA(testSkipPagerForce) | 2845 | TEST_DATA(testSkipPagerForce) | ||
2236 | 2846 | | |||
2237 | void TestShellClientRules::testSkipPagerForce() | 2847 | void TestShellClientRules::testSkipPagerForce() | ||
2238 | { | 2848 | { | ||
2239 | // Set the test rule. | 2849 | // Set the test rule. | ||
Show All 30 Lines | |||||
2270 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2880 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2271 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2881 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2272 | QVERIFY(client); | 2882 | QVERIFY(client); | ||
2273 | 2883 | | |||
2274 | // The skip-pager state should be still forced. | 2884 | // The skip-pager state should be still forced. | ||
2275 | QVERIFY(client->skipPager()); | 2885 | QVERIFY(client->skipPager()); | ||
2276 | 2886 | | |||
2277 | // Destroy the client. | 2887 | // Destroy the client. | ||
2278 | delete shellSurface; | 2888 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2279 | delete surface; | 2889 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2280 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2890 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2281 | } | 2891 | } | ||
2282 | 2892 | | |||
2283 | TEST_DATA(testSkipPagerApplyNow) | 2893 | TEST_DATA(testSkipPagerApplyNow) | ||
2284 | 2894 | | |||
2285 | void TestShellClientRules::testSkipPagerApplyNow() | 2895 | void TestShellClientRules::testSkipPagerApplyNow() | ||
2286 | { | 2896 | { | ||
2287 | // Create the test client. | 2897 | // Create the test client. | ||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 2939 | { | |||
2365 | // The client should be included on a pager now. | 2975 | // The client should be included on a pager now. | ||
2366 | QVERIFY(!client->skipPager()); | 2976 | QVERIFY(!client->skipPager()); | ||
2367 | 2977 | | |||
2368 | // Also, one can change that. | 2978 | // Also, one can change that. | ||
2369 | client->setSkipPager(true); | 2979 | client->setSkipPager(true); | ||
2370 | QVERIFY(client->skipPager()); | 2980 | QVERIFY(client->skipPager()); | ||
2371 | 2981 | | |||
2372 | // Destroy the client. | 2982 | // Destroy the client. | ||
2373 | delete shellSurface; | 2983 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2374 | delete surface; | 2984 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2375 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2985 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2376 | } | 2986 | } | ||
2377 | 2987 | | |||
2378 | TEST_DATA(testSkipSwitcherDontAffect) | 2988 | TEST_DATA(testSkipSwitcherDontAffect) | ||
2379 | 2989 | | |||
2380 | void TestShellClientRules::testSkipSwitcherDontAffect() | 2990 | void TestShellClientRules::testSkipSwitcherDontAffect() | ||
2381 | { | 2991 | { | ||
2382 | // Set the test rule. | 2992 | // Set the test rule. | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 3025 | { | |||
2445 | delete shellSurface; | 3055 | delete shellSurface; | ||
2446 | delete surface; | 3056 | delete surface; | ||
2447 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3057 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2448 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3058 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2449 | QVERIFY(client); | 3059 | QVERIFY(client); | ||
2450 | QVERIFY(client->skipSwitcher()); | 3060 | QVERIFY(client->skipSwitcher()); | ||
2451 | 3061 | | |||
2452 | // Destroy the client. | 3062 | // Destroy the client. | ||
2453 | delete shellSurface; | 3063 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2454 | delete surface; | 3064 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2455 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3065 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2456 | } | 3066 | } | ||
2457 | 3067 | | |||
2458 | TEST_DATA(testSkipSwitcherRemember) | 3068 | TEST_DATA(testSkipSwitcherRemember) | ||
2459 | 3069 | | |||
2460 | void TestShellClientRules::testSkipSwitcherRemember() | 3070 | void TestShellClientRules::testSkipSwitcherRemember() | ||
2461 | { | 3071 | { | ||
2462 | // Set the test rule. | 3072 | // Set the test rule. | ||
Show All 30 Lines | |||||
2493 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3103 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2494 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3104 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2495 | QVERIFY(client); | 3105 | QVERIFY(client); | ||
2496 | 3106 | | |||
2497 | // The client should be included in window switching effects. | 3107 | // The client should be included in window switching effects. | ||
2498 | QVERIFY(!client->skipSwitcher()); | 3108 | QVERIFY(!client->skipSwitcher()); | ||
2499 | 3109 | | |||
2500 | // Destroy the client. | 3110 | // Destroy the client. | ||
2501 | delete shellSurface; | 3111 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2502 | delete surface; | 3112 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2503 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3113 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2504 | } | 3114 | } | ||
2505 | 3115 | | |||
2506 | TEST_DATA(testSkipSwitcherForce) | 3116 | TEST_DATA(testSkipSwitcherForce) | ||
2507 | 3117 | | |||
2508 | void TestShellClientRules::testSkipSwitcherForce() | 3118 | void TestShellClientRules::testSkipSwitcherForce() | ||
2509 | { | 3119 | { | ||
2510 | // Set the test rule. | 3120 | // Set the test rule. | ||
Show All 30 Lines | |||||
2541 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3151 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2542 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3152 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2543 | QVERIFY(client); | 3153 | QVERIFY(client); | ||
2544 | 3154 | | |||
2545 | // The skip-switcher state should be still forced. | 3155 | // The skip-switcher state should be still forced. | ||
2546 | QVERIFY(client->skipSwitcher()); | 3156 | QVERIFY(client->skipSwitcher()); | ||
2547 | 3157 | | |||
2548 | // Destroy the client. | 3158 | // Destroy the client. | ||
2549 | delete shellSurface; | 3159 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2550 | delete surface; | 3160 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2551 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3161 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2552 | } | 3162 | } | ||
2553 | 3163 | | |||
2554 | TEST_DATA(testSkipSwitcherApplyNow) | 3164 | TEST_DATA(testSkipSwitcherApplyNow) | ||
2555 | 3165 | | |||
2556 | void TestShellClientRules::testSkipSwitcherApplyNow() | 3166 | void TestShellClientRules::testSkipSwitcherApplyNow() | ||
2557 | { | 3167 | { | ||
2558 | // Create the test client. | 3168 | // Create the test client. | ||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 3210 | { | |||
2636 | // The client should be included in window switching effects now. | 3246 | // The client should be included in window switching effects now. | ||
2637 | QVERIFY(!client->skipSwitcher()); | 3247 | QVERIFY(!client->skipSwitcher()); | ||
2638 | 3248 | | |||
2639 | // Also, one can change that. | 3249 | // Also, one can change that. | ||
2640 | client->setSkipSwitcher(true); | 3250 | client->setSkipSwitcher(true); | ||
2641 | QVERIFY(client->skipSwitcher()); | 3251 | QVERIFY(client->skipSwitcher()); | ||
2642 | 3252 | | |||
2643 | // Destroy the client. | 3253 | // Destroy the client. | ||
2644 | delete shellSurface; | 3254 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2645 | delete surface; | 3255 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2646 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3256 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2647 | } | 3257 | } | ||
2648 | 3258 | | |||
2649 | TEST_DATA(testKeepAboveDontAffect) | 3259 | TEST_DATA(testKeepAboveDontAffect) | ||
2650 | 3260 | | |||
2651 | void TestShellClientRules::testKeepAboveDontAffect() | 3261 | void TestShellClientRules::testKeepAboveDontAffect() | ||
2652 | { | 3262 | { | ||
2653 | // Set the test rule. | 3263 | // Set the test rule. | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 3296 | { | |||
2716 | delete shellSurface; | 3326 | delete shellSurface; | ||
2717 | delete surface; | 3327 | delete surface; | ||
2718 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3328 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2719 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3329 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2720 | QVERIFY(client); | 3330 | QVERIFY(client); | ||
2721 | QVERIFY(client->keepAbove()); | 3331 | QVERIFY(client->keepAbove()); | ||
2722 | 3332 | | |||
2723 | // Destroy the client. | 3333 | // Destroy the client. | ||
2724 | delete shellSurface; | 3334 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2725 | delete surface; | 3335 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2726 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3336 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2727 | } | 3337 | } | ||
2728 | 3338 | | |||
2729 | TEST_DATA(testKeepAboveRemember) | 3339 | TEST_DATA(testKeepAboveRemember) | ||
2730 | 3340 | | |||
2731 | void TestShellClientRules::testKeepAboveRemember() | 3341 | void TestShellClientRules::testKeepAboveRemember() | ||
2732 | { | 3342 | { | ||
2733 | // Set the test rule. | 3343 | // Set the test rule. | ||
Show All 28 Lines | |||||
2762 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3372 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2763 | 3373 | | |||
2764 | // Re-open the client, it should not be kept above. | 3374 | // Re-open the client, it should not be kept above. | ||
2765 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3375 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2766 | QVERIFY(client); | 3376 | QVERIFY(client); | ||
2767 | QVERIFY(!client->keepAbove()); | 3377 | QVERIFY(!client->keepAbove()); | ||
2768 | 3378 | | |||
2769 | // Destroy the client. | 3379 | // Destroy the client. | ||
2770 | delete shellSurface; | 3380 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2771 | delete surface; | 3381 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2772 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3382 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2773 | } | 3383 | } | ||
2774 | 3384 | | |||
2775 | TEST_DATA(testKeepAboveForce) | 3385 | TEST_DATA(testKeepAboveForce) | ||
2776 | 3386 | | |||
2777 | void TestShellClientRules::testKeepAboveForce() | 3387 | void TestShellClientRules::testKeepAboveForce() | ||
2778 | { | 3388 | { | ||
2779 | // Set the test rule. | 3389 | // Set the test rule. | ||
Show All 28 Lines | |||||
2808 | delete shellSurface; | 3418 | delete shellSurface; | ||
2809 | delete surface; | 3419 | delete surface; | ||
2810 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3420 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2811 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3421 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2812 | QVERIFY(client); | 3422 | QVERIFY(client); | ||
2813 | QVERIFY(client->keepAbove()); | 3423 | QVERIFY(client->keepAbove()); | ||
2814 | 3424 | | |||
2815 | // Destroy the client. | 3425 | // Destroy the client. | ||
2816 | delete shellSurface; | 3426 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2817 | delete surface; | 3427 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2818 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3428 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2819 | } | 3429 | } | ||
2820 | 3430 | | |||
2821 | TEST_DATA(testKeepAboveApplyNow) | 3431 | TEST_DATA(testKeepAboveApplyNow) | ||
2822 | 3432 | | |||
2823 | void TestShellClientRules::testKeepAboveApplyNow() | 3433 | void TestShellClientRules::testKeepAboveApplyNow() | ||
2824 | { | 3434 | { | ||
2825 | // Create the test client. | 3435 | // Create the test client. | ||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Line(s) | 3477 | { | |||
2905 | 3515 | | |||
2906 | // We should now be able to alter the keep-above state. | 3516 | // We should now be able to alter the keep-above state. | ||
2907 | client->setKeepAbove(true); | 3517 | client->setKeepAbove(true); | ||
2908 | QVERIFY(client->keepAbove()); | 3518 | QVERIFY(client->keepAbove()); | ||
2909 | client->setKeepAbove(false); | 3519 | client->setKeepAbove(false); | ||
2910 | QVERIFY(!client->keepAbove()); | 3520 | QVERIFY(!client->keepAbove()); | ||
2911 | 3521 | | |||
2912 | // Destroy the client. | 3522 | // Destroy the client. | ||
2913 | delete shellSurface; | 3523 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2914 | delete surface; | 3524 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2915 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3525 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2916 | } | 3526 | } | ||
2917 | 3527 | | |||
2918 | TEST_DATA(testKeepBelowDontAffect) | 3528 | TEST_DATA(testKeepBelowDontAffect) | ||
2919 | 3529 | | |||
2920 | void TestShellClientRules::testKeepBelowDontAffect() | 3530 | void TestShellClientRules::testKeepBelowDontAffect() | ||
2921 | { | 3531 | { | ||
2922 | // Set the test rule. | 3532 | // Set the test rule. | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 3565 | { | |||
2985 | delete shellSurface; | 3595 | delete shellSurface; | ||
2986 | delete surface; | 3596 | delete surface; | ||
2987 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3597 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2988 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3598 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2989 | QVERIFY(client); | 3599 | QVERIFY(client); | ||
2990 | QVERIFY(client->keepBelow()); | 3600 | QVERIFY(client->keepBelow()); | ||
2991 | 3601 | | |||
2992 | // Destroy the client. | 3602 | // Destroy the client. | ||
2993 | delete shellSurface; | 3603 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2994 | delete surface; | 3604 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2995 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3605 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2996 | } | 3606 | } | ||
2997 | 3607 | | |||
2998 | TEST_DATA(testKeepBelowRemember) | 3608 | TEST_DATA(testKeepBelowRemember) | ||
2999 | 3609 | | |||
3000 | void TestShellClientRules::testKeepBelowRemember() | 3610 | void TestShellClientRules::testKeepBelowRemember() | ||
3001 | { | 3611 | { | ||
3002 | // Set the test rule. | 3612 | // Set the test rule. | ||
Show All 28 Lines | |||||
3031 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3641 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3032 | 3642 | | |||
3033 | // Re-open the client, it should not be kept below. | 3643 | // Re-open the client, it should not be kept below. | ||
3034 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3644 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3035 | QVERIFY(client); | 3645 | QVERIFY(client); | ||
3036 | QVERIFY(!client->keepBelow()); | 3646 | QVERIFY(!client->keepBelow()); | ||
3037 | 3647 | | |||
3038 | // Destroy the client. | 3648 | // Destroy the client. | ||
3039 | delete shellSurface; | 3649 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3040 | delete surface; | 3650 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3041 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3651 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3042 | } | 3652 | } | ||
3043 | 3653 | | |||
3044 | TEST_DATA(testKeepBelowForce) | 3654 | TEST_DATA(testKeepBelowForce) | ||
3045 | 3655 | | |||
3046 | void TestShellClientRules::testKeepBelowForce() | 3656 | void TestShellClientRules::testKeepBelowForce() | ||
3047 | { | 3657 | { | ||
3048 | // Set the test rule. | 3658 | // Set the test rule. | ||
Show All 28 Lines | |||||
3077 | delete shellSurface; | 3687 | delete shellSurface; | ||
3078 | delete surface; | 3688 | delete surface; | ||
3079 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3689 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3080 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3690 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3081 | QVERIFY(client); | 3691 | QVERIFY(client); | ||
3082 | QVERIFY(client->keepBelow()); | 3692 | QVERIFY(client->keepBelow()); | ||
3083 | 3693 | | |||
3084 | // Destroy the client. | 3694 | // Destroy the client. | ||
3085 | delete shellSurface; | 3695 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3086 | delete surface; | 3696 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3087 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3697 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3088 | } | 3698 | } | ||
3089 | 3699 | | |||
3090 | TEST_DATA(testKeepBelowApplyNow) | 3700 | TEST_DATA(testKeepBelowApplyNow) | ||
3091 | 3701 | | |||
3092 | void TestShellClientRules::testKeepBelowApplyNow() | 3702 | void TestShellClientRules::testKeepBelowApplyNow() | ||
3093 | { | 3703 | { | ||
3094 | // Create the test client. | 3704 | // Create the test client. | ||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Line(s) | 3746 | { | |||
3174 | 3784 | | |||
3175 | // We should now be able to alter the keep-below state. | 3785 | // We should now be able to alter the keep-below state. | ||
3176 | client->setKeepBelow(true); | 3786 | client->setKeepBelow(true); | ||
3177 | QVERIFY(client->keepBelow()); | 3787 | QVERIFY(client->keepBelow()); | ||
3178 | client->setKeepBelow(false); | 3788 | client->setKeepBelow(false); | ||
3179 | QVERIFY(!client->keepBelow()); | 3789 | QVERIFY(!client->keepBelow()); | ||
3180 | 3790 | | |||
3181 | // Destroy the client. | 3791 | // Destroy the client. | ||
3182 | delete shellSurface; | 3792 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3183 | delete surface; | 3793 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3184 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3794 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3185 | } | 3795 | } | ||
3186 | 3796 | | |||
3187 | TEST_DATA(testShortcutDontAffect) | 3797 | TEST_DATA(testShortcutDontAffect) | ||
3188 | 3798 | | |||
3189 | void TestShellClientRules::testShortcutDontAffect() | 3799 | void TestShellClientRules::testShortcutDontAffect() | ||
3190 | { | 3800 | { | ||
3191 | // Set the test rule. | 3801 | // Set the test rule. | ||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Line(s) | 3847 | { | |||
3304 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3914 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3305 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3915 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3306 | QVERIFY(client); | 3916 | QVERIFY(client); | ||
3307 | 3917 | | |||
3308 | // The window shortcut should be set back to Ctrl+Alt+1. | 3918 | // The window shortcut should be set back to Ctrl+Alt+1. | ||
3309 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | 3919 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | ||
3310 | 3920 | | |||
3311 | // Destroy the client. | 3921 | // Destroy the client. | ||
3312 | delete shellSurface; | 3922 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3313 | delete surface; | 3923 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3314 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3924 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3315 | } | 3925 | } | ||
3316 | 3926 | | |||
3317 | TEST_DATA(testShortcutRemember) | 3927 | TEST_DATA(testShortcutRemember) | ||
3318 | 3928 | | |||
3319 | void TestShellClientRules::testShortcutRemember() | 3929 | void TestShellClientRules::testShortcutRemember() | ||
3320 | { | 3930 | { | ||
3321 | QSKIP("KWin core doesn't try to save the last used window shortcut"); | 3931 | QSKIP("KWin core doesn't try to save the last used window shortcut"); | ||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | |||||
3377 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3987 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3378 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3988 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3379 | QVERIFY(client); | 3989 | QVERIFY(client); | ||
3380 | 3990 | | |||
3381 | // The window shortcut should be set to the last known value. | 3991 | // The window shortcut should be set to the last known value. | ||
3382 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_2})); | 3992 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_2})); | ||
3383 | 3993 | | |||
3384 | // Destroy the client. | 3994 | // Destroy the client. | ||
3385 | delete shellSurface; | 3995 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3386 | delete surface; | 3996 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3387 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3997 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3388 | } | 3998 | } | ||
3389 | 3999 | | |||
3390 | TEST_DATA(testShortcutForce) | 4000 | TEST_DATA(testShortcutForce) | ||
3391 | 4001 | | |||
3392 | void TestShellClientRules::testShortcutForce() | 4002 | void TestShellClientRules::testShortcutForce() | ||
3393 | { | 4003 | { | ||
3394 | QSKIP("KWin core can't release forced window shortcuts"); | 4004 | QSKIP("KWin core can't release forced window shortcuts"); | ||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | |||||
3450 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4060 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3451 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4061 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3452 | QVERIFY(client); | 4062 | QVERIFY(client); | ||
3453 | 4063 | | |||
3454 | // The window shortcut should still be forced. | 4064 | // The window shortcut should still be forced. | ||
3455 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | 4065 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | ||
3456 | 4066 | | |||
3457 | // Destroy the client. | 4067 | // Destroy the client. | ||
3458 | delete shellSurface; | 4068 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3459 | delete surface; | 4069 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3460 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4070 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3461 | } | 4071 | } | ||
3462 | 4072 | | |||
3463 | TEST_DATA(testShortcutApplyNow) | 4073 | TEST_DATA(testShortcutApplyNow) | ||
3464 | 4074 | | |||
3465 | void TestShellClientRules::testShortcutApplyNow() | 4075 | void TestShellClientRules::testShortcutApplyNow() | ||
3466 | { | 4076 | { | ||
3467 | // Create the test client. | 4077 | // Create the test client. | ||
▲ Show 20 Lines • Show All 121 Lines • ▼ Show 20 Line(s) | 4142 | { | |||
3589 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4199 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3590 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4200 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3591 | QVERIFY(client); | 4201 | QVERIFY(client); | ||
3592 | 4202 | | |||
3593 | // The window shortcut should no longer be forced. | 4203 | // The window shortcut should no longer be forced. | ||
3594 | QVERIFY(client->shortcut().isEmpty()); | 4204 | QVERIFY(client->shortcut().isEmpty()); | ||
3595 | 4205 | | |||
3596 | // Destroy the client. | 4206 | // Destroy the client. | ||
3597 | delete shellSurface; | 4207 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3598 | delete surface; | 4208 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3599 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4209 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3600 | } | 4210 | } | ||
3601 | 4211 | | |||
3602 | TEST_DATA(testDesktopFileDontAffect) | 4212 | TEST_DATA(testDesktopFileDontAffect) | ||
3603 | 4213 | | |||
3604 | void TestShellClientRules::testDesktopFileDontAffect() | 4214 | void TestShellClientRules::testDesktopFileDontAffect() | ||
3605 | { | 4215 | { | ||
3606 | // Currently, the desktop file name is derived from the app id. If the app id is | 4216 | // Currently, the desktop file name is derived from the app id. If the app id is | ||
▲ Show 20 Lines • Show All 154 Lines • ▼ Show 20 Line(s) | 4343 | { | |||
3761 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4371 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3762 | QVERIFY(client); | 4372 | QVERIFY(client); | ||
3763 | QVERIFY(client->isActive()); | 4373 | QVERIFY(client->isActive()); | ||
3764 | 4374 | | |||
3765 | // The opacity is no longer forced. | 4375 | // The opacity is no longer forced. | ||
3766 | QCOMPARE(client->opacity(), 1.0); | 4376 | QCOMPARE(client->opacity(), 1.0); | ||
3767 | 4377 | | |||
3768 | // Destroy the client. | 4378 | // Destroy the client. | ||
3769 | delete shellSurface; | 4379 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3770 | delete surface; | 4380 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3771 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4381 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3772 | } | 4382 | } | ||
3773 | 4383 | | |||
3774 | TEST_DATA(testInactiveOpacityDontAffect) | 4384 | TEST_DATA(testInactiveOpacityDontAffect) | ||
3775 | 4385 | | |||
3776 | void TestShellClientRules::testInactiveOpacityDontAffect() | 4386 | void TestShellClientRules::testInactiveOpacityDontAffect() | ||
3777 | { | 4387 | { | ||
3778 | // Set the test rule. | 4388 | // Set the test rule. | ||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Line(s) | 4466 | { | |||
3895 | // Make the client inactive. | 4505 | // Make the client inactive. | ||
3896 | workspace()->setActiveClient(nullptr); | 4506 | workspace()->setActiveClient(nullptr); | ||
3897 | QVERIFY(!client->isActive()); | 4507 | QVERIFY(!client->isActive()); | ||
3898 | 4508 | | |||
3899 | // The opacity is no longer forced. | 4509 | // The opacity is no longer forced. | ||
3900 | QCOMPARE(client->opacity(), 1.0); | 4510 | QCOMPARE(client->opacity(), 1.0); | ||
3901 | 4511 | | |||
3902 | // Destroy the client. | 4512 | // Destroy the client. | ||
3903 | delete shellSurface; | 4513 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3904 | delete surface; | 4514 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3905 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4515 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3906 | } | 4516 | } | ||
3907 | 4517 | | |||
3908 | void TestShellClientRules::testMatchAfterNameChange() | 4518 | void TestShellClientRules::testMatchAfterNameChange() | ||
3909 | { | 4519 | { | ||
3910 | KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 4520 | KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3911 | config->group("General").writeEntry("count", 1); | 4521 | config->group("General").writeEntry("count", 1); | ||
3912 | 4522 | | |||
Show All 29 Lines |
Memory pointed to by 'shellSurface' is freed twice.