Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/shell_client_rules_test.cpp
Show All 13 Lines | |||||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | GNU General Public License for more details. | 16 | GNU General Public License for more details. | ||
17 | 17 | | |||
18 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License | ||
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
20 | *********************************************************************/ | 20 | *********************************************************************/ | ||
21 | #include "kwin_wayland_test.h" | 21 | #include "kwin_wayland_test.h" | ||
22 | | ||||
23 | #include "cursor.h" | ||||
22 | #include "platform.h" | 24 | #include "platform.h" | ||
23 | #include "rules.h" | 25 | #include "rules.h" | ||
24 | #include "screens.h" | 26 | #include "screens.h" | ||
25 | #include "shell_client.h" | 27 | #include "shell_client.h" | ||
26 | #include "virtualdesktops.h" | 28 | #include "virtualdesktops.h" | ||
27 | #include "wayland_server.h" | 29 | #include "wayland_server.h" | ||
28 | #include "workspace.h" | 30 | #include "workspace.h" | ||
29 | 31 | | |||
Show All 11 Lines | |||||
41 | class TestShellClientRules : public QObject | 43 | class TestShellClientRules : public QObject | ||
42 | { | 44 | { | ||
43 | Q_OBJECT | 45 | Q_OBJECT | ||
44 | private Q_SLOTS: | 46 | private Q_SLOTS: | ||
45 | void initTestCase(); | 47 | void initTestCase(); | ||
46 | void init(); | 48 | void init(); | ||
47 | void cleanup(); | 49 | void cleanup(); | ||
48 | 50 | | |||
51 | void testPositionDontAffect_data(); | ||||
52 | void testPositionDontAffect(); | ||||
53 | void testPositionApply_data(); | ||||
54 | void testPositionApply(); | ||||
55 | void testPositionRemember_data(); | ||||
56 | void testPositionRemember(); | ||||
57 | void testPositionForce_data(); | ||||
58 | void testPositionForce(); | ||||
59 | void testPositionApplyNow_data(); | ||||
60 | void testPositionApplyNow(); | ||||
61 | void testPositionForceTemporarily_data(); | ||||
62 | void testPositionForceTemporarily(); | ||||
63 | | ||||
64 | void testSizeDontAffect_data(); | ||||
65 | void testSizeDontAffect(); | ||||
66 | void testSizeApply_data(); | ||||
67 | void testSizeApply(); | ||||
68 | void testSizeRemember_data(); | ||||
69 | void testSizeRemember(); | ||||
70 | void testSizeForce_data(); | ||||
71 | void testSizeForce(); | ||||
72 | void testSizeApplyNow_data(); | ||||
73 | void testSizeApplyNow(); | ||||
74 | void testSizeForceTemporarily_data(); | ||||
75 | void testSizeForceTemporarily(); | ||||
76 | | ||||
49 | void testDesktopDontAffect_data(); | 77 | void testDesktopDontAffect_data(); | ||
50 | void testDesktopDontAffect(); | 78 | void testDesktopDontAffect(); | ||
51 | void testDesktopApply_data(); | 79 | void testDesktopApply_data(); | ||
52 | void testDesktopApply(); | 80 | void testDesktopApply(); | ||
53 | void testDesktopRemember_data(); | 81 | void testDesktopRemember_data(); | ||
54 | void testDesktopRemember(); | 82 | void testDesktopRemember(); | ||
55 | void testDesktopForce_data(); | 83 | void testDesktopForce_data(); | ||
56 | void testDesktopForce(); | 84 | void testDesktopForce(); | ||
▲ Show 20 Lines • Show All 188 Lines • ▼ Show 20 Line(s) | 261 | { | |||
245 | 273 | | |||
246 | // Draw content of the surface. | 274 | // Draw content of the surface. | ||
247 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | 275 | shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
248 | ShellClient *client = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue); | 276 | ShellClient *client = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue); | ||
249 | 277 | | |||
250 | return {client, surface, shellSurface}; | 278 | return {client, surface, shellSurface}; | ||
251 | } | 279 | } | ||
252 | 280 | | |||
281 | TEST_DATA(testPositionDontAffect) | ||||
282 | | ||||
283 | void TestShellClientRules::testPositionDontAffect() | ||||
284 | { | ||||
285 | // Initialize RuleBook with the test rule. | ||||
286 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
287 | config->group("General").writeEntry("count", 1); | ||||
288 | auto group = config->group("1"); | ||||
289 | group.writeEntry("position", QPoint(42, 42)); | ||||
290 | group.writeEntry("positionrule", int(Rules::DontAffect)); | ||||
291 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
292 | group.writeEntry("wmclasscomplete", false); | ||||
293 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||||
294 | group.sync(); | ||||
295 | RuleBook::self()->setConfig(config); | ||||
296 | workspace()->slotReconfigure(); | ||||
297 | | ||||
298 | // Create the test client. | ||||
299 | QFETCH(Test::ShellSurfaceType, type); | ||||
300 | ShellClient *client; | ||||
301 | Surface *surface; | ||||
302 | XdgShellSurface *shellSurface; | ||||
303 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
304 | QVERIFY(client); | ||||
305 | QVERIFY(client->isActive()); | ||||
306 | | ||||
307 | // The position of the client should not be affected by the rule. The default | ||||
308 | // placement policy will put the client in the top-left corner of the screen. | ||||
309 | QVERIFY(client->isMovable()); | ||||
310 | QVERIFY(client->isMovableAcrossScreens()); | ||||
311 | QCOMPARE(client->pos(), QPoint(0, 0)); | ||||
312 | | ||||
313 | // Destroy the client. | ||||
314 | delete shellSurface; | ||||
315 | delete surface; | ||||
316 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
317 | } | ||||
318 | | ||||
319 | TEST_DATA(testPositionApply) | ||||
320 | | ||||
321 | void TestShellClientRules::testPositionApply() | ||||
322 | { | ||||
323 | // Initialize RuleBook with the test rule. | ||||
324 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
325 | config->group("General").writeEntry("count", 1); | ||||
326 | auto group = config->group("1"); | ||||
327 | group.writeEntry("position", QPoint(42, 42)); | ||||
328 | group.writeEntry("positionrule", int(Rules::Apply)); | ||||
329 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
330 | group.writeEntry("wmclasscomplete", false); | ||||
331 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||||
332 | group.sync(); | ||||
333 | RuleBook::self()->setConfig(config); | ||||
334 | workspace()->slotReconfigure(); | ||||
335 | | ||||
336 | // Create the test client. | ||||
337 | QFETCH(Test::ShellSurfaceType, type); | ||||
338 | ShellClient *client; | ||||
339 | Surface *surface; | ||||
340 | XdgShellSurface *shellSurface; | ||||
341 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
342 | QVERIFY(client); | ||||
343 | QVERIFY(client->isActive()); | ||||
344 | | ||||
345 | // The client should be moved to the position specified by the rule. | ||||
346 | QVERIFY(client->isMovable()); | ||||
347 | QVERIFY(client->isMovableAcrossScreens()); | ||||
348 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||||
349 | | ||||
350 | // One should still be able to move the client around. | ||||
351 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||||
352 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||||
353 | QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized); | ||||
354 | QVERIFY(clientStepUserMovedResizedSpy.isValid()); | ||||
355 | QSignalSpy clientFinishUserMovedResizedSpy(client, &AbstractClient::clientFinishUserMovedResized); | ||||
356 | QVERIFY(clientFinishUserMovedResizedSpy.isValid()); | ||||
357 | | ||||
358 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
359 | QVERIFY(!client->isMove()); | ||||
360 | QVERIFY(!client->isResize()); | ||||
361 | workspace()->slotWindowMove(); | ||||
362 | QCOMPARE(workspace()->getMovingClient(), client); | ||||
363 | QCOMPARE(clientStartMoveResizedSpy.count(), 1); | ||||
364 | QVERIFY(client->isMove()); | ||||
365 | QVERIFY(!client->isResize()); | ||||
366 | | ||||
367 | const QPoint cursorPos = KWin::Cursor::pos(); | ||||
368 | client->keyPressEvent(Qt::Key_Right); | ||||
369 | client->updateMoveResize(KWin::Cursor::pos()); | ||||
370 | QCOMPARE(KWin::Cursor::pos(), cursorPos + QPoint(8, 0)); | ||||
371 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); | ||||
372 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||||
373 | | ||||
374 | client->keyPressEvent(Qt::Key_Enter); | ||||
375 | QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1); | ||||
376 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
377 | QVERIFY(!client->isMove()); | ||||
378 | QVERIFY(!client->isResize()); | ||||
379 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||||
380 | | ||||
381 | // The rule should be applied again if the client appears after it's been closed. | ||||
382 | delete shellSurface; | ||||
383 | delete surface; | ||||
384 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
385 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
386 | QVERIFY(client); | ||||
387 | QVERIFY(client->isActive()); | ||||
388 | QVERIFY(client->isMovable()); | ||||
389 | QVERIFY(client->isMovableAcrossScreens()); | ||||
390 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||||
391 | | ||||
392 | // Destroy the client. | ||||
393 | delete shellSurface; | ||||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
394 | delete surface; | ||||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
395 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
396 | } | ||||
397 | | ||||
398 | TEST_DATA(testPositionRemember) | ||||
399 | | ||||
400 | void TestShellClientRules::testPositionRemember() | ||||
401 | { | ||||
402 | // Initialize RuleBook with the test rule. | ||||
403 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
404 | config->group("General").writeEntry("count", 1); | ||||
405 | auto group = config->group("1"); | ||||
406 | group.writeEntry("position", QPoint(42, 42)); | ||||
407 | group.writeEntry("positionrule", int(Rules::Remember)); | ||||
408 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
409 | group.writeEntry("wmclasscomplete", false); | ||||
410 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||||
411 | group.sync(); | ||||
412 | RuleBook::self()->setConfig(config); | ||||
413 | workspace()->slotReconfigure(); | ||||
414 | | ||||
415 | // Create the test client. | ||||
416 | QFETCH(Test::ShellSurfaceType, type); | ||||
417 | ShellClient *client; | ||||
418 | Surface *surface; | ||||
419 | XdgShellSurface *shellSurface; | ||||
420 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
421 | QVERIFY(client); | ||||
422 | QVERIFY(client->isActive()); | ||||
423 | | ||||
424 | // The client should be moved to the position specified by the rule. | ||||
425 | QVERIFY(client->isMovable()); | ||||
426 | QVERIFY(client->isMovableAcrossScreens()); | ||||
427 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||||
428 | | ||||
429 | // One should still be able to move the client around. | ||||
430 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||||
431 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||||
432 | QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized); | ||||
433 | QVERIFY(clientStepUserMovedResizedSpy.isValid()); | ||||
434 | QSignalSpy clientFinishUserMovedResizedSpy(client, &AbstractClient::clientFinishUserMovedResized); | ||||
435 | QVERIFY(clientFinishUserMovedResizedSpy.isValid()); | ||||
436 | | ||||
437 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
438 | QVERIFY(!client->isMove()); | ||||
439 | QVERIFY(!client->isResize()); | ||||
440 | workspace()->slotWindowMove(); | ||||
441 | QCOMPARE(workspace()->getMovingClient(), client); | ||||
442 | QCOMPARE(clientStartMoveResizedSpy.count(), 1); | ||||
443 | QVERIFY(client->isMove()); | ||||
444 | QVERIFY(!client->isResize()); | ||||
445 | | ||||
446 | const QPoint cursorPos = KWin::Cursor::pos(); | ||||
447 | client->keyPressEvent(Qt::Key_Right); | ||||
448 | client->updateMoveResize(KWin::Cursor::pos()); | ||||
449 | QCOMPARE(KWin::Cursor::pos(), cursorPos + QPoint(8, 0)); | ||||
450 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); | ||||
451 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||||
452 | | ||||
453 | client->keyPressEvent(Qt::Key_Enter); | ||||
454 | QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1); | ||||
455 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
456 | QVERIFY(!client->isMove()); | ||||
457 | QVERIFY(!client->isResize()); | ||||
458 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||||
459 | | ||||
460 | // The client should be placed at the last know position if we reopen it. | ||||
461 | delete shellSurface; | ||||
462 | delete surface; | ||||
463 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
464 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
465 | QVERIFY(client); | ||||
466 | QVERIFY(client->isActive()); | ||||
467 | QVERIFY(client->isMovable()); | ||||
468 | QVERIFY(client->isMovableAcrossScreens()); | ||||
469 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||||
470 | | ||||
471 | // Destroy the client. | ||||
472 | delete shellSurface; | ||||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
473 | delete surface; | ||||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
474 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
475 | } | ||||
476 | | ||||
477 | TEST_DATA(testPositionForce) | ||||
478 | | ||||
479 | void TestShellClientRules::testPositionForce() | ||||
480 | { | ||||
481 | // Initialize RuleBook with the test rule. | ||||
482 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
483 | config->group("General").writeEntry("count", 1); | ||||
484 | auto group = config->group("1"); | ||||
485 | group.writeEntry("position", QPoint(42, 42)); | ||||
486 | group.writeEntry("positionrule", int(Rules::Force)); | ||||
487 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
488 | group.writeEntry("wmclasscomplete", false); | ||||
489 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||||
490 | group.sync(); | ||||
491 | RuleBook::self()->setConfig(config); | ||||
492 | workspace()->slotReconfigure(); | ||||
493 | | ||||
494 | // Create the test client. | ||||
495 | QFETCH(Test::ShellSurfaceType, type); | ||||
496 | ShellClient *client; | ||||
497 | Surface *surface; | ||||
498 | XdgShellSurface *shellSurface; | ||||
499 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
500 | QVERIFY(client); | ||||
501 | QVERIFY(client->isActive()); | ||||
502 | | ||||
503 | // The client should be moved to the position specified by the rule. | ||||
504 | QVERIFY(!client->isMovable()); | ||||
505 | QVERIFY(!client->isMovableAcrossScreens()); | ||||
506 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||||
507 | | ||||
508 | // User should not be able to move the client. | ||||
509 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||||
510 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||||
511 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
512 | QVERIFY(!client->isMove()); | ||||
513 | QVERIFY(!client->isResize()); | ||||
514 | workspace()->slotWindowMove(); | ||||
515 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
516 | QCOMPARE(clientStartMoveResizedSpy.count(), 0); | ||||
517 | QVERIFY(!client->isMove()); | ||||
518 | QVERIFY(!client->isResize()); | ||||
519 | | ||||
520 | // The position should still be forced if we reopen the client. | ||||
521 | delete shellSurface; | ||||
522 | delete surface; | ||||
523 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
524 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
525 | QVERIFY(client); | ||||
526 | QVERIFY(client->isActive()); | ||||
527 | QVERIFY(!client->isMovable()); | ||||
528 | QVERIFY(!client->isMovableAcrossScreens()); | ||||
529 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||||
530 | | ||||
531 | // Destroy the client. | ||||
532 | delete shellSurface; | ||||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
533 | delete surface; | ||||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
534 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
535 | } | ||||
536 | | ||||
537 | TEST_DATA(testPositionApplyNow) | ||||
538 | | ||||
539 | void TestShellClientRules::testPositionApplyNow() | ||||
540 | { | ||||
541 | // Create the test client. | ||||
542 | QFETCH(Test::ShellSurfaceType, type); | ||||
543 | ShellClient *client; | ||||
544 | Surface *surface; | ||||
545 | QObject *shellSurface; | ||||
546 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
547 | QVERIFY(client); | ||||
548 | QVERIFY(client->isActive()); | ||||
549 | | ||||
550 | // The position of the client isn't set by any rule, thus the default placement | ||||
551 | // policy will try to put the client in the top-left corner of the screen. | ||||
552 | QVERIFY(client->isMovable()); | ||||
553 | QVERIFY(client->isMovableAcrossScreens()); | ||||
554 | QCOMPARE(client->pos(), QPoint(0, 0)); | ||||
555 | | ||||
556 | // Initialize RuleBook with the test rule. | ||||
557 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
558 | config->group("General").writeEntry("count", 1); | ||||
559 | auto group = config->group("1"); | ||||
560 | group.writeEntry("position", QPoint(42, 42)); | ||||
561 | group.writeEntry("positionrule", int(Rules::ApplyNow)); | ||||
562 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
563 | group.writeEntry("wmclasscomplete", false); | ||||
564 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||||
565 | group.sync(); | ||||
566 | RuleBook::self()->setConfig(config); | ||||
567 | | ||||
568 | // The client should be moved to the position specified by the rule. | ||||
569 | QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); | ||||
570 | QVERIFY(geometryChangedSpy.isValid()); | ||||
571 | workspace()->slotReconfigure(); | ||||
572 | QCOMPARE(geometryChangedSpy.count(), 1); | ||||
573 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||||
574 | | ||||
575 | // We still have to be able to move the client around. | ||||
576 | QVERIFY(client->isMovable()); | ||||
577 | QVERIFY(client->isMovableAcrossScreens()); | ||||
578 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||||
579 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||||
580 | QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized); | ||||
581 | QVERIFY(clientStepUserMovedResizedSpy.isValid()); | ||||
582 | QSignalSpy clientFinishUserMovedResizedSpy(client, &AbstractClient::clientFinishUserMovedResized); | ||||
583 | QVERIFY(clientFinishUserMovedResizedSpy.isValid()); | ||||
584 | | ||||
585 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
586 | QVERIFY(!client->isMove()); | ||||
587 | QVERIFY(!client->isResize()); | ||||
588 | workspace()->slotWindowMove(); | ||||
589 | QCOMPARE(workspace()->getMovingClient(), client); | ||||
590 | QCOMPARE(clientStartMoveResizedSpy.count(), 1); | ||||
591 | QVERIFY(client->isMove()); | ||||
592 | QVERIFY(!client->isResize()); | ||||
593 | | ||||
594 | const QPoint cursorPos = KWin::Cursor::pos(); | ||||
595 | client->keyPressEvent(Qt::Key_Right); | ||||
596 | client->updateMoveResize(KWin::Cursor::pos()); | ||||
597 | QCOMPARE(KWin::Cursor::pos(), cursorPos + QPoint(8, 0)); | ||||
598 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); | ||||
599 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||||
600 | | ||||
601 | client->keyPressEvent(Qt::Key_Enter); | ||||
602 | QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1); | ||||
603 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
604 | QVERIFY(!client->isMove()); | ||||
605 | QVERIFY(!client->isResize()); | ||||
606 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||||
607 | | ||||
608 | // The rule should not be applied again. | ||||
609 | client->evaluateWindowRules(); | ||||
610 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||||
611 | | ||||
612 | // Destroy the client. | ||||
613 | delete shellSurface; | ||||
614 | delete surface; | ||||
615 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
616 | } | ||||
617 | | ||||
618 | TEST_DATA(testPositionForceTemporarily) | ||||
619 | | ||||
620 | void TestShellClientRules::testPositionForceTemporarily() | ||||
621 | { | ||||
622 | // Initialize RuleBook with the test rule. | ||||
623 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
624 | config->group("General").writeEntry("count", 1); | ||||
625 | auto group = config->group("1"); | ||||
626 | group.writeEntry("position", QPoint(42, 42)); | ||||
627 | group.writeEntry("positionrule", int(Rules::ForceTemporarily)); | ||||
628 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
629 | group.writeEntry("wmclasscomplete", false); | ||||
630 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||||
631 | group.sync(); | ||||
632 | RuleBook::self()->setConfig(config); | ||||
633 | workspace()->slotReconfigure(); | ||||
634 | | ||||
635 | // Create the test client. | ||||
636 | QFETCH(Test::ShellSurfaceType, type); | ||||
637 | ShellClient *client; | ||||
638 | Surface *surface; | ||||
639 | XdgShellSurface *shellSurface; | ||||
640 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
641 | QVERIFY(client); | ||||
642 | QVERIFY(client->isActive()); | ||||
643 | | ||||
644 | // The client should be moved to the position specified by the rule. | ||||
645 | QVERIFY(!client->isMovable()); | ||||
646 | QVERIFY(!client->isMovableAcrossScreens()); | ||||
647 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||||
648 | | ||||
649 | // User should not be able to move the client. | ||||
650 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||||
651 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||||
652 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
653 | QVERIFY(!client->isMove()); | ||||
654 | QVERIFY(!client->isResize()); | ||||
655 | workspace()->slotWindowMove(); | ||||
656 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
657 | QCOMPARE(clientStartMoveResizedSpy.count(), 0); | ||||
658 | QVERIFY(!client->isMove()); | ||||
659 | QVERIFY(!client->isResize()); | ||||
660 | | ||||
661 | // The rule should be discarded if we close the client. | ||||
662 | delete shellSurface; | ||||
663 | delete surface; | ||||
664 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
665 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
666 | QVERIFY(client); | ||||
667 | QVERIFY(client->isActive()); | ||||
668 | QVERIFY(client->isMovable()); | ||||
669 | QVERIFY(client->isMovableAcrossScreens()); | ||||
670 | QCOMPARE(client->pos(), QPoint(0, 0)); | ||||
671 | | ||||
672 | // Destroy the client. | ||||
673 | delete shellSurface; | ||||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
674 | delete surface; | ||||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
675 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
676 | } | ||||
677 | | ||||
678 | TEST_DATA(testSizeDontAffect) | ||||
679 | | ||||
680 | void TestShellClientRules::testSizeDontAffect() | ||||
681 | { | ||||
682 | // Initialize RuleBook with the test rule. | ||||
683 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
684 | config->group("General").writeEntry("count", 1); | ||||
685 | auto group = config->group("1"); | ||||
686 | group.writeEntry("size", QSize(480, 640)); | ||||
687 | group.writeEntry("sizerule", int(Rules::DontAffect)); | ||||
688 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
689 | group.writeEntry("wmclasscomplete", false); | ||||
690 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||||
691 | group.sync(); | ||||
692 | RuleBook::self()->setConfig(config); | ||||
693 | workspace()->slotReconfigure(); | ||||
694 | | ||||
695 | // Create the test client. | ||||
696 | QFETCH(Test::ShellSurfaceType, type); | ||||
697 | QScopedPointer<Surface> surface; | ||||
698 | surface.reset(Test::createSurface()); | ||||
699 | QScopedPointer<XdgShellSurface> shellSurface; | ||||
700 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
701 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||||
702 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
703 | shellSurface->setAppId("org.kde.foo"); | ||||
704 | surface->commit(Surface::CommitFlag::None); | ||||
705 | | ||||
706 | // The window size shouldn't be enforced by the rule. | ||||
707 | QVERIFY(configureRequestedSpy->wait()); | ||||
708 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
709 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(0, 0)); | ||||
710 | | ||||
711 | // Map the client. | ||||
712 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
713 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||||
714 | QVERIFY(client); | ||||
715 | QVERIFY(client->isActive()); | ||||
716 | QVERIFY(client->isResizable()); | ||||
717 | QCOMPARE(client->size(), QSize(100, 50)); | ||||
718 | | ||||
719 | // We should receive a configure event when the client becomes active. | ||||
720 | QVERIFY(configureRequestedSpy->wait()); | ||||
721 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
722 | | ||||
723 | // Destroy the client. | ||||
724 | shellSurface.reset(); | ||||
725 | surface.reset(); | ||||
726 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
727 | } | ||||
728 | | ||||
729 | TEST_DATA(testSizeApply) | ||||
730 | | ||||
731 | void TestShellClientRules::testSizeApply() | ||||
732 | { | ||||
733 | // Initialize RuleBook with the test rule. | ||||
734 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
735 | config->group("General").writeEntry("count", 1); | ||||
736 | auto group = config->group("1"); | ||||
737 | group.writeEntry("size", QSize(480, 640)); | ||||
738 | group.writeEntry("sizerule", int(Rules::Apply)); | ||||
739 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
740 | group.writeEntry("wmclasscomplete", false); | ||||
741 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||||
742 | group.sync(); | ||||
743 | RuleBook::self()->setConfig(config); | ||||
744 | workspace()->slotReconfigure(); | ||||
745 | | ||||
746 | // Create the test client. | ||||
747 | QFETCH(Test::ShellSurfaceType, type); | ||||
748 | QScopedPointer<Surface> surface; | ||||
749 | surface.reset(Test::createSurface()); | ||||
750 | QScopedPointer<XdgShellSurface> shellSurface; | ||||
751 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
752 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||||
753 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
754 | shellSurface->setAppId("org.kde.foo"); | ||||
755 | surface->commit(Surface::CommitFlag::None); | ||||
756 | | ||||
757 | // The initial configure event should contain size hint set by the rule. | ||||
758 | XdgShellSurface::States states; | ||||
759 | QVERIFY(configureRequestedSpy->wait()); | ||||
760 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
761 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(480, 640)); | ||||
762 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
763 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||||
764 | QVERIFY(!states.testFlag(XdgShellSurface::State::Resizing)); | ||||
765 | | ||||
766 | // Map the client. | ||||
767 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
768 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | ||||
769 | QVERIFY(client); | ||||
770 | QVERIFY(client->isActive()); | ||||
771 | QVERIFY(client->isResizable()); | ||||
772 | QCOMPARE(client->size(), QSize(480, 640)); | ||||
773 | | ||||
774 | // We should receive a configure event when the client becomes active. | ||||
775 | QVERIFY(configureRequestedSpy->wait()); | ||||
776 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
777 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
778 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
779 | QVERIFY(!states.testFlag(XdgShellSurface::State::Resizing)); | ||||
780 | | ||||
781 | // One still should be able to resize the client. | ||||
782 | QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); | ||||
783 | QVERIFY(geometryChangedSpy.isValid()); | ||||
784 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||||
785 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||||
786 | QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized); | ||||
787 | QVERIFY(clientStepUserMovedResizedSpy.isValid()); | ||||
788 | QSignalSpy clientFinishUserMovedResizedSpy(client, &AbstractClient::clientFinishUserMovedResized); | ||||
789 | QVERIFY(clientFinishUserMovedResizedSpy.isValid()); | ||||
790 | QSignalSpy surfaceSizeChangedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); | ||||
791 | QVERIFY(surfaceSizeChangedSpy.isValid()); | ||||
792 | | ||||
793 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
794 | QVERIFY(!client->isMove()); | ||||
795 | QVERIFY(!client->isResize()); | ||||
796 | workspace()->slotWindowResize(); | ||||
797 | QCOMPARE(workspace()->getMovingClient(), client); | ||||
798 | QCOMPARE(clientStartMoveResizedSpy.count(), 1); | ||||
799 | QVERIFY(!client->isMove()); | ||||
800 | QVERIFY(client->isResize()); | ||||
801 | QVERIFY(configureRequestedSpy->wait()); | ||||
802 | QCOMPARE(configureRequestedSpy->count(), 3); | ||||
803 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
804 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
805 | QVERIFY(states.testFlag(XdgShellSurface::State::Resizing)); | ||||
806 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
807 | | ||||
808 | const QPoint cursorPos = KWin::Cursor::pos(); | ||||
809 | client->keyPressEvent(Qt::Key_Right); | ||||
810 | client->updateMoveResize(KWin::Cursor::pos()); | ||||
811 | QCOMPARE(KWin::Cursor::pos(), cursorPos + QPoint(8, 0)); | ||||
812 | QVERIFY(configureRequestedSpy->wait()); | ||||
813 | QCOMPARE(configureRequestedSpy->count(), 4); | ||||
814 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
815 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
816 | QVERIFY(states.testFlag(XdgShellSurface::State::Resizing)); | ||||
817 | QCOMPARE(surfaceSizeChangedSpy.count(), 1); | ||||
818 | QCOMPARE(surfaceSizeChangedSpy.last().first().toSize(), QSize(488, 640)); | ||||
819 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 0); | ||||
820 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
821 | Test::render(surface.data(), QSize(488, 640), Qt::blue); | ||||
822 | QVERIFY(geometryChangedSpy.wait()); | ||||
823 | QCOMPARE(client->size(), QSize(488, 640)); | ||||
824 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); | ||||
825 | | ||||
826 | client->keyPressEvent(Qt::Key_Enter); | ||||
827 | QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1); | ||||
828 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
829 | QVERIFY(!client->isMove()); | ||||
830 | QVERIFY(!client->isResize()); | ||||
831 | | ||||
832 | QEXPECT_FAIL("", "Interactive resize is not spec-compliant", Continue); | ||||
833 | QVERIFY(configureRequestedSpy->wait(10)); | ||||
834 | QEXPECT_FAIL("", "Interactive resize is not spec-compliant", Continue); | ||||
835 | QCOMPARE(configureRequestedSpy->count(), 5); | ||||
836 | | ||||
837 | // The rule should be applied again if the client appears after it's been closed. | ||||
838 | shellSurface.reset(); | ||||
839 | surface.reset(); | ||||
840 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
841 | surface.reset(Test::createSurface()); | ||||
842 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
843 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
844 | shellSurface->setAppId("org.kde.foo"); | ||||
845 | surface->commit(Surface::CommitFlag::None); | ||||
846 | | ||||
847 | QVERIFY(configureRequestedSpy->wait()); | ||||
848 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
849 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); | ||||
850 | | ||||
851 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
852 | client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | ||||
853 | QVERIFY(client); | ||||
854 | QVERIFY(client->isActive()); | ||||
855 | QVERIFY(client->isResizable()); | ||||
856 | QCOMPARE(client->size(), QSize(480, 640)); | ||||
857 | | ||||
858 | QVERIFY(configureRequestedSpy->wait()); | ||||
859 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
860 | | ||||
861 | // Destroy the client. | ||||
862 | shellSurface.reset(); | ||||
863 | surface.reset(); | ||||
864 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
865 | } | ||||
866 | | ||||
867 | TEST_DATA(testSizeRemember) | ||||
868 | | ||||
869 | void TestShellClientRules::testSizeRemember() | ||||
870 | { | ||||
871 | // Initialize RuleBook with the test rule. | ||||
872 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
873 | config->group("General").writeEntry("count", 1); | ||||
874 | auto group = config->group("1"); | ||||
875 | group.writeEntry("size", QSize(480, 640)); | ||||
876 | group.writeEntry("sizerule", int(Rules::Remember)); | ||||
877 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
878 | group.writeEntry("wmclasscomplete", false); | ||||
879 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||||
880 | group.sync(); | ||||
881 | RuleBook::self()->setConfig(config); | ||||
882 | workspace()->slotReconfigure(); | ||||
883 | | ||||
884 | // Create the test client. | ||||
885 | QFETCH(Test::ShellSurfaceType, type); | ||||
886 | QScopedPointer<Surface> surface; | ||||
887 | surface.reset(Test::createSurface()); | ||||
888 | QScopedPointer<XdgShellSurface> shellSurface; | ||||
889 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
890 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||||
891 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
892 | shellSurface->setAppId("org.kde.foo"); | ||||
893 | surface->commit(Surface::CommitFlag::None); | ||||
894 | | ||||
895 | // The initial configure event should contain size hint set by the rule. | ||||
896 | XdgShellSurface::States states; | ||||
897 | QVERIFY(configureRequestedSpy->wait()); | ||||
898 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
899 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); | ||||
900 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
901 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||||
902 | QVERIFY(!states.testFlag(XdgShellSurface::State::Resizing)); | ||||
903 | | ||||
904 | // Map the client. | ||||
905 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
906 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | ||||
907 | QVERIFY(client); | ||||
908 | QVERIFY(client->isActive()); | ||||
909 | QVERIFY(client->isResizable()); | ||||
910 | QCOMPARE(client->size(), QSize(480, 640)); | ||||
911 | | ||||
912 | // We should receive a configure event when the client becomes active. | ||||
913 | QVERIFY(configureRequestedSpy->wait()); | ||||
914 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
915 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
916 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
917 | QVERIFY(!states.testFlag(XdgShellSurface::State::Resizing)); | ||||
918 | | ||||
919 | // One should still be able to resize the client. | ||||
920 | QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); | ||||
921 | QVERIFY(geometryChangedSpy.isValid()); | ||||
922 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||||
923 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||||
924 | QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized); | ||||
925 | QVERIFY(clientStepUserMovedResizedSpy.isValid()); | ||||
926 | QSignalSpy clientFinishUserMovedResizedSpy(client, &AbstractClient::clientFinishUserMovedResized); | ||||
927 | QVERIFY(clientFinishUserMovedResizedSpy.isValid()); | ||||
928 | QSignalSpy surfaceSizeChangedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); | ||||
929 | QVERIFY(surfaceSizeChangedSpy.isValid()); | ||||
930 | | ||||
931 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
932 | QVERIFY(!client->isMove()); | ||||
933 | QVERIFY(!client->isResize()); | ||||
934 | workspace()->slotWindowResize(); | ||||
935 | QCOMPARE(workspace()->getMovingClient(), client); | ||||
936 | QCOMPARE(clientStartMoveResizedSpy.count(), 1); | ||||
937 | QVERIFY(!client->isMove()); | ||||
938 | QVERIFY(client->isResize()); | ||||
939 | QVERIFY(configureRequestedSpy->wait()); | ||||
940 | QCOMPARE(configureRequestedSpy->count(), 3); | ||||
941 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
942 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
943 | QVERIFY(states.testFlag(XdgShellSurface::State::Resizing)); | ||||
944 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
945 | | ||||
946 | const QPoint cursorPos = KWin::Cursor::pos(); | ||||
947 | client->keyPressEvent(Qt::Key_Right); | ||||
948 | client->updateMoveResize(KWin::Cursor::pos()); | ||||
949 | QCOMPARE(KWin::Cursor::pos(), cursorPos + QPoint(8, 0)); | ||||
950 | QVERIFY(configureRequestedSpy->wait()); | ||||
951 | QCOMPARE(configureRequestedSpy->count(), 4); | ||||
952 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
953 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
954 | QVERIFY(states.testFlag(XdgShellSurface::State::Resizing)); | ||||
955 | QCOMPARE(surfaceSizeChangedSpy.count(), 1); | ||||
956 | QCOMPARE(surfaceSizeChangedSpy.last().first().toSize(), QSize(488, 640)); | ||||
957 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 0); | ||||
958 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
959 | Test::render(surface.data(), QSize(488, 640), Qt::blue); | ||||
960 | QVERIFY(geometryChangedSpy.wait()); | ||||
961 | QCOMPARE(client->size(), QSize(488, 640)); | ||||
962 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); | ||||
963 | | ||||
964 | client->keyPressEvent(Qt::Key_Enter); | ||||
965 | QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1); | ||||
966 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
967 | QVERIFY(!client->isMove()); | ||||
968 | QVERIFY(!client->isResize()); | ||||
969 | | ||||
970 | QEXPECT_FAIL("", "Interactive resize is not spec-compliant", Continue); | ||||
971 | QVERIFY(configureRequestedSpy->wait(10)); | ||||
972 | QEXPECT_FAIL("", "Interactive resize is not spec-compliant", Continue); | ||||
973 | QCOMPARE(configureRequestedSpy->count(), 5); | ||||
974 | | ||||
975 | // If the client appears again, it should have the last known size. | ||||
976 | shellSurface.reset(); | ||||
977 | surface.reset(); | ||||
978 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
979 | surface.reset(Test::createSurface()); | ||||
980 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
981 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
982 | shellSurface->setAppId("org.kde.foo"); | ||||
983 | surface->commit(Surface::CommitFlag::None); | ||||
984 | | ||||
985 | QVERIFY(configureRequestedSpy->wait()); | ||||
986 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
987 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(488, 640)); | ||||
988 | | ||||
989 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
990 | client = Test::renderAndWaitForShown(surface.data(), QSize(488, 640), Qt::blue); | ||||
991 | QVERIFY(client); | ||||
992 | QVERIFY(client->isActive()); | ||||
993 | QVERIFY(client->isResizable()); | ||||
994 | QCOMPARE(client->size(), QSize(488, 640)); | ||||
995 | | ||||
996 | QVERIFY(configureRequestedSpy->wait()); | ||||
997 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
998 | | ||||
999 | // Destroy the client. | ||||
1000 | shellSurface.reset(); | ||||
1001 | surface.reset(); | ||||
1002 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1003 | } | ||||
1004 | | ||||
1005 | TEST_DATA(testSizeForce) | ||||
1006 | | ||||
1007 | void TestShellClientRules::testSizeForce() | ||||
1008 | { | ||||
1009 | // Initialize RuleBook with the test rule. | ||||
1010 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
1011 | config->group("General").writeEntry("count", 1); | ||||
1012 | auto group = config->group("1"); | ||||
1013 | group.writeEntry("size", QSize(480, 640)); | ||||
1014 | group.writeEntry("sizerule", int(Rules::Force)); | ||||
1015 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
1016 | group.writeEntry("wmclasscomplete", false); | ||||
1017 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||||
1018 | group.sync(); | ||||
1019 | RuleBook::self()->setConfig(config); | ||||
1020 | workspace()->slotReconfigure(); | ||||
1021 | | ||||
1022 | // Create the test client. | ||||
1023 | QFETCH(Test::ShellSurfaceType, type); | ||||
1024 | QScopedPointer<Surface> surface; | ||||
1025 | surface.reset(Test::createSurface()); | ||||
1026 | QScopedPointer<XdgShellSurface> shellSurface; | ||||
1027 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1028 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||||
1029 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1030 | shellSurface->setAppId("org.kde.foo"); | ||||
1031 | surface->commit(Surface::CommitFlag::None); | ||||
1032 | | ||||
1033 | // The initial configure event should contain size hint set by the rule. | ||||
1034 | QVERIFY(configureRequestedSpy->wait()); | ||||
1035 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1036 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); | ||||
1037 | | ||||
1038 | // Map the client. | ||||
1039 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1040 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | ||||
1041 | QVERIFY(client); | ||||
1042 | QVERIFY(client->isActive()); | ||||
1043 | QVERIFY(!client->isResizable()); | ||||
1044 | QCOMPARE(client->size(), QSize(480, 640)); | ||||
1045 | | ||||
1046 | // We should receive a configure event when the client becomes active. | ||||
1047 | QVERIFY(configureRequestedSpy->wait()); | ||||
1048 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1049 | | ||||
1050 | // Any attempt to resize the client should not succeed. | ||||
1051 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||||
1052 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||||
1053 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
1054 | QVERIFY(!client->isMove()); | ||||
1055 | QVERIFY(!client->isResize()); | ||||
1056 | workspace()->slotWindowResize(); | ||||
1057 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
1058 | QCOMPARE(clientStartMoveResizedSpy.count(), 0); | ||||
1059 | QVERIFY(!client->isMove()); | ||||
1060 | QVERIFY(!client->isResize()); | ||||
1061 | QVERIFY(!configureRequestedSpy->wait(100)); | ||||
1062 | | ||||
1063 | // If the client appears again, the size should still be forced. | ||||
1064 | shellSurface.reset(); | ||||
1065 | surface.reset(); | ||||
1066 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1067 | surface.reset(Test::createSurface()); | ||||
1068 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1069 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1070 | shellSurface->setAppId("org.kde.foo"); | ||||
1071 | surface->commit(Surface::CommitFlag::None); | ||||
1072 | | ||||
1073 | QVERIFY(configureRequestedSpy->wait()); | ||||
1074 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1075 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); | ||||
1076 | | ||||
1077 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1078 | client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | ||||
1079 | QVERIFY(client); | ||||
1080 | QVERIFY(client->isActive()); | ||||
1081 | QVERIFY(!client->isResizable()); | ||||
1082 | QCOMPARE(client->size(), QSize(480, 640)); | ||||
1083 | | ||||
1084 | QVERIFY(configureRequestedSpy->wait()); | ||||
1085 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1086 | | ||||
1087 | // Destroy the client. | ||||
1088 | shellSurface.reset(); | ||||
1089 | surface.reset(); | ||||
1090 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1091 | } | ||||
1092 | | ||||
1093 | TEST_DATA(testSizeApplyNow) | ||||
1094 | | ||||
1095 | void TestShellClientRules::testSizeApplyNow() | ||||
1096 | { | ||||
1097 | // Create the test client. | ||||
1098 | QFETCH(Test::ShellSurfaceType, type); | ||||
1099 | QScopedPointer<Surface> surface; | ||||
1100 | surface.reset(Test::createSurface()); | ||||
1101 | QScopedPointer<XdgShellSurface> shellSurface; | ||||
1102 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1103 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||||
1104 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1105 | shellSurface->setAppId("org.kde.foo"); | ||||
1106 | surface->commit(Surface::CommitFlag::None); | ||||
1107 | | ||||
1108 | // The expected surface dimensions should be set by the rule. | ||||
1109 | QVERIFY(configureRequestedSpy->wait()); | ||||
1110 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1111 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(0, 0)); | ||||
1112 | | ||||
1113 | // Map the client. | ||||
1114 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1115 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||||
1116 | QVERIFY(client); | ||||
1117 | QVERIFY(client->isActive()); | ||||
1118 | QVERIFY(client->isResizable()); | ||||
1119 | QCOMPARE(client->size(), QSize(100, 50)); | ||||
1120 | | ||||
1121 | // We should receive a configure event when the client becomes active. | ||||
1122 | QVERIFY(configureRequestedSpy->wait()); | ||||
1123 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1124 | | ||||
1125 | // Initialize RuleBook with the test rule. | ||||
1126 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
1127 | config->group("General").writeEntry("count", 1); | ||||
1128 | auto group = config->group("1"); | ||||
1129 | group.writeEntry("size", QSize(480, 640)); | ||||
1130 | group.writeEntry("sizerule", int(Rules::ApplyNow)); | ||||
1131 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
1132 | group.writeEntry("wmclasscomplete", false); | ||||
1133 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||||
1134 | group.sync(); | ||||
1135 | RuleBook::self()->setConfig(config); | ||||
1136 | workspace()->slotReconfigure(); | ||||
1137 | | ||||
1138 | // The compositor should send a configure event with a new size. | ||||
1139 | QVERIFY(configureRequestedSpy->wait()); | ||||
1140 | QCOMPARE(configureRequestedSpy->count(), 3); | ||||
1141 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); | ||||
1142 | | ||||
1143 | // Draw the surface with the new size. | ||||
1144 | QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); | ||||
1145 | QVERIFY(geometryChangedSpy.isValid()); | ||||
1146 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1147 | Test::render(surface.data(), QSize(480, 640), Qt::blue); | ||||
1148 | QVERIFY(geometryChangedSpy.wait()); | ||||
1149 | QCOMPARE(client->size(), QSize(480, 640)); | ||||
1150 | QVERIFY(!configureRequestedSpy->wait(100)); | ||||
1151 | | ||||
1152 | // The rule should not be applied again. | ||||
1153 | client->evaluateWindowRules(); | ||||
1154 | QVERIFY(!configureRequestedSpy->wait(100)); | ||||
1155 | | ||||
1156 | // Destroy the client. | ||||
1157 | shellSurface.reset(); | ||||
1158 | surface.reset(); | ||||
1159 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1160 | } | ||||
1161 | | ||||
1162 | TEST_DATA(testSizeForceTemporarily) | ||||
1163 | | ||||
1164 | void TestShellClientRules::testSizeForceTemporarily() | ||||
1165 | { | ||||
1166 | // Initialize RuleBook with the test rule. | ||||
1167 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
1168 | config->group("General").writeEntry("count", 1); | ||||
1169 | auto group = config->group("1"); | ||||
1170 | group.writeEntry("size", QSize(480, 640)); | ||||
1171 | group.writeEntry("sizerule", int(Rules::ForceTemporarily)); | ||||
1172 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
1173 | group.writeEntry("wmclasscomplete", false); | ||||
1174 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||||
1175 | group.sync(); | ||||
1176 | RuleBook::self()->setConfig(config); | ||||
1177 | workspace()->slotReconfigure(); | ||||
1178 | | ||||
1179 | // Create the test client. | ||||
1180 | QFETCH(Test::ShellSurfaceType, type); | ||||
1181 | QScopedPointer<Surface> surface; | ||||
1182 | surface.reset(Test::createSurface()); | ||||
1183 | QScopedPointer<XdgShellSurface> shellSurface; | ||||
1184 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1185 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||||
1186 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1187 | shellSurface->setAppId("org.kde.foo"); | ||||
1188 | surface->commit(Surface::CommitFlag::None); | ||||
1189 | | ||||
1190 | // The initial configure event should contain size hint set by the rule. | ||||
1191 | QVERIFY(configureRequestedSpy->wait()); | ||||
1192 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1193 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); | ||||
1194 | | ||||
1195 | // Map the client. | ||||
1196 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1197 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | ||||
1198 | QVERIFY(client); | ||||
1199 | QVERIFY(client->isActive()); | ||||
1200 | QVERIFY(!client->isResizable()); | ||||
1201 | QCOMPARE(client->size(), QSize(480, 640)); | ||||
1202 | | ||||
1203 | // We should receive a configure event when the client becomes active. | ||||
1204 | QVERIFY(configureRequestedSpy->wait()); | ||||
1205 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1206 | | ||||
1207 | // Any attempt to resize the client should not succeed. | ||||
1208 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||||
1209 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||||
1210 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
1211 | QVERIFY(!client->isMove()); | ||||
1212 | QVERIFY(!client->isResize()); | ||||
1213 | workspace()->slotWindowResize(); | ||||
1214 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
1215 | QCOMPARE(clientStartMoveResizedSpy.count(), 0); | ||||
1216 | QVERIFY(!client->isMove()); | ||||
1217 | QVERIFY(!client->isResize()); | ||||
1218 | QVERIFY(!configureRequestedSpy->wait(100)); | ||||
1219 | | ||||
1220 | // The rule should be discarded when the client is closed. | ||||
1221 | shellSurface.reset(); | ||||
1222 | surface.reset(); | ||||
1223 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1224 | surface.reset(Test::createSurface()); | ||||
1225 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1226 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1227 | shellSurface->setAppId("org.kde.foo"); | ||||
1228 | surface->commit(Surface::CommitFlag::None); | ||||
1229 | | ||||
1230 | QVERIFY(configureRequestedSpy->wait()); | ||||
1231 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1232 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(0, 0)); | ||||
1233 | | ||||
1234 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1235 | client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||||
1236 | QVERIFY(client); | ||||
1237 | QVERIFY(client->isActive()); | ||||
1238 | QVERIFY(client->isResizable()); | ||||
1239 | QCOMPARE(client->size(), QSize(100, 50)); | ||||
1240 | | ||||
1241 | QVERIFY(configureRequestedSpy->wait()); | ||||
1242 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1243 | | ||||
1244 | // Destroy the client. | ||||
1245 | shellSurface.reset(); | ||||
1246 | surface.reset(); | ||||
1247 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1248 | } | ||||
1249 | | ||||
253 | TEST_DATA(testDesktopDontAffect) | 1250 | TEST_DATA(testDesktopDontAffect) | ||
254 | 1251 | | |||
255 | void TestShellClientRules::testDesktopDontAffect() | 1252 | void TestShellClientRules::testDesktopDontAffect() | ||
256 | { | 1253 | { | ||
257 | // Initialize RuleBook with the test rule. | 1254 | // Initialize RuleBook with the test rule. | ||
258 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 1255 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
259 | config->group("General").writeEntry("count", 1); | 1256 | config->group("General").writeEntry("count", 1); | ||
260 | auto group = config->group("1"); | 1257 | auto group = config->group("1"); | ||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 1294 | { | |||
338 | VirtualDesktopManager::self()->setCurrent(1); | 1335 | VirtualDesktopManager::self()->setCurrent(1); | ||
339 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1336 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
340 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1337 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
341 | QVERIFY(client); | 1338 | QVERIFY(client); | ||
342 | QCOMPARE(client->desktop(), 2); | 1339 | QCOMPARE(client->desktop(), 2); | ||
343 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | 1340 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | ||
344 | 1341 | | |||
345 | // Destroy the client. | 1342 | // Destroy the client. | ||
346 | delete shellSurface; | 1343 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
347 | delete surface; | 1344 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
348 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1345 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
349 | } | 1346 | } | ||
350 | 1347 | | |||
351 | TEST_DATA(testDesktopRemember) | 1348 | TEST_DATA(testDesktopRemember) | ||
352 | 1349 | | |||
353 | void TestShellClientRules::testDesktopRemember() | 1350 | void TestShellClientRules::testDesktopRemember() | ||
354 | { | 1351 | { | ||
355 | // Initialize RuleBook with the test rule. | 1352 | // Initialize RuleBook with the test rule. | ||
Show All 35 Lines | |||||
391 | delete surface; | 1388 | delete surface; | ||
392 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1389 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
393 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1390 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
394 | QVERIFY(client); | 1391 | QVERIFY(client); | ||
395 | QCOMPARE(client->desktop(), 1); | 1392 | QCOMPARE(client->desktop(), 1); | ||
396 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1393 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
397 | 1394 | | |||
398 | // Destroy the client. | 1395 | // Destroy the client. | ||
399 | delete shellSurface; | 1396 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
400 | delete surface; | 1397 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
401 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1398 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
402 | } | 1399 | } | ||
403 | 1400 | | |||
404 | TEST_DATA(testDesktopForce) | 1401 | TEST_DATA(testDesktopForce) | ||
405 | 1402 | | |||
406 | void TestShellClientRules::testDesktopForce() | 1403 | void TestShellClientRules::testDesktopForce() | ||
407 | { | 1404 | { | ||
408 | // Initialize RuleBook with the test rule. | 1405 | // Initialize RuleBook with the test rule. | ||
Show All 39 Lines | |||||
448 | VirtualDesktopManager::self()->setCurrent(1); | 1445 | VirtualDesktopManager::self()->setCurrent(1); | ||
449 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1446 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
450 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1447 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
451 | QVERIFY(client); | 1448 | QVERIFY(client); | ||
452 | QCOMPARE(client->desktop(), 2); | 1449 | QCOMPARE(client->desktop(), 2); | ||
453 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | 1450 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | ||
454 | 1451 | | |||
455 | // Destroy the client. | 1452 | // Destroy the client. | ||
456 | delete shellSurface; | 1453 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
457 | delete surface; | 1454 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
458 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1455 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
459 | } | 1456 | } | ||
460 | 1457 | | |||
461 | TEST_DATA(testDesktopApplyNow) | 1458 | TEST_DATA(testDesktopApplyNow) | ||
462 | 1459 | | |||
463 | void TestShellClientRules::testDesktopApplyNow() | 1460 | void TestShellClientRules::testDesktopApplyNow() | ||
464 | { | 1461 | { | ||
465 | // We need at least two virtual desktop for this test. | 1462 | // We need at least two virtual desktop for this test. | ||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | 1514 | { | |||
566 | workspace()->sendClientToDesktop(client, 2, true); | 1563 | workspace()->sendClientToDesktop(client, 2, true); | ||
567 | QCOMPARE(client->desktop(), 2); | 1564 | QCOMPARE(client->desktop(), 2); | ||
568 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1565 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
569 | workspace()->sendClientToDesktop(client, 1, true); | 1566 | workspace()->sendClientToDesktop(client, 1, true); | ||
570 | QCOMPARE(client->desktop(), 1); | 1567 | QCOMPARE(client->desktop(), 1); | ||
571 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1568 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
572 | 1569 | | |||
573 | // Destroy the client. | 1570 | // Destroy the client. | ||
574 | delete shellSurface; | 1571 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
575 | delete surface; | 1572 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
576 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1573 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
577 | } | 1574 | } | ||
578 | 1575 | | |||
579 | TEST_DATA(testMinimizeDontAffect) | 1576 | TEST_DATA(testMinimizeDontAffect) | ||
580 | 1577 | | |||
581 | void TestShellClientRules::testMinimizeDontAffect() | 1578 | void TestShellClientRules::testMinimizeDontAffect() | ||
582 | { | 1579 | { | ||
583 | // Initialize RuleBook with the test rule. | 1580 | // Initialize RuleBook with the test rule. | ||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 1614 | { | |||
649 | delete surface; | 1646 | delete surface; | ||
650 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1647 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
651 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1648 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
652 | QVERIFY(client); | 1649 | QVERIFY(client); | ||
653 | QVERIFY(client->isMinimizable()); | 1650 | QVERIFY(client->isMinimizable()); | ||
654 | QVERIFY(client->isMinimized()); | 1651 | QVERIFY(client->isMinimized()); | ||
655 | 1652 | | |||
656 | // Destroy the client. | 1653 | // Destroy the client. | ||
657 | delete shellSurface; | 1654 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
658 | delete surface; | 1655 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
659 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1656 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
660 | } | 1657 | } | ||
661 | 1658 | | |||
662 | TEST_DATA(testMinimizeRemember) | 1659 | TEST_DATA(testMinimizeRemember) | ||
663 | 1660 | | |||
664 | void TestShellClientRules::testMinimizeRemember() | 1661 | void TestShellClientRules::testMinimizeRemember() | ||
665 | { | 1662 | { | ||
666 | // Initialize RuleBook with the test rule. | 1663 | // Initialize RuleBook with the test rule. | ||
Show All 28 Lines | |||||
695 | delete surface; | 1692 | delete surface; | ||
696 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1693 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
697 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1694 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
698 | QVERIFY(client); | 1695 | QVERIFY(client); | ||
699 | QVERIFY(client->isMinimizable()); | 1696 | QVERIFY(client->isMinimizable()); | ||
700 | QVERIFY(client->isMinimized()); | 1697 | QVERIFY(client->isMinimized()); | ||
701 | 1698 | | |||
702 | // Destroy the client. | 1699 | // Destroy the client. | ||
703 | delete shellSurface; | 1700 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
704 | delete surface; | 1701 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
705 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1702 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
706 | } | 1703 | } | ||
707 | 1704 | | |||
708 | TEST_DATA(testMinimizeForce) | 1705 | TEST_DATA(testMinimizeForce) | ||
709 | 1706 | | |||
710 | void TestShellClientRules::testMinimizeForce() | 1707 | void TestShellClientRules::testMinimizeForce() | ||
711 | { | 1708 | { | ||
712 | // Initialize RuleBook with the test rule. | 1709 | // Initialize RuleBook with the test rule. | ||
Show All 30 Lines | |||||
743 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1740 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
744 | QVERIFY(client); | 1741 | QVERIFY(client); | ||
745 | QVERIFY(!client->isMinimizable()); | 1742 | QVERIFY(!client->isMinimizable()); | ||
746 | QVERIFY(!client->isMinimized()); | 1743 | QVERIFY(!client->isMinimized()); | ||
747 | client->minimize(); | 1744 | client->minimize(); | ||
748 | QVERIFY(!client->isMinimized()); | 1745 | QVERIFY(!client->isMinimized()); | ||
749 | 1746 | | |||
750 | // Destroy the client. | 1747 | // Destroy the client. | ||
751 | delete shellSurface; | 1748 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
752 | delete surface; | 1749 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
753 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1750 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
754 | } | 1751 | } | ||
755 | 1752 | | |||
756 | TEST_DATA(testMinimizeApplyNow) | 1753 | TEST_DATA(testMinimizeApplyNow) | ||
757 | 1754 | | |||
758 | void TestShellClientRules::testMinimizeApplyNow() | 1755 | void TestShellClientRules::testMinimizeApplyNow() | ||
759 | { | 1756 | { | ||
760 | // Create the test client. | 1757 | // Create the test client. | ||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Line(s) | 1802 | { | |||
837 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1834 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
838 | QVERIFY(client); | 1835 | QVERIFY(client); | ||
839 | QVERIFY(client->isMinimizable()); | 1836 | QVERIFY(client->isMinimizable()); | ||
840 | QVERIFY(!client->isMinimized()); | 1837 | QVERIFY(!client->isMinimized()); | ||
841 | client->minimize(); | 1838 | client->minimize(); | ||
842 | QVERIFY(client->isMinimized()); | 1839 | QVERIFY(client->isMinimized()); | ||
843 | 1840 | | |||
844 | // Destroy the client. | 1841 | // Destroy the client. | ||
845 | delete shellSurface; | 1842 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
846 | delete surface; | 1843 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
847 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1844 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
848 | } | 1845 | } | ||
849 | 1846 | | |||
850 | TEST_DATA(testSkipTaskbarDontAffect) | 1847 | TEST_DATA(testSkipTaskbarDontAffect) | ||
851 | 1848 | | |||
852 | void TestShellClientRules::testSkipTaskbarDontAffect() | 1849 | void TestShellClientRules::testSkipTaskbarDontAffect() | ||
853 | { | 1850 | { | ||
854 | // Initialize RuleBook with the test rule. | 1851 | // Initialize RuleBook with the test rule. | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 1884 | { | |||
917 | delete shellSurface; | 1914 | delete shellSurface; | ||
918 | delete surface; | 1915 | delete surface; | ||
919 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1916 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
920 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1917 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
921 | QVERIFY(client); | 1918 | QVERIFY(client); | ||
922 | QVERIFY(client->skipTaskbar()); | 1919 | QVERIFY(client->skipTaskbar()); | ||
923 | 1920 | | |||
924 | // Destroy the client. | 1921 | // Destroy the client. | ||
925 | delete shellSurface; | 1922 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
926 | delete surface; | 1923 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
927 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1924 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
928 | } | 1925 | } | ||
929 | 1926 | | |||
930 | TEST_DATA(testSkipTaskbarRemember) | 1927 | TEST_DATA(testSkipTaskbarRemember) | ||
931 | 1928 | | |||
932 | void TestShellClientRules::testSkipTaskbarRemember() | 1929 | void TestShellClientRules::testSkipTaskbarRemember() | ||
933 | { | 1930 | { | ||
934 | // Initialize RuleBook with the test rule. | 1931 | // Initialize RuleBook with the test rule. | ||
Show All 30 Lines | |||||
965 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1962 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
966 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1963 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
967 | QVERIFY(client); | 1964 | QVERIFY(client); | ||
968 | 1965 | | |||
969 | // The client should be included on a taskbar. | 1966 | // The client should be included on a taskbar. | ||
970 | QVERIFY(!client->skipTaskbar()); | 1967 | QVERIFY(!client->skipTaskbar()); | ||
971 | 1968 | | |||
972 | // Destroy the client. | 1969 | // Destroy the client. | ||
973 | delete shellSurface; | 1970 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
974 | delete surface; | 1971 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
975 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1972 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
976 | } | 1973 | } | ||
977 | 1974 | | |||
978 | TEST_DATA(testSkipTaskbarForce) | 1975 | TEST_DATA(testSkipTaskbarForce) | ||
979 | 1976 | | |||
980 | void TestShellClientRules::testSkipTaskbarForce() | 1977 | void TestShellClientRules::testSkipTaskbarForce() | ||
981 | { | 1978 | { | ||
982 | // Initialize RuleBook with the test rule. | 1979 | // Initialize RuleBook with the test rule. | ||
Show All 30 Lines | |||||
1013 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2010 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1014 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2011 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1015 | QVERIFY(client); | 2012 | QVERIFY(client); | ||
1016 | 2013 | | |||
1017 | // The skip-taskbar state should be still forced. | 2014 | // The skip-taskbar state should be still forced. | ||
1018 | QVERIFY(client->skipTaskbar()); | 2015 | QVERIFY(client->skipTaskbar()); | ||
1019 | 2016 | | |||
1020 | // Destroy the client. | 2017 | // Destroy the client. | ||
1021 | delete shellSurface; | 2018 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1022 | delete surface; | 2019 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1023 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2020 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1024 | } | 2021 | } | ||
1025 | 2022 | | |||
1026 | TEST_DATA(testSkipTaskbarApplyNow) | 2023 | TEST_DATA(testSkipTaskbarApplyNow) | ||
1027 | 2024 | | |||
1028 | void TestShellClientRules::testSkipTaskbarApplyNow() | 2025 | void TestShellClientRules::testSkipTaskbarApplyNow() | ||
1029 | { | 2026 | { | ||
1030 | // Create the test client. | 2027 | // Create the test client. | ||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | 2069 | { | |||
1106 | QVERIFY(client); | 2103 | QVERIFY(client); | ||
1107 | QVERIFY(!client->skipTaskbar()); | 2104 | QVERIFY(!client->skipTaskbar()); | ||
1108 | 2105 | | |||
1109 | // The skip-taskbar state is no longer forced. | 2106 | // The skip-taskbar state is no longer forced. | ||
1110 | client->setOriginalSkipTaskbar(true); | 2107 | client->setOriginalSkipTaskbar(true); | ||
1111 | QVERIFY(client->skipTaskbar()); | 2108 | QVERIFY(client->skipTaskbar()); | ||
1112 | 2109 | | |||
1113 | // Destroy the client. | 2110 | // Destroy the client. | ||
1114 | delete shellSurface; | 2111 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1115 | delete surface; | 2112 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1116 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2113 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1117 | } | 2114 | } | ||
1118 | 2115 | | |||
1119 | TEST_DATA(testSkipPagerDontAffect) | 2116 | TEST_DATA(testSkipPagerDontAffect) | ||
1120 | 2117 | | |||
1121 | void TestShellClientRules::testSkipPagerDontAffect() | 2118 | void TestShellClientRules::testSkipPagerDontAffect() | ||
1122 | { | 2119 | { | ||
1123 | // Initialize RuleBook with the test rule. | 2120 | // Initialize RuleBook with the test rule. | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 2153 | { | |||
1186 | delete shellSurface; | 2183 | delete shellSurface; | ||
1187 | delete surface; | 2184 | delete surface; | ||
1188 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2185 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1189 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2186 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1190 | QVERIFY(client); | 2187 | QVERIFY(client); | ||
1191 | QVERIFY(client->skipPager()); | 2188 | QVERIFY(client->skipPager()); | ||
1192 | 2189 | | |||
1193 | // Destroy the client. | 2190 | // Destroy the client. | ||
1194 | delete shellSurface; | 2191 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1195 | delete surface; | 2192 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1196 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2193 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1197 | } | 2194 | } | ||
1198 | 2195 | | |||
1199 | TEST_DATA(testSkipPagerRemember) | 2196 | TEST_DATA(testSkipPagerRemember) | ||
1200 | 2197 | | |||
1201 | void TestShellClientRules::testSkipPagerRemember() | 2198 | void TestShellClientRules::testSkipPagerRemember() | ||
1202 | { | 2199 | { | ||
1203 | // Initialize RuleBook with the test rule. | 2200 | // Initialize RuleBook with the test rule. | ||
Show All 30 Lines | |||||
1234 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2231 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1235 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2232 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1236 | QVERIFY(client); | 2233 | QVERIFY(client); | ||
1237 | 2234 | | |||
1238 | // The client should be included on a pager. | 2235 | // The client should be included on a pager. | ||
1239 | QVERIFY(!client->skipPager()); | 2236 | QVERIFY(!client->skipPager()); | ||
1240 | 2237 | | |||
1241 | // Destroy the client. | 2238 | // Destroy the client. | ||
1242 | delete shellSurface; | 2239 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1243 | delete surface; | 2240 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1244 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2241 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1245 | } | 2242 | } | ||
1246 | 2243 | | |||
1247 | TEST_DATA(testSkipPagerForce) | 2244 | TEST_DATA(testSkipPagerForce) | ||
1248 | 2245 | | |||
1249 | void TestShellClientRules::testSkipPagerForce() | 2246 | void TestShellClientRules::testSkipPagerForce() | ||
1250 | { | 2247 | { | ||
1251 | // Initialize RuleBook with the test rule. | 2248 | // Initialize RuleBook with the test rule. | ||
Show All 30 Lines | |||||
1282 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2279 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1283 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2280 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1284 | QVERIFY(client); | 2281 | QVERIFY(client); | ||
1285 | 2282 | | |||
1286 | // The skip-pager state should be still forced. | 2283 | // The skip-pager state should be still forced. | ||
1287 | QVERIFY(client->skipPager()); | 2284 | QVERIFY(client->skipPager()); | ||
1288 | 2285 | | |||
1289 | // Destroy the client. | 2286 | // Destroy the client. | ||
1290 | delete shellSurface; | 2287 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1291 | delete surface; | 2288 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1292 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2289 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1293 | } | 2290 | } | ||
1294 | 2291 | | |||
1295 | TEST_DATA(testSkipPagerApplyNow) | 2292 | TEST_DATA(testSkipPagerApplyNow) | ||
1296 | 2293 | | |||
1297 | void TestShellClientRules::testSkipPagerApplyNow() | 2294 | void TestShellClientRules::testSkipPagerApplyNow() | ||
1298 | { | 2295 | { | ||
1299 | // Create the test client. | 2296 | // Create the test client. | ||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | 2338 | { | |||
1375 | QVERIFY(client); | 2372 | QVERIFY(client); | ||
1376 | QVERIFY(!client->skipPager()); | 2373 | QVERIFY(!client->skipPager()); | ||
1377 | 2374 | | |||
1378 | // The skip-pager state is no longer forced. | 2375 | // The skip-pager state is no longer forced. | ||
1379 | client->setSkipPager(true); | 2376 | client->setSkipPager(true); | ||
1380 | QVERIFY(client->skipPager()); | 2377 | QVERIFY(client->skipPager()); | ||
1381 | 2378 | | |||
1382 | // Destroy the client. | 2379 | // Destroy the client. | ||
1383 | delete shellSurface; | 2380 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1384 | delete surface; | 2381 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1385 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2382 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1386 | } | 2383 | } | ||
1387 | 2384 | | |||
1388 | TEST_DATA(testSkipSwitcherDontAffect) | 2385 | TEST_DATA(testSkipSwitcherDontAffect) | ||
1389 | 2386 | | |||
1390 | void TestShellClientRules::testSkipSwitcherDontAffect() | 2387 | void TestShellClientRules::testSkipSwitcherDontAffect() | ||
1391 | { | 2388 | { | ||
1392 | // Initialize RuleBook with the test rule. | 2389 | // Initialize RuleBook with the test rule. | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 2422 | { | |||
1455 | delete shellSurface; | 2452 | delete shellSurface; | ||
1456 | delete surface; | 2453 | delete surface; | ||
1457 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2454 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1458 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2455 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1459 | QVERIFY(client); | 2456 | QVERIFY(client); | ||
1460 | QVERIFY(client->skipSwitcher()); | 2457 | QVERIFY(client->skipSwitcher()); | ||
1461 | 2458 | | |||
1462 | // Destroy the client. | 2459 | // Destroy the client. | ||
1463 | delete shellSurface; | 2460 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1464 | delete surface; | 2461 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1465 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2462 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1466 | } | 2463 | } | ||
1467 | 2464 | | |||
1468 | TEST_DATA(testSkipSwitcherRemember) | 2465 | TEST_DATA(testSkipSwitcherRemember) | ||
1469 | 2466 | | |||
1470 | void TestShellClientRules::testSkipSwitcherRemember() | 2467 | void TestShellClientRules::testSkipSwitcherRemember() | ||
1471 | { | 2468 | { | ||
1472 | // Initialize RuleBook with the test rule. | 2469 | // Initialize RuleBook with the test rule. | ||
Show All 30 Lines | |||||
1503 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2500 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1504 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2501 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1505 | QVERIFY(client); | 2502 | QVERIFY(client); | ||
1506 | 2503 | | |||
1507 | // The client should be included in window switching effects. | 2504 | // The client should be included in window switching effects. | ||
1508 | QVERIFY(!client->skipSwitcher()); | 2505 | QVERIFY(!client->skipSwitcher()); | ||
1509 | 2506 | | |||
1510 | // Destroy the client. | 2507 | // Destroy the client. | ||
1511 | delete shellSurface; | 2508 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1512 | delete surface; | 2509 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1513 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2510 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1514 | } | 2511 | } | ||
1515 | 2512 | | |||
1516 | TEST_DATA(testSkipSwitcherForce) | 2513 | TEST_DATA(testSkipSwitcherForce) | ||
1517 | 2514 | | |||
1518 | void TestShellClientRules::testSkipSwitcherForce() | 2515 | void TestShellClientRules::testSkipSwitcherForce() | ||
1519 | { | 2516 | { | ||
1520 | // Initialize RuleBook with the test rule. | 2517 | // Initialize RuleBook with the test rule. | ||
Show All 30 Lines | |||||
1551 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2548 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1552 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2549 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1553 | QVERIFY(client); | 2550 | QVERIFY(client); | ||
1554 | 2551 | | |||
1555 | // The skip-switcher state should be still forced. | 2552 | // The skip-switcher state should be still forced. | ||
1556 | QVERIFY(client->skipSwitcher()); | 2553 | QVERIFY(client->skipSwitcher()); | ||
1557 | 2554 | | |||
1558 | // Destroy the client. | 2555 | // Destroy the client. | ||
1559 | delete shellSurface; | 2556 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1560 | delete surface; | 2557 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1561 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2558 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1562 | } | 2559 | } | ||
1563 | 2560 | | |||
1564 | TEST_DATA(testSkipSwitcherApplyNow) | 2561 | TEST_DATA(testSkipSwitcherApplyNow) | ||
1565 | 2562 | | |||
1566 | void TestShellClientRules::testSkipSwitcherApplyNow() | 2563 | void TestShellClientRules::testSkipSwitcherApplyNow() | ||
1567 | { | 2564 | { | ||
1568 | // Create the test client. | 2565 | // Create the test client. | ||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | 2607 | { | |||
1644 | QVERIFY(client); | 2641 | QVERIFY(client); | ||
1645 | QVERIFY(!client->skipSwitcher()); | 2642 | QVERIFY(!client->skipSwitcher()); | ||
1646 | 2643 | | |||
1647 | // The skip-switcher state is no longer forced. | 2644 | // The skip-switcher state is no longer forced. | ||
1648 | client->setSkipSwitcher(true); | 2645 | client->setSkipSwitcher(true); | ||
1649 | QVERIFY(client->skipSwitcher()); | 2646 | QVERIFY(client->skipSwitcher()); | ||
1650 | 2647 | | |||
1651 | // Destroy the client. | 2648 | // Destroy the client. | ||
1652 | delete shellSurface; | 2649 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1653 | delete surface; | 2650 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1654 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2651 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1655 | } | 2652 | } | ||
1656 | 2653 | | |||
1657 | TEST_DATA(testKeepAboveDontAffect) | 2654 | TEST_DATA(testKeepAboveDontAffect) | ||
1658 | 2655 | | |||
1659 | void TestShellClientRules::testKeepAboveDontAffect() | 2656 | void TestShellClientRules::testKeepAboveDontAffect() | ||
1660 | { | 2657 | { | ||
1661 | // Initialize RuleBook with the test rule. | 2658 | // Initialize RuleBook with the test rule. | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 2691 | { | |||
1724 | delete shellSurface; | 2721 | delete shellSurface; | ||
1725 | delete surface; | 2722 | delete surface; | ||
1726 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2723 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1727 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2724 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1728 | QVERIFY(client); | 2725 | QVERIFY(client); | ||
1729 | QVERIFY(client->keepAbove()); | 2726 | QVERIFY(client->keepAbove()); | ||
1730 | 2727 | | |||
1731 | // Destroy the client. | 2728 | // Destroy the client. | ||
1732 | delete shellSurface; | 2729 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1733 | delete surface; | 2730 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1734 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2731 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1735 | } | 2732 | } | ||
1736 | 2733 | | |||
1737 | TEST_DATA(testKeepAboveRemember) | 2734 | TEST_DATA(testKeepAboveRemember) | ||
1738 | 2735 | | |||
1739 | void TestShellClientRules::testKeepAboveRemember() | 2736 | void TestShellClientRules::testKeepAboveRemember() | ||
1740 | { | 2737 | { | ||
1741 | // Initialize RuleBook with the test rule. | 2738 | // Initialize RuleBook with the test rule. | ||
Show All 28 Lines | |||||
1770 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2767 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1771 | 2768 | | |||
1772 | // Re-open the client, it should not be kept above. | 2769 | // Re-open the client, it should not be kept above. | ||
1773 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2770 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1774 | QVERIFY(client); | 2771 | QVERIFY(client); | ||
1775 | QVERIFY(!client->keepAbove()); | 2772 | QVERIFY(!client->keepAbove()); | ||
1776 | 2773 | | |||
1777 | // Destroy the client. | 2774 | // Destroy the client. | ||
1778 | delete shellSurface; | 2775 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1779 | delete surface; | 2776 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1780 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2777 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1781 | } | 2778 | } | ||
1782 | 2779 | | |||
1783 | TEST_DATA(testKeepAboveForce) | 2780 | TEST_DATA(testKeepAboveForce) | ||
1784 | 2781 | | |||
1785 | void TestShellClientRules::testKeepAboveForce() | 2782 | void TestShellClientRules::testKeepAboveForce() | ||
1786 | { | 2783 | { | ||
1787 | // Initialize RuleBook with the test rule. | 2784 | // Initialize RuleBook with the test rule. | ||
Show All 28 Lines | |||||
1816 | delete shellSurface; | 2813 | delete shellSurface; | ||
1817 | delete surface; | 2814 | delete surface; | ||
1818 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2815 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1819 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2816 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1820 | QVERIFY(client); | 2817 | QVERIFY(client); | ||
1821 | QVERIFY(client->keepAbove()); | 2818 | QVERIFY(client->keepAbove()); | ||
1822 | 2819 | | |||
1823 | // Destroy the client. | 2820 | // Destroy the client. | ||
1824 | delete shellSurface; | 2821 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1825 | delete surface; | 2822 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1826 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2823 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1827 | } | 2824 | } | ||
1828 | 2825 | | |||
1829 | TEST_DATA(testKeepAboveApplyNow) | 2826 | TEST_DATA(testKeepAboveApplyNow) | ||
1830 | 2827 | | |||
1831 | void TestShellClientRules::testKeepAboveApplyNow() | 2828 | void TestShellClientRules::testKeepAboveApplyNow() | ||
1832 | { | 2829 | { | ||
1833 | // Create the test client. | 2830 | // Create the test client. | ||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 2872 | { | |||
1911 | 2908 | | |||
1912 | // The keep-above state is no longer forced. | 2909 | // The keep-above state is no longer forced. | ||
1913 | client->setKeepAbove(true); | 2910 | client->setKeepAbove(true); | ||
1914 | QVERIFY(client->keepAbove()); | 2911 | QVERIFY(client->keepAbove()); | ||
1915 | client->setKeepAbove(false); | 2912 | client->setKeepAbove(false); | ||
1916 | QVERIFY(!client->keepAbove()); | 2913 | QVERIFY(!client->keepAbove()); | ||
1917 | 2914 | | |||
1918 | // Destroy the client. | 2915 | // Destroy the client. | ||
1919 | delete shellSurface; | 2916 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1920 | delete surface; | 2917 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1921 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2918 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1922 | } | 2919 | } | ||
1923 | 2920 | | |||
1924 | TEST_DATA(testKeepBelowDontAffect) | 2921 | TEST_DATA(testKeepBelowDontAffect) | ||
1925 | 2922 | | |||
1926 | void TestShellClientRules::testKeepBelowDontAffect() | 2923 | void TestShellClientRules::testKeepBelowDontAffect() | ||
1927 | { | 2924 | { | ||
1928 | // Initialize RuleBook with the test rule. | 2925 | // Initialize RuleBook with the test rule. | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 2958 | { | |||
1991 | delete shellSurface; | 2988 | delete shellSurface; | ||
1992 | delete surface; | 2989 | delete surface; | ||
1993 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2990 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1994 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2991 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1995 | QVERIFY(client); | 2992 | QVERIFY(client); | ||
1996 | QVERIFY(client->keepBelow()); | 2993 | QVERIFY(client->keepBelow()); | ||
1997 | 2994 | | |||
1998 | // Destroy the client. | 2995 | // Destroy the client. | ||
1999 | delete shellSurface; | 2996 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2000 | delete surface; | 2997 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2001 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2998 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2002 | } | 2999 | } | ||
2003 | 3000 | | |||
2004 | TEST_DATA(testKeepBelowRemember) | 3001 | TEST_DATA(testKeepBelowRemember) | ||
2005 | 3002 | | |||
2006 | void TestShellClientRules::testKeepBelowRemember() | 3003 | void TestShellClientRules::testKeepBelowRemember() | ||
2007 | { | 3004 | { | ||
2008 | // Initialize RuleBook with the test rule. | 3005 | // Initialize RuleBook with the test rule. | ||
Show All 28 Lines | |||||
2037 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3034 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2038 | 3035 | | |||
2039 | // Re-open the client, it should not be kept below. | 3036 | // Re-open the client, it should not be kept below. | ||
2040 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3037 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2041 | QVERIFY(client); | 3038 | QVERIFY(client); | ||
2042 | QVERIFY(!client->keepBelow()); | 3039 | QVERIFY(!client->keepBelow()); | ||
2043 | 3040 | | |||
2044 | // Destroy the client. | 3041 | // Destroy the client. | ||
2045 | delete shellSurface; | 3042 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2046 | delete surface; | 3043 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2047 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3044 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2048 | } | 3045 | } | ||
2049 | 3046 | | |||
2050 | TEST_DATA(testKeepBelowForce) | 3047 | TEST_DATA(testKeepBelowForce) | ||
2051 | 3048 | | |||
2052 | void TestShellClientRules::testKeepBelowForce() | 3049 | void TestShellClientRules::testKeepBelowForce() | ||
2053 | { | 3050 | { | ||
2054 | // Initialize RuleBook with the test rule. | 3051 | // Initialize RuleBook with the test rule. | ||
Show All 28 Lines | |||||
2083 | delete shellSurface; | 3080 | delete shellSurface; | ||
2084 | delete surface; | 3081 | delete surface; | ||
2085 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3082 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2086 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3083 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2087 | QVERIFY(client); | 3084 | QVERIFY(client); | ||
2088 | QVERIFY(client->keepBelow()); | 3085 | QVERIFY(client->keepBelow()); | ||
2089 | 3086 | | |||
2090 | // Destroy the client. | 3087 | // Destroy the client. | ||
2091 | delete shellSurface; | 3088 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2092 | delete surface; | 3089 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2093 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3090 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2094 | } | 3091 | } | ||
2095 | 3092 | | |||
2096 | TEST_DATA(testKeepBelowApplyNow) | 3093 | TEST_DATA(testKeepBelowApplyNow) | ||
2097 | 3094 | | |||
2098 | void TestShellClientRules::testKeepBelowApplyNow() | 3095 | void TestShellClientRules::testKeepBelowApplyNow() | ||
2099 | { | 3096 | { | ||
2100 | // Create the test client. | 3097 | // Create the test client. | ||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 3139 | { | |||
2178 | 3175 | | |||
2179 | // The keep-below state is no longer forced. | 3176 | // The keep-below state is no longer forced. | ||
2180 | client->setKeepBelow(true); | 3177 | client->setKeepBelow(true); | ||
2181 | QVERIFY(client->keepBelow()); | 3178 | QVERIFY(client->keepBelow()); | ||
2182 | client->setKeepBelow(false); | 3179 | client->setKeepBelow(false); | ||
2183 | QVERIFY(!client->keepBelow()); | 3180 | QVERIFY(!client->keepBelow()); | ||
2184 | 3181 | | |||
2185 | // Destroy the client. | 3182 | // Destroy the client. | ||
2186 | delete shellSurface; | 3183 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2187 | delete surface; | 3184 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2188 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3185 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2189 | } | 3186 | } | ||
2190 | 3187 | | |||
2191 | TEST_DATA(testShortcutDontAffect) | 3188 | TEST_DATA(testShortcutDontAffect) | ||
2192 | 3189 | | |||
2193 | void TestShellClientRules::testShortcutDontAffect() | 3190 | void TestShellClientRules::testShortcutDontAffect() | ||
2194 | { | 3191 | { | ||
2195 | // Initialize RuleBook with the test rule. | 3192 | // Initialize RuleBook with the test rule. | ||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Line(s) | 3238 | { | |||
2308 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3305 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2309 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3306 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2310 | QVERIFY(client); | 3307 | QVERIFY(client); | ||
2311 | 3308 | | |||
2312 | // The window shortcut should be set back to Ctrl+Alt+1. | 3309 | // The window shortcut should be set back to Ctrl+Alt+1. | ||
2313 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | 3310 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | ||
2314 | 3311 | | |||
2315 | // Destroy the client. | 3312 | // Destroy the client. | ||
2316 | delete shellSurface; | 3313 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2317 | delete surface; | 3314 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2318 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3315 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2319 | } | 3316 | } | ||
2320 | 3317 | | |||
2321 | TEST_DATA(testShortcutRemember) | 3318 | TEST_DATA(testShortcutRemember) | ||
2322 | 3319 | | |||
2323 | void TestShellClientRules::testShortcutRemember() | 3320 | void TestShellClientRules::testShortcutRemember() | ||
2324 | { | 3321 | { | ||
2325 | QSKIP("KWin core doesn't try to save the last used window shortcut"); | 3322 | QSKIP("KWin core doesn't try to save the last used window shortcut"); | ||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | |||||
2381 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3378 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2382 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3379 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2383 | QVERIFY(client); | 3380 | QVERIFY(client); | ||
2384 | 3381 | | |||
2385 | // The window shortcut should be set to the last known value. | 3382 | // The window shortcut should be set to the last known value. | ||
2386 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_2})); | 3383 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_2})); | ||
2387 | 3384 | | |||
2388 | // Destroy the client. | 3385 | // Destroy the client. | ||
2389 | delete shellSurface; | 3386 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2390 | delete surface; | 3387 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2391 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3388 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2392 | } | 3389 | } | ||
2393 | 3390 | | |||
2394 | TEST_DATA(testShortcutForce) | 3391 | TEST_DATA(testShortcutForce) | ||
2395 | 3392 | | |||
2396 | void TestShellClientRules::testShortcutForce() | 3393 | void TestShellClientRules::testShortcutForce() | ||
2397 | { | 3394 | { | ||
2398 | QSKIP("KWin core can't release forced window shortcuts"); | 3395 | QSKIP("KWin core can't release forced window shortcuts"); | ||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | |||||
2454 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3451 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2455 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3452 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2456 | QVERIFY(client); | 3453 | QVERIFY(client); | ||
2457 | 3454 | | |||
2458 | // The window shortcut should still be forced. | 3455 | // The window shortcut should still be forced. | ||
2459 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | 3456 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | ||
2460 | 3457 | | |||
2461 | // Destroy the client. | 3458 | // Destroy the client. | ||
2462 | delete shellSurface; | 3459 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2463 | delete surface; | 3460 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2464 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3461 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2465 | } | 3462 | } | ||
2466 | 3463 | | |||
2467 | TEST_DATA(testShortcutApplyNow) | 3464 | TEST_DATA(testShortcutApplyNow) | ||
2468 | 3465 | | |||
2469 | void TestShellClientRules::testShortcutApplyNow() | 3466 | void TestShellClientRules::testShortcutApplyNow() | ||
2470 | { | 3467 | { | ||
2471 | // Create the test client. | 3468 | // Create the test client. | ||
▲ Show 20 Lines • Show All 119 Lines • ▼ Show 20 Line(s) | 3533 | { | |||
2591 | delete shellSurface; | 3588 | delete shellSurface; | ||
2592 | delete surface; | 3589 | delete surface; | ||
2593 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3590 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2594 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3591 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2595 | QVERIFY(client); | 3592 | QVERIFY(client); | ||
2596 | QVERIFY(client->shortcut().isEmpty()); | 3593 | QVERIFY(client->shortcut().isEmpty()); | ||
2597 | 3594 | | |||
2598 | // Destroy the client. | 3595 | // Destroy the client. | ||
2599 | delete shellSurface; | 3596 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2600 | delete surface; | 3597 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2601 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3598 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2602 | } | 3599 | } | ||
2603 | 3600 | | |||
2604 | TEST_DATA(testDesktopFileDontAffect) | 3601 | TEST_DATA(testDesktopFileDontAffect) | ||
2605 | 3602 | | |||
2606 | void TestShellClientRules::testDesktopFileDontAffect() | 3603 | void TestShellClientRules::testDesktopFileDontAffect() | ||
2607 | { | 3604 | { | ||
2608 | // Currently, the desktop file name is derived from the app id. If the app id is | 3605 | // Currently, the desktop file name is derived from the app id. If the app id is | ||
▲ Show 20 Lines • Show All 152 Lines • ▼ Show 20 Line(s) | 3732 | { | |||
2761 | delete surface; | 3758 | delete surface; | ||
2762 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3759 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2763 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3760 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2764 | QVERIFY(client); | 3761 | QVERIFY(client); | ||
2765 | QVERIFY(client->isActive()); | 3762 | QVERIFY(client->isActive()); | ||
2766 | QCOMPARE(client->opacity(), 1.0); | 3763 | QCOMPARE(client->opacity(), 1.0); | ||
2767 | 3764 | | |||
2768 | // Destroy the client. | 3765 | // Destroy the client. | ||
2769 | delete shellSurface; | 3766 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2770 | delete surface; | 3767 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2771 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3768 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2772 | } | 3769 | } | ||
2773 | 3770 | | |||
2774 | TEST_DATA(testInactiveOpacityDontAffect) | 3771 | TEST_DATA(testInactiveOpacityDontAffect) | ||
2775 | 3772 | | |||
2776 | void TestShellClientRules::testInactiveOpacityDontAffect() | 3773 | void TestShellClientRules::testInactiveOpacityDontAffect() | ||
2777 | { | 3774 | { | ||
2778 | // Initialize RuleBook with the test rule. | 3775 | // Initialize RuleBook with the test rule. | ||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Line(s) | 3853 | { | |||
2891 | QVERIFY(client); | 3888 | QVERIFY(client); | ||
2892 | QVERIFY(client->isActive()); | 3889 | QVERIFY(client->isActive()); | ||
2893 | QCOMPARE(client->opacity(), 1.0); | 3890 | QCOMPARE(client->opacity(), 1.0); | ||
2894 | workspace()->setActiveClient(nullptr); | 3891 | workspace()->setActiveClient(nullptr); | ||
2895 | QVERIFY(!client->isActive()); | 3892 | QVERIFY(!client->isActive()); | ||
2896 | QCOMPARE(client->opacity(), 1.0); | 3893 | QCOMPARE(client->opacity(), 1.0); | ||
2897 | 3894 | | |||
2898 | // Destroy the client. | 3895 | // Destroy the client. | ||
2899 | delete shellSurface; | 3896 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2900 | delete surface; | 3897 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2901 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3898 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2902 | } | 3899 | } | ||
2903 | 3900 | | |||
2904 | void TestShellClientRules::testMatchAfterNameChange() | 3901 | void TestShellClientRules::testMatchAfterNameChange() | ||
2905 | { | 3902 | { | ||
2906 | KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3903 | KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2907 | config->group("General").writeEntry("count", 1); | 3904 | config->group("General").writeEntry("count", 1); | ||
2908 | 3905 | | |||
Show All 29 Lines |
Memory pointed to by 'shellSurface' is freed twice.