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 | // Set 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", 1); | ||||
291 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
292 | group.writeEntry("wmclasscomplete", false); | ||||
293 | group.writeEntry("wmclassmatch", 1); | ||||
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->isMovableAcrossScreens()); | ||||
310 | QCOMPARE(client->pos(), QPoint(0, 0)); | ||||
311 | | ||||
312 | // Destroy the client. | ||||
313 | delete shellSurface; | ||||
314 | delete surface; | ||||
315 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
316 | } | ||||
317 | | ||||
318 | TEST_DATA(testPositionApply) | ||||
319 | | ||||
320 | void TestShellClientRules::testPositionApply() | ||||
321 | { | ||||
322 | // Set the test rule. | ||||
323 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
324 | config->group("General").writeEntry("count", 1); | ||||
325 | auto group = config->group("1"); | ||||
326 | group.writeEntry("position", QPoint(42, 42)); | ||||
327 | group.writeEntry("positionrule", 3); | ||||
328 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
329 | group.writeEntry("wmclasscomplete", false); | ||||
330 | group.writeEntry("wmclassmatch", 1); | ||||
331 | group.sync(); | ||||
332 | RuleBook::self()->setConfig(config); | ||||
333 | workspace()->slotReconfigure(); | ||||
334 | | ||||
335 | // Create the test client. | ||||
336 | QFETCH(Test::ShellSurfaceType, type); | ||||
337 | ShellClient *client; | ||||
338 | Surface *surface; | ||||
339 | XdgShellSurface *shellSurface; | ||||
340 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
341 | QVERIFY(client); | ||||
342 | QVERIFY(client->isActive()); | ||||
343 | | ||||
344 | // The client should be moved to the position specified by the rule. | ||||
345 | QVERIFY(client->isMovableAcrossScreens()); | ||||
346 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||||
347 | | ||||
348 | // One should still be able to move the client. | ||||
349 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||||
350 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||||
351 | QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized); | ||||
352 | QVERIFY(clientStepUserMovedResizedSpy.isValid()); | ||||
353 | QSignalSpy clientFinishUserMovedResizedSpy(client, &AbstractClient::clientFinishUserMovedResized); | ||||
354 | QVERIFY(clientFinishUserMovedResizedSpy.isValid()); | ||||
355 | | ||||
356 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
357 | QVERIFY(!client->isMove()); | ||||
358 | QVERIFY(!client->isResize()); | ||||
359 | workspace()->slotWindowMove(); | ||||
360 | QCOMPARE(workspace()->getMovingClient(), client); | ||||
361 | QCOMPARE(clientStartMoveResizedSpy.count(), 1); | ||||
362 | QVERIFY(client->isMove()); | ||||
363 | QVERIFY(!client->isResize()); | ||||
364 | | ||||
365 | const QPoint cursorPos = KWin::Cursor::pos(); | ||||
366 | client->keyPressEvent(Qt::Key_Right); | ||||
367 | client->updateMoveResize(KWin::Cursor::pos()); | ||||
368 | QCOMPARE(KWin::Cursor::pos(), cursorPos + QPoint(8, 0)); | ||||
369 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); | ||||
370 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||||
371 | | ||||
372 | client->keyPressEvent(Qt::Key_Enter); | ||||
373 | QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1); | ||||
374 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
375 | QVERIFY(!client->isMove()); | ||||
376 | QVERIFY(!client->isResize()); | ||||
377 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||||
378 | | ||||
379 | // The rule should be applied again if the client appears after it's been closed. | ||||
380 | delete shellSurface; | ||||
381 | delete surface; | ||||
382 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
383 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
384 | QVERIFY(client); | ||||
385 | QVERIFY(client->isActive()); | ||||
386 | QVERIFY(client->isMovableAcrossScreens()); | ||||
387 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||||
388 | | ||||
389 | // Destroy the client. | ||||
390 | delete shellSurface; | ||||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
391 | delete surface; | ||||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
392 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
393 | } | ||||
394 | | ||||
395 | TEST_DATA(testPositionRemember) | ||||
396 | | ||||
397 | void TestShellClientRules::testPositionRemember() | ||||
398 | { | ||||
399 | // Set the test rule. | ||||
400 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
401 | config->group("General").writeEntry("count", 1); | ||||
402 | auto group = config->group("1"); | ||||
403 | group.writeEntry("position", QPoint(42, 42)); | ||||
404 | group.writeEntry("positionrule", 4); | ||||
405 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
406 | group.writeEntry("wmclasscomplete", false); | ||||
407 | group.writeEntry("wmclassmatch", 1); | ||||
408 | group.sync(); | ||||
409 | RuleBook::self()->setConfig(config); | ||||
410 | workspace()->slotReconfigure(); | ||||
411 | | ||||
412 | // Create the test client. | ||||
413 | QFETCH(Test::ShellSurfaceType, type); | ||||
414 | ShellClient *client; | ||||
415 | Surface *surface; | ||||
416 | XdgShellSurface *shellSurface; | ||||
417 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
418 | QVERIFY(client); | ||||
419 | QVERIFY(client->isActive()); | ||||
420 | | ||||
421 | // The client should be moved to the position specified by the rule. | ||||
422 | QVERIFY(client->isMovableAcrossScreens()); | ||||
423 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||||
424 | | ||||
425 | // One should still be able to move the client. | ||||
426 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||||
427 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||||
428 | QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized); | ||||
429 | QVERIFY(clientStepUserMovedResizedSpy.isValid()); | ||||
430 | QSignalSpy clientFinishUserMovedResizedSpy(client, &AbstractClient::clientFinishUserMovedResized); | ||||
431 | QVERIFY(clientFinishUserMovedResizedSpy.isValid()); | ||||
432 | | ||||
433 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
434 | QVERIFY(!client->isMove()); | ||||
435 | QVERIFY(!client->isResize()); | ||||
436 | workspace()->slotWindowMove(); | ||||
437 | QCOMPARE(workspace()->getMovingClient(), client); | ||||
438 | QCOMPARE(clientStartMoveResizedSpy.count(), 1); | ||||
439 | QVERIFY(client->isMove()); | ||||
440 | QVERIFY(!client->isResize()); | ||||
441 | | ||||
442 | const QPoint cursorPos = KWin::Cursor::pos(); | ||||
443 | client->keyPressEvent(Qt::Key_Right); | ||||
444 | client->updateMoveResize(KWin::Cursor::pos()); | ||||
445 | QCOMPARE(KWin::Cursor::pos(), cursorPos + QPoint(8, 0)); | ||||
446 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); | ||||
447 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||||
448 | | ||||
449 | client->keyPressEvent(Qt::Key_Enter); | ||||
450 | QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1); | ||||
451 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
452 | QVERIFY(!client->isMove()); | ||||
453 | QVERIFY(!client->isResize()); | ||||
454 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||||
455 | | ||||
456 | // The client should be placed at the last know position if we reopen it. | ||||
457 | delete shellSurface; | ||||
458 | delete surface; | ||||
459 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
460 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
461 | QVERIFY(client); | ||||
462 | QVERIFY(client->isActive()); | ||||
463 | QVERIFY(client->isMovableAcrossScreens()); | ||||
464 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||||
465 | | ||||
466 | // Destroy the client. | ||||
467 | delete shellSurface; | ||||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
468 | delete surface; | ||||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
469 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
470 | } | ||||
471 | | ||||
472 | TEST_DATA(testPositionForce) | ||||
473 | | ||||
474 | void TestShellClientRules::testPositionForce() | ||||
475 | { | ||||
476 | // Set the test rule. | ||||
477 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
478 | config->group("General").writeEntry("count", 1); | ||||
479 | auto group = config->group("1"); | ||||
480 | group.writeEntry("position", QPoint(42, 42)); | ||||
481 | group.writeEntry("positionrule", 2); | ||||
482 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
483 | group.writeEntry("wmclasscomplete", false); | ||||
484 | group.writeEntry("wmclassmatch", 1); | ||||
485 | group.sync(); | ||||
486 | RuleBook::self()->setConfig(config); | ||||
487 | workspace()->slotReconfigure(); | ||||
488 | | ||||
489 | // Create the test client. | ||||
490 | QFETCH(Test::ShellSurfaceType, type); | ||||
491 | ShellClient *client; | ||||
492 | Surface *surface; | ||||
493 | XdgShellSurface *shellSurface; | ||||
494 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
495 | QVERIFY(client); | ||||
496 | QVERIFY(client->isActive()); | ||||
497 | | ||||
498 | // The client should be moved to the position specified by the rule. | ||||
499 | QVERIFY(!client->isMovableAcrossScreens()); | ||||
500 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||||
501 | | ||||
502 | // Any attempt to move the client should not succeed. | ||||
503 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||||
504 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||||
505 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
506 | QVERIFY(!client->isMove()); | ||||
507 | QVERIFY(!client->isResize()); | ||||
508 | workspace()->slotWindowMove(); | ||||
509 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
510 | QCOMPARE(clientStartMoveResizedSpy.count(), 0); | ||||
511 | QVERIFY(!client->isMove()); | ||||
512 | QVERIFY(!client->isResize()); | ||||
513 | | ||||
514 | // The position should still be forced if we reopen the client. | ||||
515 | delete shellSurface; | ||||
516 | delete surface; | ||||
517 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
518 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
519 | QVERIFY(client); | ||||
520 | QVERIFY(client->isActive()); | ||||
521 | QVERIFY(!client->isMovableAcrossScreens()); | ||||
522 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||||
523 | | ||||
524 | // Destroy the client. | ||||
525 | delete shellSurface; | ||||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
526 | delete surface; | ||||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
527 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
528 | } | ||||
529 | | ||||
530 | TEST_DATA(testPositionApplyNow) | ||||
531 | | ||||
532 | void TestShellClientRules::testPositionApplyNow() | ||||
533 | { | ||||
534 | // Create the test client. | ||||
535 | QFETCH(Test::ShellSurfaceType, type); | ||||
536 | ShellClient *client; | ||||
537 | Surface *surface; | ||||
538 | QObject *shellSurface; | ||||
539 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
540 | QVERIFY(client); | ||||
541 | QVERIFY(client->isActive()); | ||||
542 | | ||||
543 | // The position of the client isn't set by any rule, thus the default placement | ||||
544 | // policy will try to put the client in the top-left corner of the screen. | ||||
545 | QVERIFY(client->isMovableAcrossScreens()); | ||||
546 | QCOMPARE(client->pos(), QPoint(0, 0)); | ||||
547 | | ||||
548 | // Set the test rule. | ||||
549 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
550 | config->group("General").writeEntry("count", 1); | ||||
551 | auto group = config->group("1"); | ||||
552 | group.writeEntry("position", QPoint(42, 42)); | ||||
553 | group.writeEntry("positionrule", 5); | ||||
554 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
555 | group.writeEntry("wmclasscomplete", false); | ||||
556 | group.writeEntry("wmclassmatch", 1); | ||||
557 | group.sync(); | ||||
558 | RuleBook::self()->setConfig(config); | ||||
559 | | ||||
560 | // The client should be moved to the position specified by the rule. | ||||
561 | QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); | ||||
562 | QVERIFY(geometryChangedSpy.isValid()); | ||||
563 | workspace()->slotReconfigure(); | ||||
564 | QCOMPARE(geometryChangedSpy.count(), 1); | ||||
565 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||||
566 | | ||||
567 | // We still have to be able to move the client around. | ||||
568 | QVERIFY(client->isMovableAcrossScreens()); | ||||
569 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||||
570 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||||
571 | QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized); | ||||
572 | QVERIFY(clientStepUserMovedResizedSpy.isValid()); | ||||
573 | QSignalSpy clientFinishUserMovedResizedSpy(client, &AbstractClient::clientFinishUserMovedResized); | ||||
574 | QVERIFY(clientFinishUserMovedResizedSpy.isValid()); | ||||
575 | | ||||
576 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
577 | QVERIFY(!client->isMove()); | ||||
578 | QVERIFY(!client->isResize()); | ||||
579 | workspace()->slotWindowMove(); | ||||
580 | QCOMPARE(workspace()->getMovingClient(), client); | ||||
581 | QCOMPARE(clientStartMoveResizedSpy.count(), 1); | ||||
582 | QVERIFY(client->isMove()); | ||||
583 | QVERIFY(!client->isResize()); | ||||
584 | | ||||
585 | const QPoint cursorPos = KWin::Cursor::pos(); | ||||
586 | client->keyPressEvent(Qt::Key_Right); | ||||
587 | client->updateMoveResize(KWin::Cursor::pos()); | ||||
588 | QCOMPARE(KWin::Cursor::pos(), cursorPos + QPoint(8, 0)); | ||||
589 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); | ||||
590 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||||
591 | | ||||
592 | client->keyPressEvent(Qt::Key_Enter); | ||||
593 | QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1); | ||||
594 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
595 | QVERIFY(!client->isMove()); | ||||
596 | QVERIFY(!client->isResize()); | ||||
597 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||||
598 | | ||||
599 | // The rule should not be applied again. | ||||
600 | client->evaluateWindowRules(); | ||||
601 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||||
602 | | ||||
603 | // Destroy the client. | ||||
604 | delete shellSurface; | ||||
605 | delete surface; | ||||
606 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
607 | } | ||||
608 | | ||||
609 | TEST_DATA(testPositionForceTemporarily) | ||||
610 | | ||||
611 | void TestShellClientRules::testPositionForceTemporarily() | ||||
612 | { | ||||
613 | // Set the test rule. | ||||
614 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
615 | config->group("General").writeEntry("count", 1); | ||||
616 | auto group = config->group("1"); | ||||
617 | group.writeEntry("position", QPoint(42, 42)); | ||||
618 | group.writeEntry("positionrule", 6); | ||||
619 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
620 | group.writeEntry("wmclasscomplete", false); | ||||
621 | group.writeEntry("wmclassmatch", 1); | ||||
622 | group.sync(); | ||||
623 | RuleBook::self()->setConfig(config); | ||||
624 | workspace()->slotReconfigure(); | ||||
625 | | ||||
626 | // Create the test client. | ||||
627 | QFETCH(Test::ShellSurfaceType, type); | ||||
628 | ShellClient *client; | ||||
629 | Surface *surface; | ||||
630 | XdgShellSurface *shellSurface; | ||||
631 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
632 | QVERIFY(client); | ||||
633 | QVERIFY(client->isActive()); | ||||
634 | | ||||
635 | // The client should be moved to the position specified by the rule. | ||||
636 | QVERIFY(!client->isMovableAcrossScreens()); | ||||
637 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||||
638 | | ||||
639 | // Any attempt to move the client should not succeed. | ||||
640 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||||
641 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||||
642 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
643 | QVERIFY(!client->isMove()); | ||||
644 | QVERIFY(!client->isResize()); | ||||
645 | workspace()->slotWindowMove(); | ||||
646 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
647 | QCOMPARE(clientStartMoveResizedSpy.count(), 0); | ||||
648 | QVERIFY(!client->isMove()); | ||||
649 | QVERIFY(!client->isResize()); | ||||
650 | | ||||
651 | // The rule should be discarded if we close the client. | ||||
652 | delete shellSurface; | ||||
653 | delete surface; | ||||
654 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
655 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||||
656 | QVERIFY(client); | ||||
657 | QVERIFY(client->isActive()); | ||||
658 | QVERIFY(client->isMovableAcrossScreens()); | ||||
659 | QCOMPARE(client->pos(), QPoint(0, 0)); | ||||
660 | | ||||
661 | // Destroy the client. | ||||
662 | delete shellSurface; | ||||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
663 | delete surface; | ||||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
664 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
665 | } | ||||
666 | | ||||
667 | TEST_DATA(testSizeDontAffect) | ||||
668 | | ||||
669 | void TestShellClientRules::testSizeDontAffect() | ||||
670 | { | ||||
671 | // Set the test rule. | ||||
672 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
673 | config->group("General").writeEntry("count", 1); | ||||
674 | auto group = config->group("1"); | ||||
675 | group.writeEntry("size", QSize(480, 640)); | ||||
676 | group.writeEntry("sizerule", 1); | ||||
677 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
678 | group.writeEntry("wmclasscomplete", false); | ||||
679 | group.writeEntry("wmclassmatch", 1); | ||||
680 | group.sync(); | ||||
681 | RuleBook::self()->setConfig(config); | ||||
682 | workspace()->slotReconfigure(); | ||||
683 | | ||||
684 | // Create the test surface. | ||||
685 | QFETCH(Test::ShellSurfaceType, type); | ||||
686 | QScopedPointer<Surface> surface; | ||||
687 | surface.reset(Test::createSurface()); | ||||
688 | QScopedPointer<XdgShellSurface> shellSurface; | ||||
689 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
690 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||||
691 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
692 | shellSurface->setAppId("org.kde.foo"); | ||||
693 | surface->commit(Surface::CommitFlag::None); | ||||
694 | | ||||
695 | // The window size shouldn't be enforced by the rule. | ||||
696 | QVERIFY(configureRequestedSpy->wait()); | ||||
697 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
698 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(0, 0)); | ||||
699 | | ||||
700 | // Map the surface. | ||||
701 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
702 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||||
703 | QVERIFY(client); | ||||
704 | QVERIFY(client->isActive()); | ||||
705 | QVERIFY(client->isResizable()); | ||||
706 | QCOMPARE(client->size(), QSize(100, 50)); | ||||
707 | | ||||
708 | // We should receive a configure event when the client becomes active. | ||||
709 | QVERIFY(configureRequestedSpy->wait()); | ||||
710 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
711 | | ||||
712 | // Destroy the client. | ||||
713 | shellSurface.reset(); | ||||
714 | surface.reset(); | ||||
715 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
716 | } | ||||
717 | | ||||
718 | TEST_DATA(testSizeApply) | ||||
719 | | ||||
720 | void TestShellClientRules::testSizeApply() | ||||
721 | { | ||||
722 | // Set the test rule. | ||||
723 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
724 | config->group("General").writeEntry("count", 1); | ||||
725 | auto group = config->group("1"); | ||||
726 | group.writeEntry("size", QSize(480, 640)); | ||||
727 | group.writeEntry("sizerule", 3); | ||||
728 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
729 | group.writeEntry("wmclasscomplete", false); | ||||
730 | group.writeEntry("wmclassmatch", 1); | ||||
731 | group.sync(); | ||||
732 | RuleBook::self()->setConfig(config); | ||||
733 | workspace()->slotReconfigure(); | ||||
734 | | ||||
735 | // Create the test surface. | ||||
736 | QFETCH(Test::ShellSurfaceType, type); | ||||
737 | QScopedPointer<Surface> surface; | ||||
738 | surface.reset(Test::createSurface()); | ||||
739 | QScopedPointer<XdgShellSurface> shellSurface; | ||||
740 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
741 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||||
742 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
743 | shellSurface->setAppId("org.kde.foo"); | ||||
744 | surface->commit(Surface::CommitFlag::None); | ||||
745 | | ||||
746 | // The initial configure event should contain size hint set by the rule. | ||||
747 | XdgShellSurface::States states; | ||||
748 | QVERIFY(configureRequestedSpy->wait()); | ||||
749 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
750 | QCOMPARE(configureRequestedSpy->last().at(0).toSize(), QSize(480, 640)); | ||||
751 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
752 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||||
753 | QVERIFY(!states.testFlag(XdgShellSurface::State::Resizing)); | ||||
754 | | ||||
755 | // Map the surface. | ||||
756 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
757 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | ||||
758 | QVERIFY(client); | ||||
759 | QVERIFY(client->isActive()); | ||||
760 | QVERIFY(client->isResizable()); | ||||
761 | QCOMPARE(client->size(), QSize(480, 640)); | ||||
762 | | ||||
763 | // We should receive a configure event when the client becomes active. | ||||
764 | QVERIFY(configureRequestedSpy->wait()); | ||||
765 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
766 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
767 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
768 | QVERIFY(!states.testFlag(XdgShellSurface::State::Resizing)); | ||||
769 | | ||||
770 | // One still should be able to resize the client. | ||||
771 | QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); | ||||
772 | QVERIFY(geometryChangedSpy.isValid()); | ||||
773 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||||
774 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||||
775 | QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized); | ||||
776 | QVERIFY(clientStepUserMovedResizedSpy.isValid()); | ||||
777 | QSignalSpy clientFinishUserMovedResizedSpy(client, &AbstractClient::clientFinishUserMovedResized); | ||||
778 | QVERIFY(clientFinishUserMovedResizedSpy.isValid()); | ||||
779 | QSignalSpy surfaceSizeChangedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); | ||||
780 | QVERIFY(surfaceSizeChangedSpy.isValid()); | ||||
781 | | ||||
782 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
783 | QVERIFY(!client->isMove()); | ||||
784 | QVERIFY(!client->isResize()); | ||||
785 | workspace()->slotWindowResize(); | ||||
786 | QCOMPARE(workspace()->getMovingClient(), client); | ||||
787 | QCOMPARE(clientStartMoveResizedSpy.count(), 1); | ||||
788 | QVERIFY(!client->isMove()); | ||||
789 | QVERIFY(client->isResize()); | ||||
790 | QVERIFY(configureRequestedSpy->wait()); | ||||
791 | QCOMPARE(configureRequestedSpy->count(), 3); | ||||
792 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
793 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
794 | QVERIFY(states.testFlag(XdgShellSurface::State::Resizing)); | ||||
795 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
796 | | ||||
797 | const QPoint cursorPos = KWin::Cursor::pos(); | ||||
798 | client->keyPressEvent(Qt::Key_Right); | ||||
799 | client->updateMoveResize(KWin::Cursor::pos()); | ||||
800 | QCOMPARE(KWin::Cursor::pos(), cursorPos + QPoint(8, 0)); | ||||
801 | QVERIFY(configureRequestedSpy->wait()); | ||||
802 | QCOMPARE(configureRequestedSpy->count(), 4); | ||||
803 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
804 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
805 | QVERIFY(states.testFlag(XdgShellSurface::State::Resizing)); | ||||
806 | QCOMPARE(surfaceSizeChangedSpy.count(), 1); | ||||
807 | QCOMPARE(surfaceSizeChangedSpy.last().first().toSize(), QSize(488, 640)); | ||||
808 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 0); | ||||
809 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
810 | Test::render(surface.data(), QSize(488, 640), Qt::blue); | ||||
811 | QVERIFY(geometryChangedSpy.wait()); | ||||
812 | QCOMPARE(client->size(), QSize(488, 640)); | ||||
813 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); | ||||
814 | | ||||
815 | client->keyPressEvent(Qt::Key_Enter); | ||||
816 | QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1); | ||||
817 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
818 | QVERIFY(!client->isMove()); | ||||
819 | QVERIFY(!client->isResize()); | ||||
820 | | ||||
821 | QEXPECT_FAIL("", "Interactive resize is not spec-compliant", Continue); | ||||
822 | QVERIFY(configureRequestedSpy->wait(10)); | ||||
823 | QEXPECT_FAIL("", "Interactive resize is not spec-compliant", Continue); | ||||
824 | QCOMPARE(configureRequestedSpy->count(), 5); | ||||
825 | | ||||
826 | // The rule should be applied again if the client appears after it's been closed. | ||||
827 | shellSurface.reset(); | ||||
828 | surface.reset(); | ||||
829 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
830 | surface.reset(Test::createSurface()); | ||||
831 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
832 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
833 | shellSurface->setAppId("org.kde.foo"); | ||||
834 | surface->commit(Surface::CommitFlag::None); | ||||
835 | | ||||
836 | QVERIFY(configureRequestedSpy->wait()); | ||||
837 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
838 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); | ||||
839 | | ||||
840 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
841 | client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | ||||
842 | QVERIFY(client); | ||||
843 | QVERIFY(client->isActive()); | ||||
844 | QVERIFY(client->isResizable()); | ||||
845 | QCOMPARE(client->size(), QSize(480, 640)); | ||||
846 | | ||||
847 | QVERIFY(configureRequestedSpy->wait()); | ||||
848 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
849 | | ||||
850 | // Destroy the client. | ||||
851 | shellSurface.reset(); | ||||
852 | surface.reset(); | ||||
853 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
854 | } | ||||
855 | | ||||
856 | TEST_DATA(testSizeRemember) | ||||
857 | | ||||
858 | void TestShellClientRules::testSizeRemember() | ||||
859 | { | ||||
860 | // Set the test rule. | ||||
861 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
862 | config->group("General").writeEntry("count", 1); | ||||
863 | auto group = config->group("1"); | ||||
864 | group.writeEntry("size", QSize(480, 640)); | ||||
865 | group.writeEntry("sizerule", 4); | ||||
866 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
867 | group.writeEntry("wmclasscomplete", false); | ||||
868 | group.writeEntry("wmclassmatch", 1); | ||||
869 | group.sync(); | ||||
870 | RuleBook::self()->setConfig(config); | ||||
871 | workspace()->slotReconfigure(); | ||||
872 | | ||||
873 | // Create the test surface. | ||||
874 | QFETCH(Test::ShellSurfaceType, type); | ||||
875 | QScopedPointer<Surface> surface; | ||||
876 | surface.reset(Test::createSurface()); | ||||
877 | QScopedPointer<XdgShellSurface> shellSurface; | ||||
878 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
879 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||||
880 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
881 | shellSurface->setAppId("org.kde.foo"); | ||||
882 | surface->commit(Surface::CommitFlag::None); | ||||
883 | | ||||
884 | // The initial configure event should contain size hint set by the rule. | ||||
885 | XdgShellSurface::States states; | ||||
886 | QVERIFY(configureRequestedSpy->wait()); | ||||
887 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
888 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); | ||||
889 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
890 | QVERIFY(!states.testFlag(XdgShellSurface::State::Activated)); | ||||
891 | QVERIFY(!states.testFlag(XdgShellSurface::State::Resizing)); | ||||
892 | | ||||
893 | // Map the surface. | ||||
894 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
895 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | ||||
896 | QVERIFY(client); | ||||
897 | QVERIFY(client->isActive()); | ||||
898 | QVERIFY(client->isResizable()); | ||||
899 | QCOMPARE(client->size(), QSize(480, 640)); | ||||
900 | | ||||
901 | // We should receive a configure event when the client becomes active. | ||||
902 | QVERIFY(configureRequestedSpy->wait()); | ||||
903 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
904 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
905 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
906 | QVERIFY(!states.testFlag(XdgShellSurface::State::Resizing)); | ||||
907 | | ||||
908 | // One should still be able to resize the client. | ||||
909 | QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); | ||||
910 | QVERIFY(geometryChangedSpy.isValid()); | ||||
911 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||||
912 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||||
913 | QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized); | ||||
914 | QVERIFY(clientStepUserMovedResizedSpy.isValid()); | ||||
915 | QSignalSpy clientFinishUserMovedResizedSpy(client, &AbstractClient::clientFinishUserMovedResized); | ||||
916 | QVERIFY(clientFinishUserMovedResizedSpy.isValid()); | ||||
917 | QSignalSpy surfaceSizeChangedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); | ||||
918 | QVERIFY(surfaceSizeChangedSpy.isValid()); | ||||
919 | | ||||
920 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
921 | QVERIFY(!client->isMove()); | ||||
922 | QVERIFY(!client->isResize()); | ||||
923 | workspace()->slotWindowResize(); | ||||
924 | QCOMPARE(workspace()->getMovingClient(), client); | ||||
925 | QCOMPARE(clientStartMoveResizedSpy.count(), 1); | ||||
926 | QVERIFY(!client->isMove()); | ||||
927 | QVERIFY(client->isResize()); | ||||
928 | QVERIFY(configureRequestedSpy->wait()); | ||||
929 | QCOMPARE(configureRequestedSpy->count(), 3); | ||||
930 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
931 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
932 | QVERIFY(states.testFlag(XdgShellSurface::State::Resizing)); | ||||
933 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
934 | | ||||
935 | const QPoint cursorPos = KWin::Cursor::pos(); | ||||
936 | client->keyPressEvent(Qt::Key_Right); | ||||
937 | client->updateMoveResize(KWin::Cursor::pos()); | ||||
938 | QCOMPARE(KWin::Cursor::pos(), cursorPos + QPoint(8, 0)); | ||||
939 | QVERIFY(configureRequestedSpy->wait()); | ||||
940 | QCOMPARE(configureRequestedSpy->count(), 4); | ||||
941 | states = configureRequestedSpy->last().at(1).value<XdgShellSurface::States>(); | ||||
942 | QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); | ||||
943 | QVERIFY(states.testFlag(XdgShellSurface::State::Resizing)); | ||||
944 | QCOMPARE(surfaceSizeChangedSpy.count(), 1); | ||||
945 | QCOMPARE(surfaceSizeChangedSpy.last().first().toSize(), QSize(488, 640)); | ||||
946 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 0); | ||||
947 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
948 | Test::render(surface.data(), QSize(488, 640), Qt::blue); | ||||
949 | QVERIFY(geometryChangedSpy.wait()); | ||||
950 | QCOMPARE(client->size(), QSize(488, 640)); | ||||
951 | QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); | ||||
952 | | ||||
953 | client->keyPressEvent(Qt::Key_Enter); | ||||
954 | QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1); | ||||
955 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
956 | QVERIFY(!client->isMove()); | ||||
957 | QVERIFY(!client->isResize()); | ||||
958 | | ||||
959 | QEXPECT_FAIL("", "Interactive resize is not spec-compliant", Continue); | ||||
960 | QVERIFY(configureRequestedSpy->wait(10)); | ||||
961 | QEXPECT_FAIL("", "Interactive resize is not spec-compliant", Continue); | ||||
962 | QCOMPARE(configureRequestedSpy->count(), 5); | ||||
963 | | ||||
964 | // If the client appears again, it should have the last known size. | ||||
965 | shellSurface.reset(); | ||||
966 | surface.reset(); | ||||
967 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
968 | surface.reset(Test::createSurface()); | ||||
969 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
970 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
971 | shellSurface->setAppId("org.kde.foo"); | ||||
972 | surface->commit(Surface::CommitFlag::None); | ||||
973 | | ||||
974 | QVERIFY(configureRequestedSpy->wait()); | ||||
975 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
976 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(488, 640)); | ||||
977 | | ||||
978 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
979 | client = Test::renderAndWaitForShown(surface.data(), QSize(488, 640), Qt::blue); | ||||
980 | QVERIFY(client); | ||||
981 | QVERIFY(client->isActive()); | ||||
982 | QVERIFY(client->isResizable()); | ||||
983 | QCOMPARE(client->size(), QSize(488, 640)); | ||||
984 | | ||||
985 | QVERIFY(configureRequestedSpy->wait()); | ||||
986 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
987 | | ||||
988 | // Destroy the client. | ||||
989 | shellSurface.reset(); | ||||
990 | surface.reset(); | ||||
991 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
992 | } | ||||
993 | | ||||
994 | TEST_DATA(testSizeForce) | ||||
995 | | ||||
996 | void TestShellClientRules::testSizeForce() | ||||
997 | { | ||||
998 | // Set the test rule. | ||||
999 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
1000 | config->group("General").writeEntry("count", 1); | ||||
1001 | auto group = config->group("1"); | ||||
1002 | group.writeEntry("size", QSize(480, 640)); | ||||
1003 | group.writeEntry("sizerule", 2); | ||||
1004 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
1005 | group.writeEntry("wmclasscomplete", false); | ||||
1006 | group.writeEntry("wmclassmatch", 1); | ||||
1007 | group.sync(); | ||||
1008 | RuleBook::self()->setConfig(config); | ||||
1009 | workspace()->slotReconfigure(); | ||||
1010 | | ||||
1011 | // Create the test surface. | ||||
1012 | QFETCH(Test::ShellSurfaceType, type); | ||||
1013 | QScopedPointer<Surface> surface; | ||||
1014 | surface.reset(Test::createSurface()); | ||||
1015 | QScopedPointer<XdgShellSurface> shellSurface; | ||||
1016 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1017 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||||
1018 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1019 | shellSurface->setAppId("org.kde.foo"); | ||||
1020 | surface->commit(Surface::CommitFlag::None); | ||||
1021 | | ||||
1022 | // The initial configure event should contain size hint set by the rule. | ||||
1023 | QVERIFY(configureRequestedSpy->wait()); | ||||
1024 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1025 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); | ||||
1026 | | ||||
1027 | // Map the surface. | ||||
1028 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1029 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | ||||
1030 | QVERIFY(client); | ||||
1031 | QVERIFY(client->isActive()); | ||||
1032 | QVERIFY(!client->isResizable()); | ||||
1033 | QCOMPARE(client->size(), QSize(480, 640)); | ||||
1034 | | ||||
1035 | // We should receive a configure event when the client becomes active. | ||||
1036 | QVERIFY(configureRequestedSpy->wait()); | ||||
1037 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1038 | | ||||
1039 | // Any attempt to resize the client should not succeed. | ||||
1040 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||||
1041 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||||
1042 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
1043 | QVERIFY(!client->isMove()); | ||||
1044 | QVERIFY(!client->isResize()); | ||||
1045 | workspace()->slotWindowResize(); | ||||
1046 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
1047 | QCOMPARE(clientStartMoveResizedSpy.count(), 0); | ||||
1048 | QVERIFY(!client->isMove()); | ||||
1049 | QVERIFY(!client->isResize()); | ||||
1050 | QVERIFY(!configureRequestedSpy->wait(100)); | ||||
1051 | | ||||
1052 | // If the client appears again, the size should still be forced. | ||||
1053 | shellSurface.reset(); | ||||
1054 | surface.reset(); | ||||
1055 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1056 | surface.reset(Test::createSurface()); | ||||
1057 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1058 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1059 | shellSurface->setAppId("org.kde.foo"); | ||||
1060 | surface->commit(Surface::CommitFlag::None); | ||||
1061 | | ||||
1062 | QVERIFY(configureRequestedSpy->wait()); | ||||
1063 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1064 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); | ||||
1065 | | ||||
1066 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1067 | client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | ||||
1068 | QVERIFY(client); | ||||
1069 | QVERIFY(client->isActive()); | ||||
1070 | QVERIFY(!client->isResizable()); | ||||
1071 | QCOMPARE(client->size(), QSize(480, 640)); | ||||
1072 | | ||||
1073 | QVERIFY(configureRequestedSpy->wait()); | ||||
1074 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1075 | | ||||
1076 | // Destroy the client. | ||||
1077 | shellSurface.reset(); | ||||
1078 | surface.reset(); | ||||
1079 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1080 | } | ||||
1081 | | ||||
1082 | TEST_DATA(testSizeApplyNow) | ||||
1083 | | ||||
1084 | void TestShellClientRules::testSizeApplyNow() | ||||
1085 | { | ||||
1086 | // Create the test surface. | ||||
1087 | QFETCH(Test::ShellSurfaceType, type); | ||||
1088 | QScopedPointer<Surface> surface; | ||||
1089 | surface.reset(Test::createSurface()); | ||||
1090 | QScopedPointer<XdgShellSurface> shellSurface; | ||||
1091 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1092 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||||
1093 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1094 | shellSurface->setAppId("org.kde.foo"); | ||||
1095 | surface->commit(Surface::CommitFlag::None); | ||||
1096 | | ||||
1097 | // The expected surface dimensions should be set by the rule. | ||||
1098 | QVERIFY(configureRequestedSpy->wait()); | ||||
1099 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1100 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(0, 0)); | ||||
1101 | | ||||
1102 | // Map the surface. | ||||
1103 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1104 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||||
1105 | QVERIFY(client); | ||||
1106 | QVERIFY(client->isActive()); | ||||
1107 | QVERIFY(client->isResizable()); | ||||
1108 | QCOMPARE(client->size(), QSize(100, 50)); | ||||
1109 | | ||||
1110 | // We should receive a configure event when the client becomes active. | ||||
1111 | QVERIFY(configureRequestedSpy->wait()); | ||||
1112 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1113 | | ||||
1114 | // Set the test rule. | ||||
1115 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
1116 | config->group("General").writeEntry("count", 1); | ||||
1117 | auto group = config->group("1"); | ||||
1118 | group.writeEntry("size", QSize(480, 640)); | ||||
1119 | group.writeEntry("sizerule", 5); | ||||
1120 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
1121 | group.writeEntry("wmclasscomplete", false); | ||||
1122 | group.writeEntry("wmclassmatch", 1); | ||||
1123 | group.sync(); | ||||
1124 | RuleBook::self()->setConfig(config); | ||||
1125 | workspace()->slotReconfigure(); | ||||
1126 | | ||||
1127 | // The compositor should send a configure event with a new size. | ||||
1128 | QVERIFY(configureRequestedSpy->wait()); | ||||
1129 | QCOMPARE(configureRequestedSpy->count(), 3); | ||||
1130 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); | ||||
1131 | | ||||
1132 | // Draw the surface with the new size. | ||||
1133 | QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); | ||||
1134 | QVERIFY(geometryChangedSpy.isValid()); | ||||
1135 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1136 | Test::render(surface.data(), QSize(480, 640), Qt::blue); | ||||
1137 | QVERIFY(geometryChangedSpy.wait()); | ||||
1138 | QCOMPARE(client->size(), QSize(480, 640)); | ||||
1139 | QVERIFY(!configureRequestedSpy->wait(100)); | ||||
1140 | | ||||
1141 | // The rule should not be applied again. | ||||
1142 | client->evaluateWindowRules(); | ||||
1143 | QVERIFY(!configureRequestedSpy->wait(100)); | ||||
1144 | | ||||
1145 | // Destroy the client. | ||||
1146 | shellSurface.reset(); | ||||
1147 | surface.reset(); | ||||
1148 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1149 | } | ||||
1150 | | ||||
1151 | TEST_DATA(testSizeForceTemporarily) | ||||
1152 | | ||||
1153 | void TestShellClientRules::testSizeForceTemporarily() | ||||
1154 | { | ||||
1155 | // Set the test rule. | ||||
1156 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||||
1157 | config->group("General").writeEntry("count", 1); | ||||
1158 | auto group = config->group("1"); | ||||
1159 | group.writeEntry("size", QSize(480, 640)); | ||||
1160 | group.writeEntry("sizerule", 6); | ||||
1161 | group.writeEntry("wmclass", "org.kde.foo"); | ||||
1162 | group.writeEntry("wmclasscomplete", false); | ||||
1163 | group.writeEntry("wmclassmatch", 1); | ||||
1164 | group.sync(); | ||||
1165 | RuleBook::self()->setConfig(config); | ||||
1166 | workspace()->slotReconfigure(); | ||||
1167 | | ||||
1168 | // Create the test surface. | ||||
1169 | QFETCH(Test::ShellSurfaceType, type); | ||||
1170 | QScopedPointer<Surface> surface; | ||||
1171 | surface.reset(Test::createSurface()); | ||||
1172 | QScopedPointer<XdgShellSurface> shellSurface; | ||||
1173 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1174 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||||
1175 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1176 | shellSurface->setAppId("org.kde.foo"); | ||||
1177 | surface->commit(Surface::CommitFlag::None); | ||||
1178 | | ||||
1179 | // The initial configure event should contain size hint set by the rule. | ||||
1180 | QVERIFY(configureRequestedSpy->wait()); | ||||
1181 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1182 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); | ||||
1183 | | ||||
1184 | // Map the surface. | ||||
1185 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1186 | ShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(480, 640), Qt::blue); | ||||
1187 | QVERIFY(client); | ||||
1188 | QVERIFY(client->isActive()); | ||||
1189 | QVERIFY(!client->isResizable()); | ||||
1190 | QCOMPARE(client->size(), QSize(480, 640)); | ||||
1191 | | ||||
1192 | // We should receive a configure event when the client becomes active. | ||||
1193 | QVERIFY(configureRequestedSpy->wait()); | ||||
1194 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1195 | | ||||
1196 | // Any attempt to resize the client should not succeed. | ||||
1197 | QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); | ||||
1198 | QVERIFY(clientStartMoveResizedSpy.isValid()); | ||||
1199 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
1200 | QVERIFY(!client->isMove()); | ||||
1201 | QVERIFY(!client->isResize()); | ||||
1202 | workspace()->slotWindowResize(); | ||||
1203 | QCOMPARE(workspace()->getMovingClient(), nullptr); | ||||
1204 | QCOMPARE(clientStartMoveResizedSpy.count(), 0); | ||||
1205 | QVERIFY(!client->isMove()); | ||||
1206 | QVERIFY(!client->isResize()); | ||||
1207 | QVERIFY(!configureRequestedSpy->wait(100)); | ||||
1208 | | ||||
1209 | // The rule should be discarded when the client is closed. | ||||
1210 | shellSurface.reset(); | ||||
1211 | surface.reset(); | ||||
1212 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1213 | surface.reset(Test::createSurface()); | ||||
1214 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||||
1215 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||||
1216 | shellSurface->setAppId("org.kde.foo"); | ||||
1217 | surface->commit(Surface::CommitFlag::None); | ||||
1218 | | ||||
1219 | QVERIFY(configureRequestedSpy->wait()); | ||||
1220 | QCOMPARE(configureRequestedSpy->count(), 1); | ||||
1221 | QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(0, 0)); | ||||
1222 | | ||||
1223 | shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value<quint32>()); | ||||
1224 | client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||||
1225 | QVERIFY(client); | ||||
1226 | QVERIFY(client->isActive()); | ||||
1227 | QVERIFY(client->isResizable()); | ||||
1228 | QCOMPARE(client->size(), QSize(100, 50)); | ||||
1229 | | ||||
1230 | QVERIFY(configureRequestedSpy->wait()); | ||||
1231 | QCOMPARE(configureRequestedSpy->count(), 2); | ||||
1232 | | ||||
1233 | // Destroy the client. | ||||
1234 | shellSurface.reset(); | ||||
1235 | surface.reset(); | ||||
1236 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||||
1237 | } | ||||
1238 | | ||||
253 | TEST_DATA(testDesktopDontAffect) | 1239 | TEST_DATA(testDesktopDontAffect) | ||
254 | 1240 | | |||
255 | void TestShellClientRules::testDesktopDontAffect() | 1241 | void TestShellClientRules::testDesktopDontAffect() | ||
256 | { | 1242 | { | ||
257 | // Set the test rule. | 1243 | // Set the test rule. | ||
258 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 1244 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
259 | config->group("General").writeEntry("count", 1); | 1245 | config->group("General").writeEntry("count", 1); | ||
260 | auto group = config->group("1"); | 1246 | auto group = config->group("1"); | ||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 1283 | { | |||
338 | VirtualDesktopManager::self()->setCurrent(1); | 1324 | VirtualDesktopManager::self()->setCurrent(1); | ||
339 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1325 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
340 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1326 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
341 | QVERIFY(client); | 1327 | QVERIFY(client); | ||
342 | QCOMPARE(client->desktop(), 2); | 1328 | QCOMPARE(client->desktop(), 2); | ||
343 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | 1329 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | ||
344 | 1330 | | |||
345 | // Destroy the client. | 1331 | // Destroy the client. | ||
346 | delete shellSurface; | 1332 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
347 | delete surface; | 1333 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
348 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1334 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
349 | } | 1335 | } | ||
350 | 1336 | | |||
351 | TEST_DATA(testDesktopRemember) | 1337 | TEST_DATA(testDesktopRemember) | ||
352 | 1338 | | |||
353 | void TestShellClientRules::testDesktopRemember() | 1339 | void TestShellClientRules::testDesktopRemember() | ||
354 | { | 1340 | { | ||
355 | // Set the test rule. | 1341 | // Set the test rule. | ||
Show All 35 Lines | |||||
391 | 1377 | | |||
392 | // If open the client again, it should appear on the first virtual desktop. | 1378 | // If open the client again, it should appear on the first virtual desktop. | ||
393 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1379 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
394 | QVERIFY(client); | 1380 | QVERIFY(client); | ||
395 | QCOMPARE(client->desktop(), 1); | 1381 | QCOMPARE(client->desktop(), 1); | ||
396 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1382 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
397 | 1383 | | |||
398 | // Destroy the client. | 1384 | // Destroy the client. | ||
399 | delete shellSurface; | 1385 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
400 | delete surface; | 1386 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
401 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1387 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
402 | } | 1388 | } | ||
403 | 1389 | | |||
404 | TEST_DATA(testDesktopForce) | 1390 | TEST_DATA(testDesktopForce) | ||
405 | 1391 | | |||
406 | void TestShellClientRules::testDesktopForce() | 1392 | void TestShellClientRules::testDesktopForce() | ||
407 | { | 1393 | { | ||
408 | // Set the test rule. | 1394 | // Set the test rule. | ||
Show All 39 Lines | |||||
448 | VirtualDesktopManager::self()->setCurrent(1); | 1434 | VirtualDesktopManager::self()->setCurrent(1); | ||
449 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1435 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
450 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1436 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
451 | QVERIFY(client); | 1437 | QVERIFY(client); | ||
452 | QCOMPARE(client->desktop(), 2); | 1438 | QCOMPARE(client->desktop(), 2); | ||
453 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | 1439 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | ||
454 | 1440 | | |||
455 | // Destroy the client. | 1441 | // Destroy the client. | ||
456 | delete shellSurface; | 1442 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
457 | delete surface; | 1443 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
458 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1444 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
459 | } | 1445 | } | ||
460 | 1446 | | |||
461 | TEST_DATA(testDesktopApplyNow) | 1447 | TEST_DATA(testDesktopApplyNow) | ||
462 | 1448 | | |||
463 | void TestShellClientRules::testDesktopApplyNow() | 1449 | void TestShellClientRules::testDesktopApplyNow() | ||
464 | { | 1450 | { | ||
465 | // We need at least two virtual desktop for this test. | 1451 | // We need at least two virtual desktop for this test. | ||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | 1503 | { | |||
566 | workspace()->sendClientToDesktop(client, 2, true); | 1552 | workspace()->sendClientToDesktop(client, 2, true); | ||
567 | QCOMPARE(client->desktop(), 2); | 1553 | QCOMPARE(client->desktop(), 2); | ||
568 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1554 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
569 | workspace()->sendClientToDesktop(client, 1, true); | 1555 | workspace()->sendClientToDesktop(client, 1, true); | ||
570 | QCOMPARE(client->desktop(), 1); | 1556 | QCOMPARE(client->desktop(), 1); | ||
571 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1557 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
572 | 1558 | | |||
573 | // Destroy the client. | 1559 | // Destroy the client. | ||
574 | delete shellSurface; | 1560 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
575 | delete surface; | 1561 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
576 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1562 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
577 | } | 1563 | } | ||
578 | 1564 | | |||
579 | TEST_DATA(testMinimizeDontAffect) | 1565 | TEST_DATA(testMinimizeDontAffect) | ||
580 | 1566 | | |||
581 | void TestShellClientRules::testMinimizeDontAffect() | 1567 | void TestShellClientRules::testMinimizeDontAffect() | ||
582 | { | 1568 | { | ||
583 | // Set the test rule. | 1569 | // Set the test rule. | ||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 1603 | { | |||
649 | delete surface; | 1635 | delete surface; | ||
650 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1636 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
651 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1637 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
652 | QVERIFY(client); | 1638 | QVERIFY(client); | ||
653 | QVERIFY(client->isMinimizable()); | 1639 | QVERIFY(client->isMinimizable()); | ||
654 | QVERIFY(client->isMinimized()); | 1640 | QVERIFY(client->isMinimized()); | ||
655 | 1641 | | |||
656 | // Destroy the client. | 1642 | // Destroy the client. | ||
657 | delete shellSurface; | 1643 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
658 | delete surface; | 1644 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
659 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1645 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
660 | } | 1646 | } | ||
661 | 1647 | | |||
662 | TEST_DATA(testMinimizeRemember) | 1648 | TEST_DATA(testMinimizeRemember) | ||
663 | 1649 | | |||
664 | void TestShellClientRules::testMinimizeRemember() | 1650 | void TestShellClientRules::testMinimizeRemember() | ||
665 | { | 1651 | { | ||
666 | // Set the test rule. | 1652 | // Set the test rule. | ||
Show All 28 Lines | |||||
695 | delete surface; | 1681 | delete surface; | ||
696 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1682 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
697 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1683 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
698 | QVERIFY(client); | 1684 | QVERIFY(client); | ||
699 | QVERIFY(client->isMinimizable()); | 1685 | QVERIFY(client->isMinimizable()); | ||
700 | QVERIFY(client->isMinimized()); | 1686 | QVERIFY(client->isMinimized()); | ||
701 | 1687 | | |||
702 | // Destroy the client. | 1688 | // Destroy the client. | ||
703 | delete shellSurface; | 1689 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
704 | delete surface; | 1690 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
705 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1691 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
706 | } | 1692 | } | ||
707 | 1693 | | |||
708 | TEST_DATA(testMinimizeForce) | 1694 | TEST_DATA(testMinimizeForce) | ||
709 | 1695 | | |||
710 | void TestShellClientRules::testMinimizeForce() | 1696 | void TestShellClientRules::testMinimizeForce() | ||
711 | { | 1697 | { | ||
712 | // Set the test rule. | 1698 | // Set the test rule. | ||
Show All 30 Lines | |||||
743 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1729 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
744 | QVERIFY(client); | 1730 | QVERIFY(client); | ||
745 | QVERIFY(!client->isMinimizable()); | 1731 | QVERIFY(!client->isMinimizable()); | ||
746 | QVERIFY(!client->isMinimized()); | 1732 | QVERIFY(!client->isMinimized()); | ||
747 | client->minimize(); | 1733 | client->minimize(); | ||
748 | QVERIFY(!client->isMinimized()); | 1734 | QVERIFY(!client->isMinimized()); | ||
749 | 1735 | | |||
750 | // Destroy the client. | 1736 | // Destroy the client. | ||
751 | delete shellSurface; | 1737 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
752 | delete surface; | 1738 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
753 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1739 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
754 | } | 1740 | } | ||
755 | 1741 | | |||
756 | TEST_DATA(testMinimizeApplyNow) | 1742 | TEST_DATA(testMinimizeApplyNow) | ||
757 | 1743 | | |||
758 | void TestShellClientRules::testMinimizeApplyNow() | 1744 | void TestShellClientRules::testMinimizeApplyNow() | ||
759 | { | 1745 | { | ||
760 | // Create the test client. | 1746 | // Create the test client. | ||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Line(s) | 1791 | { | |||
837 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1823 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
838 | QVERIFY(client); | 1824 | QVERIFY(client); | ||
839 | QVERIFY(client->isMinimizable()); | 1825 | QVERIFY(client->isMinimizable()); | ||
840 | QVERIFY(!client->isMinimized()); | 1826 | QVERIFY(!client->isMinimized()); | ||
841 | client->minimize(); | 1827 | client->minimize(); | ||
842 | QVERIFY(client->isMinimized()); | 1828 | QVERIFY(client->isMinimized()); | ||
843 | 1829 | | |||
844 | // Destroy the client. | 1830 | // Destroy the client. | ||
845 | delete shellSurface; | 1831 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
846 | delete surface; | 1832 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
847 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1833 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
848 | } | 1834 | } | ||
849 | 1835 | | |||
850 | TEST_DATA(testSkipTaskbarDontAffect) | 1836 | TEST_DATA(testSkipTaskbarDontAffect) | ||
851 | 1837 | | |||
852 | void TestShellClientRules::testSkipTaskbarDontAffect() | 1838 | void TestShellClientRules::testSkipTaskbarDontAffect() | ||
853 | { | 1839 | { | ||
854 | // Set the test rule. | 1840 | // Set the test rule. | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 1873 | { | |||
917 | delete shellSurface; | 1903 | delete shellSurface; | ||
918 | delete surface; | 1904 | delete surface; | ||
919 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1905 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
920 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1906 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
921 | QVERIFY(client); | 1907 | QVERIFY(client); | ||
922 | QVERIFY(client->skipTaskbar()); | 1908 | QVERIFY(client->skipTaskbar()); | ||
923 | 1909 | | |||
924 | // Destroy the client. | 1910 | // Destroy the client. | ||
925 | delete shellSurface; | 1911 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
926 | delete surface; | 1912 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
927 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1913 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
928 | } | 1914 | } | ||
929 | 1915 | | |||
930 | TEST_DATA(testSkipTaskbarRemember) | 1916 | TEST_DATA(testSkipTaskbarRemember) | ||
931 | 1917 | | |||
932 | void TestShellClientRules::testSkipTaskbarRemember() | 1918 | void TestShellClientRules::testSkipTaskbarRemember() | ||
933 | { | 1919 | { | ||
934 | // Set the test rule. | 1920 | // Set the test rule. | ||
Show All 30 Lines | |||||
965 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1951 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
966 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1952 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
967 | QVERIFY(client); | 1953 | QVERIFY(client); | ||
968 | 1954 | | |||
969 | // The client should be included on a taskbar. | 1955 | // The client should be included on a taskbar. | ||
970 | QVERIFY(!client->skipTaskbar()); | 1956 | QVERIFY(!client->skipTaskbar()); | ||
971 | 1957 | | |||
972 | // Destroy the client. | 1958 | // Destroy the client. | ||
973 | delete shellSurface; | 1959 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
974 | delete surface; | 1960 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
975 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1961 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
976 | } | 1962 | } | ||
977 | 1963 | | |||
978 | TEST_DATA(testSkipTaskbarForce) | 1964 | TEST_DATA(testSkipTaskbarForce) | ||
979 | 1965 | | |||
980 | void TestShellClientRules::testSkipTaskbarForce() | 1966 | void TestShellClientRules::testSkipTaskbarForce() | ||
981 | { | 1967 | { | ||
982 | // Set the test rule. | 1968 | // Set the test rule. | ||
Show All 30 Lines | |||||
1013 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1999 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1014 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2000 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1015 | QVERIFY(client); | 2001 | QVERIFY(client); | ||
1016 | 2002 | | |||
1017 | // The skip-taskbar state should be still forced. | 2003 | // The skip-taskbar state should be still forced. | ||
1018 | QVERIFY(client->skipTaskbar()); | 2004 | QVERIFY(client->skipTaskbar()); | ||
1019 | 2005 | | |||
1020 | // Destroy the client. | 2006 | // Destroy the client. | ||
1021 | delete shellSurface; | 2007 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1022 | delete surface; | 2008 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1023 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2009 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1024 | } | 2010 | } | ||
1025 | 2011 | | |||
1026 | TEST_DATA(testSkipTaskbarApplyNow) | 2012 | TEST_DATA(testSkipTaskbarApplyNow) | ||
1027 | 2013 | | |||
1028 | void TestShellClientRules::testSkipTaskbarApplyNow() | 2014 | void TestShellClientRules::testSkipTaskbarApplyNow() | ||
1029 | { | 2015 | { | ||
1030 | // Create the test client. | 2016 | // Create the test client. | ||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 2058 | { | |||
1108 | // The client should be included on a taskbar now. | 2094 | // The client should be included on a taskbar now. | ||
1109 | QVERIFY(!client->skipTaskbar()); | 2095 | QVERIFY(!client->skipTaskbar()); | ||
1110 | 2096 | | |||
1111 | // Also, one can change that. | 2097 | // Also, one can change that. | ||
1112 | client->setOriginalSkipTaskbar(true); | 2098 | client->setOriginalSkipTaskbar(true); | ||
1113 | QVERIFY(client->skipTaskbar()); | 2099 | QVERIFY(client->skipTaskbar()); | ||
1114 | 2100 | | |||
1115 | // Destroy the client. | 2101 | // Destroy the client. | ||
1116 | delete shellSurface; | 2102 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1117 | delete surface; | 2103 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1118 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2104 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1119 | } | 2105 | } | ||
1120 | 2106 | | |||
1121 | TEST_DATA(testSkipPagerDontAffect) | 2107 | TEST_DATA(testSkipPagerDontAffect) | ||
1122 | 2108 | | |||
1123 | void TestShellClientRules::testSkipPagerDontAffect() | 2109 | void TestShellClientRules::testSkipPagerDontAffect() | ||
1124 | { | 2110 | { | ||
1125 | // Set the test rule. | 2111 | // Set the test rule. | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 2144 | { | |||
1188 | delete shellSurface; | 2174 | delete shellSurface; | ||
1189 | delete surface; | 2175 | delete surface; | ||
1190 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2176 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1191 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2177 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1192 | QVERIFY(client); | 2178 | QVERIFY(client); | ||
1193 | QVERIFY(client->skipPager()); | 2179 | QVERIFY(client->skipPager()); | ||
1194 | 2180 | | |||
1195 | // Destroy the client. | 2181 | // Destroy the client. | ||
1196 | delete shellSurface; | 2182 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1197 | delete surface; | 2183 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1198 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2184 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1199 | } | 2185 | } | ||
1200 | 2186 | | |||
1201 | TEST_DATA(testSkipPagerRemember) | 2187 | TEST_DATA(testSkipPagerRemember) | ||
1202 | 2188 | | |||
1203 | void TestShellClientRules::testSkipPagerRemember() | 2189 | void TestShellClientRules::testSkipPagerRemember() | ||
1204 | { | 2190 | { | ||
1205 | // Set the test rule. | 2191 | // Set the test rule. | ||
Show All 30 Lines | |||||
1236 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2222 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1237 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2223 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1238 | QVERIFY(client); | 2224 | QVERIFY(client); | ||
1239 | 2225 | | |||
1240 | // The client should be included on a pager. | 2226 | // The client should be included on a pager. | ||
1241 | QVERIFY(!client->skipPager()); | 2227 | QVERIFY(!client->skipPager()); | ||
1242 | 2228 | | |||
1243 | // Destroy the client. | 2229 | // Destroy the client. | ||
1244 | delete shellSurface; | 2230 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1245 | delete surface; | 2231 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1246 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2232 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1247 | } | 2233 | } | ||
1248 | 2234 | | |||
1249 | TEST_DATA(testSkipPagerForce) | 2235 | TEST_DATA(testSkipPagerForce) | ||
1250 | 2236 | | |||
1251 | void TestShellClientRules::testSkipPagerForce() | 2237 | void TestShellClientRules::testSkipPagerForce() | ||
1252 | { | 2238 | { | ||
1253 | // Set the test rule. | 2239 | // Set the test rule. | ||
Show All 30 Lines | |||||
1284 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2270 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1285 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2271 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1286 | QVERIFY(client); | 2272 | QVERIFY(client); | ||
1287 | 2273 | | |||
1288 | // The skip-pager state should be still forced. | 2274 | // The skip-pager state should be still forced. | ||
1289 | QVERIFY(client->skipPager()); | 2275 | QVERIFY(client->skipPager()); | ||
1290 | 2276 | | |||
1291 | // Destroy the client. | 2277 | // Destroy the client. | ||
1292 | delete shellSurface; | 2278 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1293 | delete surface; | 2279 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1294 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2280 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1295 | } | 2281 | } | ||
1296 | 2282 | | |||
1297 | TEST_DATA(testSkipPagerApplyNow) | 2283 | TEST_DATA(testSkipPagerApplyNow) | ||
1298 | 2284 | | |||
1299 | void TestShellClientRules::testSkipPagerApplyNow() | 2285 | void TestShellClientRules::testSkipPagerApplyNow() | ||
1300 | { | 2286 | { | ||
1301 | // Create the test client. | 2287 | // Create the test client. | ||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 2329 | { | |||
1379 | // The client should be included on a pager now. | 2365 | // The client should be included on a pager now. | ||
1380 | QVERIFY(!client->skipPager()); | 2366 | QVERIFY(!client->skipPager()); | ||
1381 | 2367 | | |||
1382 | // Also, one can change that. | 2368 | // Also, one can change that. | ||
1383 | client->setSkipPager(true); | 2369 | client->setSkipPager(true); | ||
1384 | QVERIFY(client->skipPager()); | 2370 | QVERIFY(client->skipPager()); | ||
1385 | 2371 | | |||
1386 | // Destroy the client. | 2372 | // Destroy the client. | ||
1387 | delete shellSurface; | 2373 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1388 | delete surface; | 2374 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1389 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2375 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1390 | } | 2376 | } | ||
1391 | 2377 | | |||
1392 | TEST_DATA(testSkipSwitcherDontAffect) | 2378 | TEST_DATA(testSkipSwitcherDontAffect) | ||
1393 | 2379 | | |||
1394 | void TestShellClientRules::testSkipSwitcherDontAffect() | 2380 | void TestShellClientRules::testSkipSwitcherDontAffect() | ||
1395 | { | 2381 | { | ||
1396 | // Set the test rule. | 2382 | // Set the test rule. | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 2415 | { | |||
1459 | delete shellSurface; | 2445 | delete shellSurface; | ||
1460 | delete surface; | 2446 | delete surface; | ||
1461 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2447 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1462 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2448 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1463 | QVERIFY(client); | 2449 | QVERIFY(client); | ||
1464 | QVERIFY(client->skipSwitcher()); | 2450 | QVERIFY(client->skipSwitcher()); | ||
1465 | 2451 | | |||
1466 | // Destroy the client. | 2452 | // Destroy the client. | ||
1467 | delete shellSurface; | 2453 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1468 | delete surface; | 2454 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1469 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2455 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1470 | } | 2456 | } | ||
1471 | 2457 | | |||
1472 | TEST_DATA(testSkipSwitcherRemember) | 2458 | TEST_DATA(testSkipSwitcherRemember) | ||
1473 | 2459 | | |||
1474 | void TestShellClientRules::testSkipSwitcherRemember() | 2460 | void TestShellClientRules::testSkipSwitcherRemember() | ||
1475 | { | 2461 | { | ||
1476 | // Set the test rule. | 2462 | // Set the test rule. | ||
Show All 30 Lines | |||||
1507 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2493 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1508 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2494 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1509 | QVERIFY(client); | 2495 | QVERIFY(client); | ||
1510 | 2496 | | |||
1511 | // The client should be included in window switching effects. | 2497 | // The client should be included in window switching effects. | ||
1512 | QVERIFY(!client->skipSwitcher()); | 2498 | QVERIFY(!client->skipSwitcher()); | ||
1513 | 2499 | | |||
1514 | // Destroy the client. | 2500 | // Destroy the client. | ||
1515 | delete shellSurface; | 2501 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1516 | delete surface; | 2502 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1517 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2503 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1518 | } | 2504 | } | ||
1519 | 2505 | | |||
1520 | TEST_DATA(testSkipSwitcherForce) | 2506 | TEST_DATA(testSkipSwitcherForce) | ||
1521 | 2507 | | |||
1522 | void TestShellClientRules::testSkipSwitcherForce() | 2508 | void TestShellClientRules::testSkipSwitcherForce() | ||
1523 | { | 2509 | { | ||
1524 | // Set the test rule. | 2510 | // Set the test rule. | ||
Show All 30 Lines | |||||
1555 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2541 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1556 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2542 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1557 | QVERIFY(client); | 2543 | QVERIFY(client); | ||
1558 | 2544 | | |||
1559 | // The skip-switcher state should be still forced. | 2545 | // The skip-switcher state should be still forced. | ||
1560 | QVERIFY(client->skipSwitcher()); | 2546 | QVERIFY(client->skipSwitcher()); | ||
1561 | 2547 | | |||
1562 | // Destroy the client. | 2548 | // Destroy the client. | ||
1563 | delete shellSurface; | 2549 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1564 | delete surface; | 2550 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1565 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2551 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1566 | } | 2552 | } | ||
1567 | 2553 | | |||
1568 | TEST_DATA(testSkipSwitcherApplyNow) | 2554 | TEST_DATA(testSkipSwitcherApplyNow) | ||
1569 | 2555 | | |||
1570 | void TestShellClientRules::testSkipSwitcherApplyNow() | 2556 | void TestShellClientRules::testSkipSwitcherApplyNow() | ||
1571 | { | 2557 | { | ||
1572 | // Create the test client. | 2558 | // Create the test client. | ||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 2600 | { | |||
1650 | // The client should be included in window switching effects now. | 2636 | // The client should be included in window switching effects now. | ||
1651 | QVERIFY(!client->skipSwitcher()); | 2637 | QVERIFY(!client->skipSwitcher()); | ||
1652 | 2638 | | |||
1653 | // Also, one can change that. | 2639 | // Also, one can change that. | ||
1654 | client->setSkipSwitcher(true); | 2640 | client->setSkipSwitcher(true); | ||
1655 | QVERIFY(client->skipSwitcher()); | 2641 | QVERIFY(client->skipSwitcher()); | ||
1656 | 2642 | | |||
1657 | // Destroy the client. | 2643 | // Destroy the client. | ||
1658 | delete shellSurface; | 2644 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1659 | delete surface; | 2645 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1660 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2646 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1661 | } | 2647 | } | ||
1662 | 2648 | | |||
1663 | TEST_DATA(testKeepAboveDontAffect) | 2649 | TEST_DATA(testKeepAboveDontAffect) | ||
1664 | 2650 | | |||
1665 | void TestShellClientRules::testKeepAboveDontAffect() | 2651 | void TestShellClientRules::testKeepAboveDontAffect() | ||
1666 | { | 2652 | { | ||
1667 | // Set the test rule. | 2653 | // Set the test rule. | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 2686 | { | |||
1730 | delete shellSurface; | 2716 | delete shellSurface; | ||
1731 | delete surface; | 2717 | delete surface; | ||
1732 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2718 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1733 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2719 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1734 | QVERIFY(client); | 2720 | QVERIFY(client); | ||
1735 | QVERIFY(client->keepAbove()); | 2721 | QVERIFY(client->keepAbove()); | ||
1736 | 2722 | | |||
1737 | // Destroy the client. | 2723 | // Destroy the client. | ||
1738 | delete shellSurface; | 2724 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1739 | delete surface; | 2725 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1740 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2726 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1741 | } | 2727 | } | ||
1742 | 2728 | | |||
1743 | TEST_DATA(testKeepAboveRemember) | 2729 | TEST_DATA(testKeepAboveRemember) | ||
1744 | 2730 | | |||
1745 | void TestShellClientRules::testKeepAboveRemember() | 2731 | void TestShellClientRules::testKeepAboveRemember() | ||
1746 | { | 2732 | { | ||
1747 | // Set the test rule. | 2733 | // Set the test rule. | ||
Show All 28 Lines | |||||
1776 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2762 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1777 | 2763 | | |||
1778 | // Re-open the client, it should not be kept above. | 2764 | // Re-open the client, it should not be kept above. | ||
1779 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2765 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1780 | QVERIFY(client); | 2766 | QVERIFY(client); | ||
1781 | QVERIFY(!client->keepAbove()); | 2767 | QVERIFY(!client->keepAbove()); | ||
1782 | 2768 | | |||
1783 | // Destroy the client. | 2769 | // Destroy the client. | ||
1784 | delete shellSurface; | 2770 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1785 | delete surface; | 2771 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1786 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2772 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1787 | } | 2773 | } | ||
1788 | 2774 | | |||
1789 | TEST_DATA(testKeepAboveForce) | 2775 | TEST_DATA(testKeepAboveForce) | ||
1790 | 2776 | | |||
1791 | void TestShellClientRules::testKeepAboveForce() | 2777 | void TestShellClientRules::testKeepAboveForce() | ||
1792 | { | 2778 | { | ||
1793 | // Set the test rule. | 2779 | // Set the test rule. | ||
Show All 28 Lines | |||||
1822 | delete shellSurface; | 2808 | delete shellSurface; | ||
1823 | delete surface; | 2809 | delete surface; | ||
1824 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2810 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1825 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2811 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1826 | QVERIFY(client); | 2812 | QVERIFY(client); | ||
1827 | QVERIFY(client->keepAbove()); | 2813 | QVERIFY(client->keepAbove()); | ||
1828 | 2814 | | |||
1829 | // Destroy the client. | 2815 | // Destroy the client. | ||
1830 | delete shellSurface; | 2816 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1831 | delete surface; | 2817 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1832 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2818 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1833 | } | 2819 | } | ||
1834 | 2820 | | |||
1835 | TEST_DATA(testKeepAboveApplyNow) | 2821 | TEST_DATA(testKeepAboveApplyNow) | ||
1836 | 2822 | | |||
1837 | void TestShellClientRules::testKeepAboveApplyNow() | 2823 | void TestShellClientRules::testKeepAboveApplyNow() | ||
1838 | { | 2824 | { | ||
1839 | // Create the test client. | 2825 | // Create the test client. | ||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Line(s) | 2867 | { | |||
1919 | 2905 | | |||
1920 | // We should now be able to alter the keep-above state. | 2906 | // We should now be able to alter the keep-above state. | ||
1921 | client->setKeepAbove(true); | 2907 | client->setKeepAbove(true); | ||
1922 | QVERIFY(client->keepAbove()); | 2908 | QVERIFY(client->keepAbove()); | ||
1923 | client->setKeepAbove(false); | 2909 | client->setKeepAbove(false); | ||
1924 | QVERIFY(!client->keepAbove()); | 2910 | QVERIFY(!client->keepAbove()); | ||
1925 | 2911 | | |||
1926 | // Destroy the client. | 2912 | // Destroy the client. | ||
1927 | delete shellSurface; | 2913 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1928 | delete surface; | 2914 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1929 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2915 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1930 | } | 2916 | } | ||
1931 | 2917 | | |||
1932 | TEST_DATA(testKeepBelowDontAffect) | 2918 | TEST_DATA(testKeepBelowDontAffect) | ||
1933 | 2919 | | |||
1934 | void TestShellClientRules::testKeepBelowDontAffect() | 2920 | void TestShellClientRules::testKeepBelowDontAffect() | ||
1935 | { | 2921 | { | ||
1936 | // Set the test rule. | 2922 | // Set the test rule. | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 2955 | { | |||
1999 | delete shellSurface; | 2985 | delete shellSurface; | ||
2000 | delete surface; | 2986 | delete surface; | ||
2001 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2987 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2002 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2988 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2003 | QVERIFY(client); | 2989 | QVERIFY(client); | ||
2004 | QVERIFY(client->keepBelow()); | 2990 | QVERIFY(client->keepBelow()); | ||
2005 | 2991 | | |||
2006 | // Destroy the client. | 2992 | // Destroy the client. | ||
2007 | delete shellSurface; | 2993 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2008 | delete surface; | 2994 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2009 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2995 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2010 | } | 2996 | } | ||
2011 | 2997 | | |||
2012 | TEST_DATA(testKeepBelowRemember) | 2998 | TEST_DATA(testKeepBelowRemember) | ||
2013 | 2999 | | |||
2014 | void TestShellClientRules::testKeepBelowRemember() | 3000 | void TestShellClientRules::testKeepBelowRemember() | ||
2015 | { | 3001 | { | ||
2016 | // Set the test rule. | 3002 | // Set the test rule. | ||
Show All 28 Lines | |||||
2045 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3031 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2046 | 3032 | | |||
2047 | // Re-open the client, it should not be kept below. | 3033 | // Re-open the client, it should not be kept below. | ||
2048 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3034 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2049 | QVERIFY(client); | 3035 | QVERIFY(client); | ||
2050 | QVERIFY(!client->keepBelow()); | 3036 | QVERIFY(!client->keepBelow()); | ||
2051 | 3037 | | |||
2052 | // Destroy the client. | 3038 | // Destroy the client. | ||
2053 | delete shellSurface; | 3039 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2054 | delete surface; | 3040 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2055 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3041 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2056 | } | 3042 | } | ||
2057 | 3043 | | |||
2058 | TEST_DATA(testKeepBelowForce) | 3044 | TEST_DATA(testKeepBelowForce) | ||
2059 | 3045 | | |||
2060 | void TestShellClientRules::testKeepBelowForce() | 3046 | void TestShellClientRules::testKeepBelowForce() | ||
2061 | { | 3047 | { | ||
2062 | // Set the test rule. | 3048 | // Set the test rule. | ||
Show All 28 Lines | |||||
2091 | delete shellSurface; | 3077 | delete shellSurface; | ||
2092 | delete surface; | 3078 | delete surface; | ||
2093 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3079 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2094 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3080 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2095 | QVERIFY(client); | 3081 | QVERIFY(client); | ||
2096 | QVERIFY(client->keepBelow()); | 3082 | QVERIFY(client->keepBelow()); | ||
2097 | 3083 | | |||
2098 | // Destroy the client. | 3084 | // Destroy the client. | ||
2099 | delete shellSurface; | 3085 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2100 | delete surface; | 3086 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2101 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3087 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2102 | } | 3088 | } | ||
2103 | 3089 | | |||
2104 | TEST_DATA(testKeepBelowApplyNow) | 3090 | TEST_DATA(testKeepBelowApplyNow) | ||
2105 | 3091 | | |||
2106 | void TestShellClientRules::testKeepBelowApplyNow() | 3092 | void TestShellClientRules::testKeepBelowApplyNow() | ||
2107 | { | 3093 | { | ||
2108 | // Create the test client. | 3094 | // Create the test client. | ||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Line(s) | 3136 | { | |||
2188 | 3174 | | |||
2189 | // We should now be able to alter the keep-below state. | 3175 | // We should now be able to alter the keep-below state. | ||
2190 | client->setKeepBelow(true); | 3176 | client->setKeepBelow(true); | ||
2191 | QVERIFY(client->keepBelow()); | 3177 | QVERIFY(client->keepBelow()); | ||
2192 | client->setKeepBelow(false); | 3178 | client->setKeepBelow(false); | ||
2193 | QVERIFY(!client->keepBelow()); | 3179 | QVERIFY(!client->keepBelow()); | ||
2194 | 3180 | | |||
2195 | // Destroy the client. | 3181 | // Destroy the client. | ||
2196 | delete shellSurface; | 3182 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2197 | delete surface; | 3183 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2198 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3184 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2199 | } | 3185 | } | ||
2200 | 3186 | | |||
2201 | TEST_DATA(testShortcutDontAffect) | 3187 | TEST_DATA(testShortcutDontAffect) | ||
2202 | 3188 | | |||
2203 | void TestShellClientRules::testShortcutDontAffect() | 3189 | void TestShellClientRules::testShortcutDontAffect() | ||
2204 | { | 3190 | { | ||
2205 | // Set the test rule. | 3191 | // Set the test rule. | ||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Line(s) | 3237 | { | |||
2318 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3304 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2319 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3305 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2320 | QVERIFY(client); | 3306 | QVERIFY(client); | ||
2321 | 3307 | | |||
2322 | // The window shortcut should be set back to Ctrl+Alt+1. | 3308 | // The window shortcut should be set back to Ctrl+Alt+1. | ||
2323 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | 3309 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | ||
2324 | 3310 | | |||
2325 | // Destroy the client. | 3311 | // Destroy the client. | ||
2326 | delete shellSurface; | 3312 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2327 | delete surface; | 3313 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2328 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3314 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2329 | } | 3315 | } | ||
2330 | 3316 | | |||
2331 | TEST_DATA(testShortcutRemember) | 3317 | TEST_DATA(testShortcutRemember) | ||
2332 | 3318 | | |||
2333 | void TestShellClientRules::testShortcutRemember() | 3319 | void TestShellClientRules::testShortcutRemember() | ||
2334 | { | 3320 | { | ||
2335 | QSKIP("KWin core doesn't try to save the last used window shortcut"); | 3321 | QSKIP("KWin core doesn't try to save the last used window shortcut"); | ||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | |||||
2391 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3377 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2392 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3378 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2393 | QVERIFY(client); | 3379 | QVERIFY(client); | ||
2394 | 3380 | | |||
2395 | // The window shortcut should be set to the last known value. | 3381 | // The window shortcut should be set to the last known value. | ||
2396 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_2})); | 3382 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_2})); | ||
2397 | 3383 | | |||
2398 | // Destroy the client. | 3384 | // Destroy the client. | ||
2399 | delete shellSurface; | 3385 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2400 | delete surface; | 3386 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2401 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3387 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2402 | } | 3388 | } | ||
2403 | 3389 | | |||
2404 | TEST_DATA(testShortcutForce) | 3390 | TEST_DATA(testShortcutForce) | ||
2405 | 3391 | | |||
2406 | void TestShellClientRules::testShortcutForce() | 3392 | void TestShellClientRules::testShortcutForce() | ||
2407 | { | 3393 | { | ||
2408 | QSKIP("KWin core can't release forced window shortcuts"); | 3394 | QSKIP("KWin core can't release forced window shortcuts"); | ||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | |||||
2464 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3450 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2465 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3451 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2466 | QVERIFY(client); | 3452 | QVERIFY(client); | ||
2467 | 3453 | | |||
2468 | // The window shortcut should still be forced. | 3454 | // The window shortcut should still be forced. | ||
2469 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | 3455 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | ||
2470 | 3456 | | |||
2471 | // Destroy the client. | 3457 | // Destroy the client. | ||
2472 | delete shellSurface; | 3458 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2473 | delete surface; | 3459 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2474 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3460 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2475 | } | 3461 | } | ||
2476 | 3462 | | |||
2477 | TEST_DATA(testShortcutApplyNow) | 3463 | TEST_DATA(testShortcutApplyNow) | ||
2478 | 3464 | | |||
2479 | void TestShellClientRules::testShortcutApplyNow() | 3465 | void TestShellClientRules::testShortcutApplyNow() | ||
2480 | { | 3466 | { | ||
2481 | // Create the test client. | 3467 | // Create the test client. | ||
▲ Show 20 Lines • Show All 121 Lines • ▼ Show 20 Line(s) | 3532 | { | |||
2603 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3589 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2604 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3590 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2605 | QVERIFY(client); | 3591 | QVERIFY(client); | ||
2606 | 3592 | | |||
2607 | // The window shortcut should no longer be forced. | 3593 | // The window shortcut should no longer be forced. | ||
2608 | QVERIFY(client->shortcut().isEmpty()); | 3594 | QVERIFY(client->shortcut().isEmpty()); | ||
2609 | 3595 | | |||
2610 | // Destroy the client. | 3596 | // Destroy the client. | ||
2611 | delete shellSurface; | 3597 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2612 | delete surface; | 3598 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2613 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3599 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2614 | } | 3600 | } | ||
2615 | 3601 | | |||
2616 | TEST_DATA(testDesktopFileDontAffect) | 3602 | TEST_DATA(testDesktopFileDontAffect) | ||
2617 | 3603 | | |||
2618 | void TestShellClientRules::testDesktopFileDontAffect() | 3604 | void TestShellClientRules::testDesktopFileDontAffect() | ||
2619 | { | 3605 | { | ||
2620 | // Currently, the desktop file name is derived from the app id. If the app id is | 3606 | // Currently, the desktop file name is derived from the app id. If the app id is | ||
▲ Show 20 Lines • Show All 154 Lines • ▼ Show 20 Line(s) | 3733 | { | |||
2775 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3761 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2776 | QVERIFY(client); | 3762 | QVERIFY(client); | ||
2777 | QVERIFY(client->isActive()); | 3763 | QVERIFY(client->isActive()); | ||
2778 | 3764 | | |||
2779 | // The opacity is no longer forced. | 3765 | // The opacity is no longer forced. | ||
2780 | QCOMPARE(client->opacity(), 1.0); | 3766 | QCOMPARE(client->opacity(), 1.0); | ||
2781 | 3767 | | |||
2782 | // Destroy the client. | 3768 | // Destroy the client. | ||
2783 | delete shellSurface; | 3769 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2784 | delete surface; | 3770 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2785 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3771 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2786 | } | 3772 | } | ||
2787 | 3773 | | |||
2788 | TEST_DATA(testInactiveOpacityDontAffect) | 3774 | TEST_DATA(testInactiveOpacityDontAffect) | ||
2789 | 3775 | | |||
2790 | void TestShellClientRules::testInactiveOpacityDontAffect() | 3776 | void TestShellClientRules::testInactiveOpacityDontAffect() | ||
2791 | { | 3777 | { | ||
2792 | // Set the test rule. | 3778 | // Set the test rule. | ||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Line(s) | 3856 | { | |||
2909 | // Make the client inactive. | 3895 | // Make the client inactive. | ||
2910 | workspace()->setActiveClient(nullptr); | 3896 | workspace()->setActiveClient(nullptr); | ||
2911 | QVERIFY(!client->isActive()); | 3897 | QVERIFY(!client->isActive()); | ||
2912 | 3898 | | |||
2913 | // The opacity is no longer forced. | 3899 | // The opacity is no longer forced. | ||
2914 | QCOMPARE(client->opacity(), 1.0); | 3900 | QCOMPARE(client->opacity(), 1.0); | ||
2915 | 3901 | | |||
2916 | // Destroy the client. | 3902 | // Destroy the client. | ||
2917 | delete shellSurface; | 3903 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2918 | delete surface; | 3904 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2919 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3905 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2920 | } | 3906 | } | ||
2921 | 3907 | | |||
2922 | void TestShellClientRules::testMatchAfterNameChange() | 3908 | void TestShellClientRules::testMatchAfterNameChange() | ||
2923 | { | 3909 | { | ||
2924 | KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3910 | KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2925 | config->group("General").writeEntry("count", 1); | 3911 | config->group("General").writeEntry("count", 1); | ||
2926 | 3912 | | |||
Show All 29 Lines |
Memory pointed to by 'shellSurface' is freed twice.