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