Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/shell_client_rules_test.cpp
Show First 20 Lines • Show All 259 Lines • ▼ Show 20 Line(s) | 253 | { | |||
---|---|---|---|---|---|
260 | // Restore virtual desktops to the initial state. | 260 | // Restore virtual desktops to the initial state. | ||
261 | VirtualDesktopManager::self()->setCount(1); | 261 | VirtualDesktopManager::self()->setCount(1); | ||
262 | QCOMPARE(VirtualDesktopManager::self()->count(), 1u); | 262 | QCOMPARE(VirtualDesktopManager::self()->count(), 1u); | ||
263 | } | 263 | } | ||
264 | 264 | | |||
265 | #define TEST_DATA(name) \ | 265 | #define TEST_DATA(name) \ | ||
266 | void TestShellClientRules::name##_data() \ | 266 | void TestShellClientRules::name##_data() \ | ||
267 | { \ | 267 | { \ | ||
268 | QTest::addColumn<Test::ShellSurfaceType>("type"); \ | 268 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); \ | ||
269 | QTest::newRow("XdgShellV5") << Test::ShellSurfaceType::XdgShellV5; \ | 269 | QTest::newRow("XdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; \ | ||
270 | QTest::newRow("XdgShellV6") << Test::ShellSurfaceType::XdgShellV6; \ | 270 | QTest::newRow("XdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; \ | ||
271 | QTest::newRow("XdgWmBase") << Test::ShellSurfaceType::XdgShellStable; \ | 271 | QTest::newRow("XdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; \ | ||
272 | } | 272 | } | ||
273 | 273 | | |||
274 | std::tuple<ShellClient *, Surface *, XdgShellSurface *> createWindow(Test::ShellSurfaceType type, const QByteArray &appId) | 274 | std::tuple<ShellClient *, Surface *, XdgShellSurface *> createWindow(Test::XdgShellSurfaceType type, const QByteArray &appId) | ||
275 | { | 275 | { | ||
276 | // Create an xdg surface. | 276 | // Create an xdg surface. | ||
277 | Surface *surface = Test::createSurface(); | 277 | Surface *surface = Test::createSurface(); | ||
278 | XdgShellSurface *shellSurface = Test::createXdgShellSurface(type, surface, surface, Test::CreationSetup::CreateOnly); | 278 | XdgShellSurface *shellSurface = Test::createXdgShellSurface(type, surface, surface, Test::CreationSetup::CreateOnly); | ||
279 | 279 | | |||
280 | // Assign the desired app id. | 280 | // Assign the desired app id. | ||
281 | shellSurface->setAppId(appId); | 281 | shellSurface->setAppId(appId); | ||
282 | 282 | | |||
Show All 22 Lines | 298 | { | |||
305 | group.writeEntry("wmclass", "org.kde.foo"); | 305 | group.writeEntry("wmclass", "org.kde.foo"); | ||
306 | group.writeEntry("wmclasscomplete", false); | 306 | group.writeEntry("wmclasscomplete", false); | ||
307 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 307 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
308 | group.sync(); | 308 | group.sync(); | ||
309 | RuleBook::self()->setConfig(config); | 309 | RuleBook::self()->setConfig(config); | ||
310 | workspace()->slotReconfigure(); | 310 | workspace()->slotReconfigure(); | ||
311 | 311 | | |||
312 | // Create the test client. | 312 | // Create the test client. | ||
313 | QFETCH(Test::ShellSurfaceType, type); | 313 | QFETCH(Test::XdgShellSurfaceType, type); | ||
314 | ShellClient *client; | 314 | ShellClient *client; | ||
315 | Surface *surface; | 315 | Surface *surface; | ||
316 | XdgShellSurface *shellSurface; | 316 | XdgShellSurface *shellSurface; | ||
317 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 317 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
318 | QVERIFY(client); | 318 | QVERIFY(client); | ||
319 | QVERIFY(client->isActive()); | 319 | QVERIFY(client->isActive()); | ||
320 | 320 | | |||
321 | // The position of the client should not be affected by the rule. The default | 321 | // The position of the client should not be affected by the rule. The default | ||
Show All 21 Lines | 336 | { | |||
343 | group.writeEntry("wmclass", "org.kde.foo"); | 343 | group.writeEntry("wmclass", "org.kde.foo"); | ||
344 | group.writeEntry("wmclasscomplete", false); | 344 | group.writeEntry("wmclasscomplete", false); | ||
345 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 345 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
346 | group.sync(); | 346 | group.sync(); | ||
347 | RuleBook::self()->setConfig(config); | 347 | RuleBook::self()->setConfig(config); | ||
348 | workspace()->slotReconfigure(); | 348 | workspace()->slotReconfigure(); | ||
349 | 349 | | |||
350 | // Create the test client. | 350 | // Create the test client. | ||
351 | QFETCH(Test::ShellSurfaceType, type); | 351 | QFETCH(Test::XdgShellSurfaceType, type); | ||
352 | ShellClient *client; | 352 | ShellClient *client; | ||
353 | Surface *surface; | 353 | Surface *surface; | ||
354 | XdgShellSurface *shellSurface; | 354 | XdgShellSurface *shellSurface; | ||
355 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 355 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
356 | QVERIFY(client); | 356 | QVERIFY(client); | ||
357 | QVERIFY(client->isActive()); | 357 | QVERIFY(client->isActive()); | ||
358 | 358 | | |||
359 | // The client should be moved to the position specified by the rule. | 359 | // The client should be moved to the position specified by the rule. | ||
Show All 39 Lines | |||||
399 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 399 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
400 | QVERIFY(client); | 400 | QVERIFY(client); | ||
401 | QVERIFY(client->isActive()); | 401 | QVERIFY(client->isActive()); | ||
402 | QVERIFY(client->isMovable()); | 402 | QVERIFY(client->isMovable()); | ||
403 | QVERIFY(client->isMovableAcrossScreens()); | 403 | QVERIFY(client->isMovableAcrossScreens()); | ||
404 | QCOMPARE(client->pos(), QPoint(42, 42)); | 404 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||
405 | 405 | | |||
406 | // Destroy the client. | 406 | // Destroy the client. | ||
407 | delete shellSurface; | 407 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
408 | delete surface; | 408 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
409 | QVERIFY(Test::waitForWindowDestroyed(client)); | 409 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
410 | } | 410 | } | ||
411 | 411 | | |||
412 | TEST_DATA(testPositionRemember) | 412 | TEST_DATA(testPositionRemember) | ||
413 | 413 | | |||
414 | void TestShellClientRules::testPositionRemember() | 414 | void TestShellClientRules::testPositionRemember() | ||
415 | { | 415 | { | ||
416 | // Initialize RuleBook with the test rule. | 416 | // Initialize RuleBook with the test rule. | ||
417 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 417 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
418 | config->group("General").writeEntry("count", 1); | 418 | config->group("General").writeEntry("count", 1); | ||
419 | KConfigGroup group = config->group("1"); | 419 | KConfigGroup group = config->group("1"); | ||
420 | group.writeEntry("position", QPoint(42, 42)); | 420 | group.writeEntry("position", QPoint(42, 42)); | ||
421 | group.writeEntry("positionrule", int(Rules::Remember)); | 421 | group.writeEntry("positionrule", int(Rules::Remember)); | ||
422 | group.writeEntry("wmclass", "org.kde.foo"); | 422 | group.writeEntry("wmclass", "org.kde.foo"); | ||
423 | group.writeEntry("wmclasscomplete", false); | 423 | group.writeEntry("wmclasscomplete", false); | ||
424 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 424 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
425 | group.sync(); | 425 | group.sync(); | ||
426 | RuleBook::self()->setConfig(config); | 426 | RuleBook::self()->setConfig(config); | ||
427 | workspace()->slotReconfigure(); | 427 | workspace()->slotReconfigure(); | ||
428 | 428 | | |||
429 | // Create the test client. | 429 | // Create the test client. | ||
430 | QFETCH(Test::ShellSurfaceType, type); | 430 | QFETCH(Test::XdgShellSurfaceType, type); | ||
431 | ShellClient *client; | 431 | ShellClient *client; | ||
432 | Surface *surface; | 432 | Surface *surface; | ||
433 | XdgShellSurface *shellSurface; | 433 | XdgShellSurface *shellSurface; | ||
434 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 434 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
435 | QVERIFY(client); | 435 | QVERIFY(client); | ||
436 | QVERIFY(client->isActive()); | 436 | QVERIFY(client->isActive()); | ||
437 | 437 | | |||
438 | // The client should be moved to the position specified by the rule. | 438 | // The client should be moved to the position specified by the rule. | ||
Show All 39 Lines | |||||
478 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 478 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
479 | QVERIFY(client); | 479 | QVERIFY(client); | ||
480 | QVERIFY(client->isActive()); | 480 | QVERIFY(client->isActive()); | ||
481 | QVERIFY(client->isMovable()); | 481 | QVERIFY(client->isMovable()); | ||
482 | QVERIFY(client->isMovableAcrossScreens()); | 482 | QVERIFY(client->isMovableAcrossScreens()); | ||
483 | QCOMPARE(client->pos(), QPoint(50, 42)); | 483 | QCOMPARE(client->pos(), QPoint(50, 42)); | ||
484 | 484 | | |||
485 | // Destroy the client. | 485 | // Destroy the client. | ||
486 | delete shellSurface; | 486 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
487 | delete surface; | 487 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
488 | QVERIFY(Test::waitForWindowDestroyed(client)); | 488 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
489 | } | 489 | } | ||
490 | 490 | | |||
491 | TEST_DATA(testPositionForce) | 491 | TEST_DATA(testPositionForce) | ||
492 | 492 | | |||
493 | void TestShellClientRules::testPositionForce() | 493 | void TestShellClientRules::testPositionForce() | ||
494 | { | 494 | { | ||
495 | // Initialize RuleBook with the test rule. | 495 | // Initialize RuleBook with the test rule. | ||
496 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 496 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
497 | config->group("General").writeEntry("count", 1); | 497 | config->group("General").writeEntry("count", 1); | ||
498 | KConfigGroup group = config->group("1"); | 498 | KConfigGroup group = config->group("1"); | ||
499 | group.writeEntry("position", QPoint(42, 42)); | 499 | group.writeEntry("position", QPoint(42, 42)); | ||
500 | group.writeEntry("positionrule", int(Rules::Force)); | 500 | group.writeEntry("positionrule", int(Rules::Force)); | ||
501 | group.writeEntry("wmclass", "org.kde.foo"); | 501 | group.writeEntry("wmclass", "org.kde.foo"); | ||
502 | group.writeEntry("wmclasscomplete", false); | 502 | group.writeEntry("wmclasscomplete", false); | ||
503 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 503 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
504 | group.sync(); | 504 | group.sync(); | ||
505 | RuleBook::self()->setConfig(config); | 505 | RuleBook::self()->setConfig(config); | ||
506 | workspace()->slotReconfigure(); | 506 | workspace()->slotReconfigure(); | ||
507 | 507 | | |||
508 | // Create the test client. | 508 | // Create the test client. | ||
509 | QFETCH(Test::ShellSurfaceType, type); | 509 | QFETCH(Test::XdgShellSurfaceType, type); | ||
510 | ShellClient *client; | 510 | ShellClient *client; | ||
511 | Surface *surface; | 511 | Surface *surface; | ||
512 | XdgShellSurface *shellSurface; | 512 | XdgShellSurface *shellSurface; | ||
513 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 513 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
514 | QVERIFY(client); | 514 | QVERIFY(client); | ||
515 | QVERIFY(client->isActive()); | 515 | QVERIFY(client->isActive()); | ||
516 | 516 | | |||
517 | // The client should be moved to the position specified by the rule. | 517 | // The client should be moved to the position specified by the rule. | ||
Show All 20 Lines | |||||
538 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 538 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
539 | QVERIFY(client); | 539 | QVERIFY(client); | ||
540 | QVERIFY(client->isActive()); | 540 | QVERIFY(client->isActive()); | ||
541 | QVERIFY(!client->isMovable()); | 541 | QVERIFY(!client->isMovable()); | ||
542 | QVERIFY(!client->isMovableAcrossScreens()); | 542 | QVERIFY(!client->isMovableAcrossScreens()); | ||
543 | QCOMPARE(client->pos(), QPoint(42, 42)); | 543 | QCOMPARE(client->pos(), QPoint(42, 42)); | ||
544 | 544 | | |||
545 | // Destroy the client. | 545 | // Destroy the client. | ||
546 | delete shellSurface; | 546 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
547 | delete surface; | 547 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
548 | QVERIFY(Test::waitForWindowDestroyed(client)); | 548 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
549 | } | 549 | } | ||
550 | 550 | | |||
551 | TEST_DATA(testPositionApplyNow) | 551 | TEST_DATA(testPositionApplyNow) | ||
552 | 552 | | |||
553 | void TestShellClientRules::testPositionApplyNow() | 553 | void TestShellClientRules::testPositionApplyNow() | ||
554 | { | 554 | { | ||
555 | // Create the test client. | 555 | // Create the test client. | ||
556 | QFETCH(Test::ShellSurfaceType, type); | 556 | QFETCH(Test::XdgShellSurfaceType, type); | ||
557 | ShellClient *client; | 557 | ShellClient *client; | ||
558 | Surface *surface; | 558 | Surface *surface; | ||
559 | QObject *shellSurface; | 559 | QObject *shellSurface; | ||
560 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 560 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
561 | QVERIFY(client); | 561 | QVERIFY(client); | ||
562 | QVERIFY(client->isActive()); | 562 | QVERIFY(client->isActive()); | ||
563 | 563 | | |||
564 | // The position of the client isn't set by any rule, thus the default placement | 564 | // The position of the client isn't set by any rule, thus the default placement | ||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 635 | { | |||
642 | group.writeEntry("wmclass", "org.kde.foo"); | 642 | group.writeEntry("wmclass", "org.kde.foo"); | ||
643 | group.writeEntry("wmclasscomplete", false); | 643 | group.writeEntry("wmclasscomplete", false); | ||
644 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 644 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
645 | group.sync(); | 645 | group.sync(); | ||
646 | RuleBook::self()->setConfig(config); | 646 | RuleBook::self()->setConfig(config); | ||
647 | workspace()->slotReconfigure(); | 647 | workspace()->slotReconfigure(); | ||
648 | 648 | | |||
649 | // Create the test client. | 649 | // Create the test client. | ||
650 | QFETCH(Test::ShellSurfaceType, type); | 650 | QFETCH(Test::XdgShellSurfaceType, type); | ||
651 | ShellClient *client; | 651 | ShellClient *client; | ||
652 | Surface *surface; | 652 | Surface *surface; | ||
653 | XdgShellSurface *shellSurface; | 653 | XdgShellSurface *shellSurface; | ||
654 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 654 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
655 | QVERIFY(client); | 655 | QVERIFY(client); | ||
656 | QVERIFY(client->isActive()); | 656 | QVERIFY(client->isActive()); | ||
657 | 657 | | |||
658 | // The client should be moved to the position specified by the rule. | 658 | // The client should be moved to the position specified by the rule. | ||
Show All 20 Lines | |||||
679 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 679 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
680 | QVERIFY(client); | 680 | QVERIFY(client); | ||
681 | QVERIFY(client->isActive()); | 681 | QVERIFY(client->isActive()); | ||
682 | QVERIFY(client->isMovable()); | 682 | QVERIFY(client->isMovable()); | ||
683 | QVERIFY(client->isMovableAcrossScreens()); | 683 | QVERIFY(client->isMovableAcrossScreens()); | ||
684 | QCOMPARE(client->pos(), QPoint(0, 0)); | 684 | QCOMPARE(client->pos(), QPoint(0, 0)); | ||
685 | 685 | | |||
686 | // Destroy the client. | 686 | // Destroy the client. | ||
687 | delete shellSurface; | 687 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
688 | delete surface; | 688 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
689 | QVERIFY(Test::waitForWindowDestroyed(client)); | 689 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
690 | } | 690 | } | ||
691 | 691 | | |||
692 | TEST_DATA(testSizeDontAffect) | 692 | TEST_DATA(testSizeDontAffect) | ||
693 | 693 | | |||
694 | void TestShellClientRules::testSizeDontAffect() | 694 | void TestShellClientRules::testSizeDontAffect() | ||
695 | { | 695 | { | ||
696 | // Initialize RuleBook with the test rule. | 696 | // Initialize RuleBook with the test rule. | ||
697 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 697 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
698 | config->group("General").writeEntry("count", 1); | 698 | config->group("General").writeEntry("count", 1); | ||
699 | KConfigGroup group = config->group("1"); | 699 | KConfigGroup group = config->group("1"); | ||
700 | group.writeEntry("size", QSize(480, 640)); | 700 | group.writeEntry("size", QSize(480, 640)); | ||
701 | group.writeEntry("sizerule", int(Rules::DontAffect)); | 701 | group.writeEntry("sizerule", int(Rules::DontAffect)); | ||
702 | group.writeEntry("wmclass", "org.kde.foo"); | 702 | group.writeEntry("wmclass", "org.kde.foo"); | ||
703 | group.writeEntry("wmclasscomplete", false); | 703 | group.writeEntry("wmclasscomplete", false); | ||
704 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 704 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
705 | group.sync(); | 705 | group.sync(); | ||
706 | RuleBook::self()->setConfig(config); | 706 | RuleBook::self()->setConfig(config); | ||
707 | workspace()->slotReconfigure(); | 707 | workspace()->slotReconfigure(); | ||
708 | 708 | | |||
709 | // Create the test client. | 709 | // Create the test client. | ||
710 | QFETCH(Test::ShellSurfaceType, type); | 710 | QFETCH(Test::XdgShellSurfaceType, type); | ||
711 | QScopedPointer<Surface> surface; | 711 | QScopedPointer<Surface> surface; | ||
712 | surface.reset(Test::createSurface()); | 712 | surface.reset(Test::createSurface()); | ||
713 | QScopedPointer<XdgShellSurface> shellSurface; | 713 | QScopedPointer<XdgShellSurface> shellSurface; | ||
714 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | 714 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||
715 | QScopedPointer<QSignalSpy> configureRequestedSpy; | 715 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||
716 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | 716 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||
717 | shellSurface->setAppId("org.kde.foo"); | 717 | shellSurface->setAppId("org.kde.foo"); | ||
718 | surface->commit(Surface::CommitFlag::None); | 718 | surface->commit(Surface::CommitFlag::None); | ||
Show All 34 Lines | 746 | { | |||
753 | group.writeEntry("wmclass", "org.kde.foo"); | 753 | group.writeEntry("wmclass", "org.kde.foo"); | ||
754 | group.writeEntry("wmclasscomplete", false); | 754 | group.writeEntry("wmclasscomplete", false); | ||
755 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 755 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
756 | group.sync(); | 756 | group.sync(); | ||
757 | RuleBook::self()->setConfig(config); | 757 | RuleBook::self()->setConfig(config); | ||
758 | workspace()->slotReconfigure(); | 758 | workspace()->slotReconfigure(); | ||
759 | 759 | | |||
760 | // Create the test client. | 760 | // Create the test client. | ||
761 | QFETCH(Test::ShellSurfaceType, type); | 761 | QFETCH(Test::XdgShellSurfaceType, type); | ||
762 | QScopedPointer<Surface> surface; | 762 | QScopedPointer<Surface> surface; | ||
763 | surface.reset(Test::createSurface()); | 763 | surface.reset(Test::createSurface()); | ||
764 | QScopedPointer<XdgShellSurface> shellSurface; | 764 | QScopedPointer<XdgShellSurface> shellSurface; | ||
765 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | 765 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||
766 | QScopedPointer<QSignalSpy> configureRequestedSpy; | 766 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||
767 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | 767 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||
768 | shellSurface->setAppId("org.kde.foo"); | 768 | shellSurface->setAppId("org.kde.foo"); | ||
769 | surface->commit(Surface::CommitFlag::None); | 769 | surface->commit(Surface::CommitFlag::None); | ||
▲ Show 20 Lines • Show All 121 Lines • ▼ Show 20 Line(s) | 884 | { | |||
891 | group.writeEntry("wmclass", "org.kde.foo"); | 891 | group.writeEntry("wmclass", "org.kde.foo"); | ||
892 | group.writeEntry("wmclasscomplete", false); | 892 | group.writeEntry("wmclasscomplete", false); | ||
893 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 893 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
894 | group.sync(); | 894 | group.sync(); | ||
895 | RuleBook::self()->setConfig(config); | 895 | RuleBook::self()->setConfig(config); | ||
896 | workspace()->slotReconfigure(); | 896 | workspace()->slotReconfigure(); | ||
897 | 897 | | |||
898 | // Create the test client. | 898 | // Create the test client. | ||
899 | QFETCH(Test::ShellSurfaceType, type); | 899 | QFETCH(Test::XdgShellSurfaceType, type); | ||
900 | QScopedPointer<Surface> surface; | 900 | QScopedPointer<Surface> surface; | ||
901 | surface.reset(Test::createSurface()); | 901 | surface.reset(Test::createSurface()); | ||
902 | QScopedPointer<XdgShellSurface> shellSurface; | 902 | QScopedPointer<XdgShellSurface> shellSurface; | ||
903 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | 903 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||
904 | QScopedPointer<QSignalSpy> configureRequestedSpy; | 904 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||
905 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | 905 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||
906 | shellSurface->setAppId("org.kde.foo"); | 906 | shellSurface->setAppId("org.kde.foo"); | ||
907 | surface->commit(Surface::CommitFlag::None); | 907 | surface->commit(Surface::CommitFlag::None); | ||
▲ Show 20 Lines • Show All 121 Lines • ▼ Show 20 Line(s) | 1022 | { | |||
1029 | group.writeEntry("wmclass", "org.kde.foo"); | 1029 | group.writeEntry("wmclass", "org.kde.foo"); | ||
1030 | group.writeEntry("wmclasscomplete", false); | 1030 | group.writeEntry("wmclasscomplete", false); | ||
1031 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 1031 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
1032 | group.sync(); | 1032 | group.sync(); | ||
1033 | RuleBook::self()->setConfig(config); | 1033 | RuleBook::self()->setConfig(config); | ||
1034 | workspace()->slotReconfigure(); | 1034 | workspace()->slotReconfigure(); | ||
1035 | 1035 | | |||
1036 | // Create the test client. | 1036 | // Create the test client. | ||
1037 | QFETCH(Test::ShellSurfaceType, type); | 1037 | QFETCH(Test::XdgShellSurfaceType, type); | ||
1038 | QScopedPointer<Surface> surface; | 1038 | QScopedPointer<Surface> surface; | ||
1039 | surface.reset(Test::createSurface()); | 1039 | surface.reset(Test::createSurface()); | ||
1040 | QScopedPointer<XdgShellSurface> shellSurface; | 1040 | QScopedPointer<XdgShellSurface> shellSurface; | ||
1041 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | 1041 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||
1042 | QScopedPointer<QSignalSpy> configureRequestedSpy; | 1042 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||
1043 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | 1043 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||
1044 | shellSurface->setAppId("org.kde.foo"); | 1044 | shellSurface->setAppId("org.kde.foo"); | ||
1045 | surface->commit(Surface::CommitFlag::None); | 1045 | surface->commit(Surface::CommitFlag::None); | ||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | |||||
1104 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1104 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1105 | } | 1105 | } | ||
1106 | 1106 | | |||
1107 | TEST_DATA(testSizeApplyNow) | 1107 | TEST_DATA(testSizeApplyNow) | ||
1108 | 1108 | | |||
1109 | void TestShellClientRules::testSizeApplyNow() | 1109 | void TestShellClientRules::testSizeApplyNow() | ||
1110 | { | 1110 | { | ||
1111 | // Create the test client. | 1111 | // Create the test client. | ||
1112 | QFETCH(Test::ShellSurfaceType, type); | 1112 | QFETCH(Test::XdgShellSurfaceType, type); | ||
1113 | QScopedPointer<Surface> surface; | 1113 | QScopedPointer<Surface> surface; | ||
1114 | surface.reset(Test::createSurface()); | 1114 | surface.reset(Test::createSurface()); | ||
1115 | QScopedPointer<XdgShellSurface> shellSurface; | 1115 | QScopedPointer<XdgShellSurface> shellSurface; | ||
1116 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | 1116 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||
1117 | QScopedPointer<QSignalSpy> configureRequestedSpy; | 1117 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||
1118 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | 1118 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||
1119 | shellSurface->setAppId("org.kde.foo"); | 1119 | shellSurface->setAppId("org.kde.foo"); | ||
1120 | surface->commit(Surface::CommitFlag::None); | 1120 | surface->commit(Surface::CommitFlag::None); | ||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 1179 | { | |||
1186 | group.writeEntry("wmclass", "org.kde.foo"); | 1186 | group.writeEntry("wmclass", "org.kde.foo"); | ||
1187 | group.writeEntry("wmclasscomplete", false); | 1187 | group.writeEntry("wmclasscomplete", false); | ||
1188 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 1188 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
1189 | group.sync(); | 1189 | group.sync(); | ||
1190 | RuleBook::self()->setConfig(config); | 1190 | RuleBook::self()->setConfig(config); | ||
1191 | workspace()->slotReconfigure(); | 1191 | workspace()->slotReconfigure(); | ||
1192 | 1192 | | |||
1193 | // Create the test client. | 1193 | // Create the test client. | ||
1194 | QFETCH(Test::ShellSurfaceType, type); | 1194 | QFETCH(Test::XdgShellSurfaceType, type); | ||
1195 | QScopedPointer<Surface> surface; | 1195 | QScopedPointer<Surface> surface; | ||
1196 | surface.reset(Test::createSurface()); | 1196 | surface.reset(Test::createSurface()); | ||
1197 | QScopedPointer<XdgShellSurface> shellSurface; | 1197 | QScopedPointer<XdgShellSurface> shellSurface; | ||
1198 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | 1198 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||
1199 | QScopedPointer<QSignalSpy> configureRequestedSpy; | 1199 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||
1200 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | 1200 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||
1201 | shellSurface->setAppId("org.kde.foo"); | 1201 | shellSurface->setAppId("org.kde.foo"); | ||
1202 | surface->commit(Surface::CommitFlag::None); | 1202 | surface->commit(Surface::CommitFlag::None); | ||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Line(s) | 1267 | { | |||
1276 | group.writeEntry("wmclass", "org.kde.foo"); | 1276 | group.writeEntry("wmclass", "org.kde.foo"); | ||
1277 | group.writeEntry("wmclasscomplete", false); | 1277 | group.writeEntry("wmclasscomplete", false); | ||
1278 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 1278 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
1279 | group.sync(); | 1279 | group.sync(); | ||
1280 | RuleBook::self()->setConfig(config); | 1280 | RuleBook::self()->setConfig(config); | ||
1281 | workspace()->slotReconfigure(); | 1281 | workspace()->slotReconfigure(); | ||
1282 | 1282 | | |||
1283 | // Create the test client. | 1283 | // Create the test client. | ||
1284 | QFETCH(Test::ShellSurfaceType, type); | 1284 | QFETCH(Test::XdgShellSurfaceType, type); | ||
1285 | QScopedPointer<Surface> surface; | 1285 | QScopedPointer<Surface> surface; | ||
1286 | surface.reset(Test::createSurface()); | 1286 | surface.reset(Test::createSurface()); | ||
1287 | QScopedPointer<XdgShellSurface> shellSurface; | 1287 | QScopedPointer<XdgShellSurface> shellSurface; | ||
1288 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | 1288 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||
1289 | QScopedPointer<QSignalSpy> configureRequestedSpy; | 1289 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||
1290 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | 1290 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||
1291 | shellSurface->setAppId("org.kde.foo"); | 1291 | shellSurface->setAppId("org.kde.foo"); | ||
1292 | surface->commit(Surface::CommitFlag::None); | 1292 | surface->commit(Surface::CommitFlag::None); | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 1329 | { | |||
1338 | group.writeEntry("wmclass", "org.kde.foo"); | 1338 | group.writeEntry("wmclass", "org.kde.foo"); | ||
1339 | group.writeEntry("wmclasscomplete", false); | 1339 | group.writeEntry("wmclasscomplete", false); | ||
1340 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 1340 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
1341 | group.sync(); | 1341 | group.sync(); | ||
1342 | RuleBook::self()->setConfig(config); | 1342 | RuleBook::self()->setConfig(config); | ||
1343 | workspace()->slotReconfigure(); | 1343 | workspace()->slotReconfigure(); | ||
1344 | 1344 | | |||
1345 | // Create the test client. | 1345 | // Create the test client. | ||
1346 | QFETCH(Test::ShellSurfaceType, type); | 1346 | QFETCH(Test::XdgShellSurfaceType, type); | ||
1347 | QScopedPointer<Surface> surface; | 1347 | QScopedPointer<Surface> surface; | ||
1348 | surface.reset(Test::createSurface()); | 1348 | surface.reset(Test::createSurface()); | ||
1349 | QScopedPointer<XdgShellSurface> shellSurface; | 1349 | QScopedPointer<XdgShellSurface> shellSurface; | ||
1350 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | 1350 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||
1351 | QScopedPointer<QSignalSpy> configureRequestedSpy; | 1351 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||
1352 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | 1352 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||
1353 | shellSurface->setAppId("org.kde.foo"); | 1353 | shellSurface->setAppId("org.kde.foo"); | ||
1354 | surface->commit(Surface::CommitFlag::None); | 1354 | surface->commit(Surface::CommitFlag::None); | ||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Line(s) | 1441 | { | |||
1450 | group.writeEntry("wmclass", "org.kde.foo"); | 1450 | group.writeEntry("wmclass", "org.kde.foo"); | ||
1451 | group.writeEntry("wmclasscomplete", false); | 1451 | group.writeEntry("wmclasscomplete", false); | ||
1452 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 1452 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
1453 | group.sync(); | 1453 | group.sync(); | ||
1454 | RuleBook::self()->setConfig(config); | 1454 | RuleBook::self()->setConfig(config); | ||
1455 | workspace()->slotReconfigure(); | 1455 | workspace()->slotReconfigure(); | ||
1456 | 1456 | | |||
1457 | // Create the test client. | 1457 | // Create the test client. | ||
1458 | QFETCH(Test::ShellSurfaceType, type); | 1458 | QFETCH(Test::XdgShellSurfaceType, type); | ||
1459 | QScopedPointer<Surface> surface; | 1459 | QScopedPointer<Surface> surface; | ||
1460 | surface.reset(Test::createSurface()); | 1460 | surface.reset(Test::createSurface()); | ||
1461 | QScopedPointer<XdgShellSurface> shellSurface; | 1461 | QScopedPointer<XdgShellSurface> shellSurface; | ||
1462 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | 1462 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||
1463 | QScopedPointer<QSignalSpy> configureRequestedSpy; | 1463 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||
1464 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | 1464 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||
1465 | shellSurface->setAppId("org.kde.foo"); | 1465 | shellSurface->setAppId("org.kde.foo"); | ||
1466 | surface->commit(Surface::CommitFlag::None); | 1466 | surface->commit(Surface::CommitFlag::None); | ||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Line(s) | 1553 | { | |||
1562 | group.writeEntry("wmclass", "org.kde.foo"); | 1562 | group.writeEntry("wmclass", "org.kde.foo"); | ||
1563 | group.writeEntry("wmclasscomplete", false); | 1563 | group.writeEntry("wmclasscomplete", false); | ||
1564 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 1564 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
1565 | group.sync(); | 1565 | group.sync(); | ||
1566 | RuleBook::self()->setConfig(config); | 1566 | RuleBook::self()->setConfig(config); | ||
1567 | workspace()->slotReconfigure(); | 1567 | workspace()->slotReconfigure(); | ||
1568 | 1568 | | |||
1569 | // Create the test client. | 1569 | // Create the test client. | ||
1570 | QFETCH(Test::ShellSurfaceType, type); | 1570 | QFETCH(Test::XdgShellSurfaceType, type); | ||
1571 | QScopedPointer<Surface> surface; | 1571 | QScopedPointer<Surface> surface; | ||
1572 | surface.reset(Test::createSurface()); | 1572 | surface.reset(Test::createSurface()); | ||
1573 | QScopedPointer<XdgShellSurface> shellSurface; | 1573 | QScopedPointer<XdgShellSurface> shellSurface; | ||
1574 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | 1574 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||
1575 | QScopedPointer<QSignalSpy> configureRequestedSpy; | 1575 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||
1576 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | 1576 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||
1577 | shellSurface->setAppId("org.kde.foo"); | 1577 | shellSurface->setAppId("org.kde.foo"); | ||
1578 | surface->commit(Surface::CommitFlag::None); | 1578 | surface->commit(Surface::CommitFlag::None); | ||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | |||||
1649 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1649 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1650 | } | 1650 | } | ||
1651 | 1651 | | |||
1652 | TEST_DATA(testMaximizeApplyNow) | 1652 | TEST_DATA(testMaximizeApplyNow) | ||
1653 | 1653 | | |||
1654 | void TestShellClientRules::testMaximizeApplyNow() | 1654 | void TestShellClientRules::testMaximizeApplyNow() | ||
1655 | { | 1655 | { | ||
1656 | // Create the test client. | 1656 | // Create the test client. | ||
1657 | QFETCH(Test::ShellSurfaceType, type); | 1657 | QFETCH(Test::XdgShellSurfaceType, type); | ||
1658 | QScopedPointer<Surface> surface; | 1658 | QScopedPointer<Surface> surface; | ||
1659 | surface.reset(Test::createSurface()); | 1659 | surface.reset(Test::createSurface()); | ||
1660 | QScopedPointer<XdgShellSurface> shellSurface; | 1660 | QScopedPointer<XdgShellSurface> shellSurface; | ||
1661 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | 1661 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||
1662 | QScopedPointer<QSignalSpy> configureRequestedSpy; | 1662 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||
1663 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | 1663 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||
1664 | shellSurface->setAppId("org.kde.foo"); | 1664 | shellSurface->setAppId("org.kde.foo"); | ||
1665 | surface->commit(Surface::CommitFlag::None); | 1665 | surface->commit(Surface::CommitFlag::None); | ||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Line(s) | 1762 | { | |||
1771 | group.writeEntry("wmclass", "org.kde.foo"); | 1771 | group.writeEntry("wmclass", "org.kde.foo"); | ||
1772 | group.writeEntry("wmclasscomplete", false); | 1772 | group.writeEntry("wmclasscomplete", false); | ||
1773 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 1773 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
1774 | group.sync(); | 1774 | group.sync(); | ||
1775 | RuleBook::self()->setConfig(config); | 1775 | RuleBook::self()->setConfig(config); | ||
1776 | workspace()->slotReconfigure(); | 1776 | workspace()->slotReconfigure(); | ||
1777 | 1777 | | |||
1778 | // Create the test client. | 1778 | // Create the test client. | ||
1779 | QFETCH(Test::ShellSurfaceType, type); | 1779 | QFETCH(Test::XdgShellSurfaceType, type); | ||
1780 | QScopedPointer<Surface> surface; | 1780 | QScopedPointer<Surface> surface; | ||
1781 | surface.reset(Test::createSurface()); | 1781 | surface.reset(Test::createSurface()); | ||
1782 | QScopedPointer<XdgShellSurface> shellSurface; | 1782 | QScopedPointer<XdgShellSurface> shellSurface; | ||
1783 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | 1783 | shellSurface.reset(createXdgShellSurface(type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly)); | ||
1784 | QScopedPointer<QSignalSpy> configureRequestedSpy; | 1784 | QScopedPointer<QSignalSpy> configureRequestedSpy; | ||
1785 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | 1785 | configureRequestedSpy.reset(new QSignalSpy(shellSurface.data(), &XdgShellSurface::configureRequested)); | ||
1786 | shellSurface->setAppId("org.kde.foo"); | 1786 | shellSurface->setAppId("org.kde.foo"); | ||
1787 | surface->commit(Surface::CommitFlag::None); | 1787 | surface->commit(Surface::CommitFlag::None); | ||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | 1864 | { | |||
1877 | 1877 | | |||
1878 | // We need at least two virtual desktop for this test. | 1878 | // We need at least two virtual desktop for this test. | ||
1879 | VirtualDesktopManager::self()->setCount(2); | 1879 | VirtualDesktopManager::self()->setCount(2); | ||
1880 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | 1880 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | ||
1881 | VirtualDesktopManager::self()->setCurrent(1); | 1881 | VirtualDesktopManager::self()->setCurrent(1); | ||
1882 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1882 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
1883 | 1883 | | |||
1884 | // Create the test client. | 1884 | // Create the test client. | ||
1885 | QFETCH(Test::ShellSurfaceType, type); | 1885 | QFETCH(Test::XdgShellSurfaceType, type); | ||
1886 | ShellClient *client; | 1886 | ShellClient *client; | ||
1887 | Surface *surface; | 1887 | Surface *surface; | ||
1888 | XdgShellSurface *shellSurface; | 1888 | XdgShellSurface *shellSurface; | ||
1889 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1889 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1890 | QVERIFY(client); | 1890 | QVERIFY(client); | ||
1891 | 1891 | | |||
1892 | // The client should appear on the current virtual desktop. | 1892 | // The client should appear on the current virtual desktop. | ||
1893 | QCOMPARE(client->desktop(), 1); | 1893 | QCOMPARE(client->desktop(), 1); | ||
Show All 24 Lines | 1905 | { | |||
1918 | 1918 | | |||
1919 | // We need at least two virtual desktop for this test. | 1919 | // We need at least two virtual desktop for this test. | ||
1920 | VirtualDesktopManager::self()->setCount(2); | 1920 | VirtualDesktopManager::self()->setCount(2); | ||
1921 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | 1921 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | ||
1922 | VirtualDesktopManager::self()->setCurrent(1); | 1922 | VirtualDesktopManager::self()->setCurrent(1); | ||
1923 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1923 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
1924 | 1924 | | |||
1925 | // Create the test client. | 1925 | // Create the test client. | ||
1926 | QFETCH(Test::ShellSurfaceType, type); | 1926 | QFETCH(Test::XdgShellSurfaceType, type); | ||
1927 | ShellClient *client; | 1927 | ShellClient *client; | ||
1928 | Surface *surface; | 1928 | Surface *surface; | ||
1929 | XdgShellSurface *shellSurface; | 1929 | XdgShellSurface *shellSurface; | ||
1930 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1930 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1931 | QVERIFY(client); | 1931 | QVERIFY(client); | ||
1932 | 1932 | | |||
1933 | // The client should appear on the second virtual desktop. | 1933 | // The client should appear on the second virtual desktop. | ||
1934 | QCOMPARE(client->desktop(), 2); | 1934 | QCOMPARE(client->desktop(), 2); | ||
Show All 11 Lines | |||||
1946 | VirtualDesktopManager::self()->setCurrent(1); | 1946 | VirtualDesktopManager::self()->setCurrent(1); | ||
1947 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1947 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
1948 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1948 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1949 | QVERIFY(client); | 1949 | QVERIFY(client); | ||
1950 | QCOMPARE(client->desktop(), 2); | 1950 | QCOMPARE(client->desktop(), 2); | ||
1951 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | 1951 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | ||
1952 | 1952 | | |||
1953 | // Destroy the client. | 1953 | // Destroy the client. | ||
1954 | delete shellSurface; | 1954 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
1955 | delete surface; | 1955 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
1956 | QVERIFY(Test::waitForWindowDestroyed(client)); | 1956 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
1957 | } | 1957 | } | ||
1958 | 1958 | | |||
1959 | TEST_DATA(testDesktopRemember) | 1959 | TEST_DATA(testDesktopRemember) | ||
1960 | 1960 | | |||
1961 | void TestShellClientRules::testDesktopRemember() | 1961 | void TestShellClientRules::testDesktopRemember() | ||
1962 | { | 1962 | { | ||
1963 | // Initialize RuleBook with the test rule. | 1963 | // Initialize RuleBook with the test rule. | ||
Show All 11 Lines | |||||
1975 | 1975 | | |||
1976 | // We need at least two virtual desktop for this test. | 1976 | // We need at least two virtual desktop for this test. | ||
1977 | VirtualDesktopManager::self()->setCount(2); | 1977 | VirtualDesktopManager::self()->setCount(2); | ||
1978 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | 1978 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | ||
1979 | VirtualDesktopManager::self()->setCurrent(1); | 1979 | VirtualDesktopManager::self()->setCurrent(1); | ||
1980 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 1980 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
1981 | 1981 | | |||
1982 | // Create the test client. | 1982 | // Create the test client. | ||
1983 | QFETCH(Test::ShellSurfaceType, type); | 1983 | QFETCH(Test::XdgShellSurfaceType, type); | ||
1984 | ShellClient *client; | 1984 | ShellClient *client; | ||
1985 | Surface *surface; | 1985 | Surface *surface; | ||
1986 | XdgShellSurface *shellSurface; | 1986 | XdgShellSurface *shellSurface; | ||
1987 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 1987 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
1988 | QVERIFY(client); | 1988 | QVERIFY(client); | ||
1989 | QCOMPARE(client->desktop(), 2); | 1989 | QCOMPARE(client->desktop(), 2); | ||
1990 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | 1990 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | ||
1991 | 1991 | | |||
1992 | // Move the client to the first virtual desktop. | 1992 | // Move the client to the first virtual desktop. | ||
1993 | workspace()->sendClientToDesktop(client, 1, true); | 1993 | workspace()->sendClientToDesktop(client, 1, true); | ||
1994 | QCOMPARE(client->desktop(), 1); | 1994 | QCOMPARE(client->desktop(), 1); | ||
1995 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | 1995 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | ||
1996 | 1996 | | |||
1997 | // If we create the client again, it should appear on the first virtual desktop. | 1997 | // If we create the client again, it should appear on the first virtual desktop. | ||
1998 | delete shellSurface; | 1998 | delete shellSurface; | ||
1999 | delete surface; | 1999 | delete surface; | ||
2000 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2000 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2001 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2001 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2002 | QVERIFY(client); | 2002 | QVERIFY(client); | ||
2003 | QCOMPARE(client->desktop(), 1); | 2003 | QCOMPARE(client->desktop(), 1); | ||
2004 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2004 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
2005 | 2005 | | |||
2006 | // Destroy the client. | 2006 | // Destroy the client. | ||
2007 | delete shellSurface; | 2007 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2008 | delete surface; | 2008 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2009 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2009 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2010 | } | 2010 | } | ||
2011 | 2011 | | |||
2012 | TEST_DATA(testDesktopForce) | 2012 | TEST_DATA(testDesktopForce) | ||
2013 | 2013 | | |||
2014 | void TestShellClientRules::testDesktopForce() | 2014 | void TestShellClientRules::testDesktopForce() | ||
2015 | { | 2015 | { | ||
2016 | // Initialize RuleBook with the test rule. | 2016 | // Initialize RuleBook with the test rule. | ||
Show All 11 Lines | |||||
2028 | 2028 | | |||
2029 | // We need at least two virtual desktop for this test. | 2029 | // We need at least two virtual desktop for this test. | ||
2030 | VirtualDesktopManager::self()->setCount(2); | 2030 | VirtualDesktopManager::self()->setCount(2); | ||
2031 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | 2031 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | ||
2032 | VirtualDesktopManager::self()->setCurrent(1); | 2032 | VirtualDesktopManager::self()->setCurrent(1); | ||
2033 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2033 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
2034 | 2034 | | |||
2035 | // Create the test client. | 2035 | // Create the test client. | ||
2036 | QFETCH(Test::ShellSurfaceType, type); | 2036 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2037 | ShellClient *client; | 2037 | ShellClient *client; | ||
2038 | Surface *surface; | 2038 | Surface *surface; | ||
2039 | XdgShellSurface *shellSurface; | 2039 | XdgShellSurface *shellSurface; | ||
2040 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2040 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2041 | QVERIFY(client); | 2041 | QVERIFY(client); | ||
2042 | 2042 | | |||
2043 | // The client should appear on the second virtual desktop. | 2043 | // The client should appear on the second virtual desktop. | ||
2044 | QCOMPARE(client->desktop(), 2); | 2044 | QCOMPARE(client->desktop(), 2); | ||
Show All 11 Lines | |||||
2056 | VirtualDesktopManager::self()->setCurrent(1); | 2056 | VirtualDesktopManager::self()->setCurrent(1); | ||
2057 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2057 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
2058 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2058 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2059 | QVERIFY(client); | 2059 | QVERIFY(client); | ||
2060 | QCOMPARE(client->desktop(), 2); | 2060 | QCOMPARE(client->desktop(), 2); | ||
2061 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | 2061 | QCOMPARE(VirtualDesktopManager::self()->current(), 2); | ||
2062 | 2062 | | |||
2063 | // Destroy the client. | 2063 | // Destroy the client. | ||
2064 | delete shellSurface; | 2064 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2065 | delete surface; | 2065 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2066 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2066 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2067 | } | 2067 | } | ||
2068 | 2068 | | |||
2069 | TEST_DATA(testDesktopApplyNow) | 2069 | TEST_DATA(testDesktopApplyNow) | ||
2070 | 2070 | | |||
2071 | void TestShellClientRules::testDesktopApplyNow() | 2071 | void TestShellClientRules::testDesktopApplyNow() | ||
2072 | { | 2072 | { | ||
2073 | // We need at least two virtual desktop for this test. | 2073 | // We need at least two virtual desktop for this test. | ||
2074 | VirtualDesktopManager::self()->setCount(2); | 2074 | VirtualDesktopManager::self()->setCount(2); | ||
2075 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | 2075 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | ||
2076 | VirtualDesktopManager::self()->setCurrent(1); | 2076 | VirtualDesktopManager::self()->setCurrent(1); | ||
2077 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2077 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
2078 | 2078 | | |||
2079 | // Create the test client. | 2079 | // Create the test client. | ||
2080 | QFETCH(Test::ShellSurfaceType, type); | 2080 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2081 | ShellClient *client; | 2081 | ShellClient *client; | ||
2082 | Surface *surface; | 2082 | Surface *surface; | ||
2083 | XdgShellSurface *shellSurface; | 2083 | XdgShellSurface *shellSurface; | ||
2084 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2084 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2085 | QVERIFY(client); | 2085 | QVERIFY(client); | ||
2086 | QCOMPARE(client->desktop(), 1); | 2086 | QCOMPARE(client->desktop(), 1); | ||
2087 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2087 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
2088 | 2088 | | |||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 2125 | { | |||
2138 | 2138 | | |||
2139 | // We need at least two virtual desktop for this test. | 2139 | // We need at least two virtual desktop for this test. | ||
2140 | VirtualDesktopManager::self()->setCount(2); | 2140 | VirtualDesktopManager::self()->setCount(2); | ||
2141 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | 2141 | QCOMPARE(VirtualDesktopManager::self()->count(), 2u); | ||
2142 | VirtualDesktopManager::self()->setCurrent(1); | 2142 | VirtualDesktopManager::self()->setCurrent(1); | ||
2143 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2143 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
2144 | 2144 | | |||
2145 | // Create the test client. | 2145 | // Create the test client. | ||
2146 | QFETCH(Test::ShellSurfaceType, type); | 2146 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2147 | ShellClient *client; | 2147 | ShellClient *client; | ||
2148 | Surface *surface; | 2148 | Surface *surface; | ||
2149 | XdgShellSurface *shellSurface; | 2149 | XdgShellSurface *shellSurface; | ||
2150 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2150 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2151 | QVERIFY(client); | 2151 | QVERIFY(client); | ||
2152 | 2152 | | |||
2153 | // The client should appear on the second virtual desktop. | 2153 | // The client should appear on the second virtual desktop. | ||
2154 | QCOMPARE(client->desktop(), 2); | 2154 | QCOMPARE(client->desktop(), 2); | ||
Show All 19 Lines | |||||
2174 | workspace()->sendClientToDesktop(client, 2, true); | 2174 | workspace()->sendClientToDesktop(client, 2, true); | ||
2175 | QCOMPARE(client->desktop(), 2); | 2175 | QCOMPARE(client->desktop(), 2); | ||
2176 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2176 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
2177 | workspace()->sendClientToDesktop(client, 1, true); | 2177 | workspace()->sendClientToDesktop(client, 1, true); | ||
2178 | QCOMPARE(client->desktop(), 1); | 2178 | QCOMPARE(client->desktop(), 1); | ||
2179 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | 2179 | QCOMPARE(VirtualDesktopManager::self()->current(), 1); | ||
2180 | 2180 | | |||
2181 | // Destroy the client. | 2181 | // Destroy the client. | ||
2182 | delete shellSurface; | 2182 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2183 | delete surface; | 2183 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2184 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2184 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2185 | } | 2185 | } | ||
2186 | 2186 | | |||
2187 | TEST_DATA(testMinimizeDontAffect) | 2187 | TEST_DATA(testMinimizeDontAffect) | ||
2188 | 2188 | | |||
2189 | void TestShellClientRules::testMinimizeDontAffect() | 2189 | void TestShellClientRules::testMinimizeDontAffect() | ||
2190 | { | 2190 | { | ||
2191 | // Initialize RuleBook with the test rule. | 2191 | // Initialize RuleBook with the test rule. | ||
2192 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2192 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2193 | config->group("General").writeEntry("count", 1); | 2193 | config->group("General").writeEntry("count", 1); | ||
2194 | KConfigGroup group = config->group("1"); | 2194 | KConfigGroup group = config->group("1"); | ||
2195 | group.writeEntry("minimize", true); | 2195 | group.writeEntry("minimize", true); | ||
2196 | group.writeEntry("minimizerule", int(Rules::DontAffect)); | 2196 | group.writeEntry("minimizerule", int(Rules::DontAffect)); | ||
2197 | group.writeEntry("wmclass", "org.kde.foo"); | 2197 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2198 | group.writeEntry("wmclasscomplete", false); | 2198 | group.writeEntry("wmclasscomplete", false); | ||
2199 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2199 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2200 | group.sync(); | 2200 | group.sync(); | ||
2201 | RuleBook::self()->setConfig(config); | 2201 | RuleBook::self()->setConfig(config); | ||
2202 | workspace()->slotReconfigure(); | 2202 | workspace()->slotReconfigure(); | ||
2203 | 2203 | | |||
2204 | // Create the test client. | 2204 | // Create the test client. | ||
2205 | QFETCH(Test::ShellSurfaceType, type); | 2205 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2206 | ShellClient *client; | 2206 | ShellClient *client; | ||
2207 | Surface *surface; | 2207 | Surface *surface; | ||
2208 | XdgShellSurface *shellSurface; | 2208 | XdgShellSurface *shellSurface; | ||
2209 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2209 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2210 | QVERIFY(client); | 2210 | QVERIFY(client); | ||
2211 | QVERIFY(client->isMinimizable()); | 2211 | QVERIFY(client->isMinimizable()); | ||
2212 | 2212 | | |||
2213 | // The client should not be minimized. | 2213 | // The client should not be minimized. | ||
Show All 18 Lines | 2225 | { | |||
2232 | group.writeEntry("wmclass", "org.kde.foo"); | 2232 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2233 | group.writeEntry("wmclasscomplete", false); | 2233 | group.writeEntry("wmclasscomplete", false); | ||
2234 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2234 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2235 | group.sync(); | 2235 | group.sync(); | ||
2236 | RuleBook::self()->setConfig(config); | 2236 | RuleBook::self()->setConfig(config); | ||
2237 | workspace()->slotReconfigure(); | 2237 | workspace()->slotReconfigure(); | ||
2238 | 2238 | | |||
2239 | // Create the test client. | 2239 | // Create the test client. | ||
2240 | QFETCH(Test::ShellSurfaceType, type); | 2240 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2241 | ShellClient *client; | 2241 | ShellClient *client; | ||
2242 | Surface *surface; | 2242 | Surface *surface; | ||
2243 | XdgShellSurface *shellSurface; | 2243 | XdgShellSurface *shellSurface; | ||
2244 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2244 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2245 | QVERIFY(client); | 2245 | QVERIFY(client); | ||
2246 | QVERIFY(client->isMinimizable()); | 2246 | QVERIFY(client->isMinimizable()); | ||
2247 | 2247 | | |||
2248 | // The client should be minimized. | 2248 | // The client should be minimized. | ||
2249 | QVERIFY(client->isMinimized()); | 2249 | QVERIFY(client->isMinimized()); | ||
2250 | 2250 | | |||
2251 | // We should still be able to unminimize the client. | 2251 | // We should still be able to unminimize the client. | ||
2252 | client->unminimize(); | 2252 | client->unminimize(); | ||
2253 | QVERIFY(!client->isMinimized()); | 2253 | QVERIFY(!client->isMinimized()); | ||
2254 | 2254 | | |||
2255 | // If we re-open the client, it should be minimized back again. | 2255 | // If we re-open the client, it should be minimized back again. | ||
2256 | delete shellSurface; | 2256 | delete shellSurface; | ||
2257 | delete surface; | 2257 | delete surface; | ||
2258 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2258 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2259 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2259 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2260 | QVERIFY(client); | 2260 | QVERIFY(client); | ||
2261 | QVERIFY(client->isMinimizable()); | 2261 | QVERIFY(client->isMinimizable()); | ||
2262 | QVERIFY(client->isMinimized()); | 2262 | QVERIFY(client->isMinimized()); | ||
2263 | 2263 | | |||
2264 | // Destroy the client. | 2264 | // Destroy the client. | ||
2265 | delete shellSurface; | 2265 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2266 | delete surface; | 2266 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2267 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2267 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2268 | } | 2268 | } | ||
2269 | 2269 | | |||
2270 | TEST_DATA(testMinimizeRemember) | 2270 | TEST_DATA(testMinimizeRemember) | ||
2271 | 2271 | | |||
2272 | void TestShellClientRules::testMinimizeRemember() | 2272 | void TestShellClientRules::testMinimizeRemember() | ||
2273 | { | 2273 | { | ||
2274 | // Initialize RuleBook with the test rule. | 2274 | // Initialize RuleBook with the test rule. | ||
2275 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2275 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2276 | config->group("General").writeEntry("count", 1); | 2276 | config->group("General").writeEntry("count", 1); | ||
2277 | KConfigGroup group = config->group("1"); | 2277 | KConfigGroup group = config->group("1"); | ||
2278 | group.writeEntry("minimize", false); | 2278 | group.writeEntry("minimize", false); | ||
2279 | group.writeEntry("minimizerule", int(Rules::Remember)); | 2279 | group.writeEntry("minimizerule", int(Rules::Remember)); | ||
2280 | group.writeEntry("wmclass", "org.kde.foo"); | 2280 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2281 | group.writeEntry("wmclasscomplete", false); | 2281 | group.writeEntry("wmclasscomplete", false); | ||
2282 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2282 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2283 | group.sync(); | 2283 | group.sync(); | ||
2284 | RuleBook::self()->setConfig(config); | 2284 | RuleBook::self()->setConfig(config); | ||
2285 | workspace()->slotReconfigure(); | 2285 | workspace()->slotReconfigure(); | ||
2286 | 2286 | | |||
2287 | // Create the test client. | 2287 | // Create the test client. | ||
2288 | QFETCH(Test::ShellSurfaceType, type); | 2288 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2289 | ShellClient *client; | 2289 | ShellClient *client; | ||
2290 | Surface *surface; | 2290 | Surface *surface; | ||
2291 | XdgShellSurface *shellSurface; | 2291 | XdgShellSurface *shellSurface; | ||
2292 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2292 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2293 | QVERIFY(client); | 2293 | QVERIFY(client); | ||
2294 | QVERIFY(client->isMinimizable()); | 2294 | QVERIFY(client->isMinimizable()); | ||
2295 | QVERIFY(!client->isMinimized()); | 2295 | QVERIFY(!client->isMinimized()); | ||
2296 | 2296 | | |||
2297 | // Minimize the client. | 2297 | // Minimize the client. | ||
2298 | client->minimize(); | 2298 | client->minimize(); | ||
2299 | QVERIFY(client->isMinimized()); | 2299 | QVERIFY(client->isMinimized()); | ||
2300 | 2300 | | |||
2301 | // If we open the client again, it should be minimized. | 2301 | // If we open the client again, it should be minimized. | ||
2302 | delete shellSurface; | 2302 | delete shellSurface; | ||
2303 | delete surface; | 2303 | delete surface; | ||
2304 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2304 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2305 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2305 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2306 | QVERIFY(client); | 2306 | QVERIFY(client); | ||
2307 | QVERIFY(client->isMinimizable()); | 2307 | QVERIFY(client->isMinimizable()); | ||
2308 | QVERIFY(client->isMinimized()); | 2308 | QVERIFY(client->isMinimized()); | ||
2309 | 2309 | | |||
2310 | // Destroy the client. | 2310 | // Destroy the client. | ||
2311 | delete shellSurface; | 2311 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2312 | delete surface; | 2312 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2313 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2313 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2314 | } | 2314 | } | ||
2315 | 2315 | | |||
2316 | TEST_DATA(testMinimizeForce) | 2316 | TEST_DATA(testMinimizeForce) | ||
2317 | 2317 | | |||
2318 | void TestShellClientRules::testMinimizeForce() | 2318 | void TestShellClientRules::testMinimizeForce() | ||
2319 | { | 2319 | { | ||
2320 | // Initialize RuleBook with the test rule. | 2320 | // Initialize RuleBook with the test rule. | ||
2321 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2321 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2322 | config->group("General").writeEntry("count", 1); | 2322 | config->group("General").writeEntry("count", 1); | ||
2323 | KConfigGroup group = config->group("1"); | 2323 | KConfigGroup group = config->group("1"); | ||
2324 | group.writeEntry("minimize", false); | 2324 | group.writeEntry("minimize", false); | ||
2325 | group.writeEntry("minimizerule", int(Rules::Force)); | 2325 | group.writeEntry("minimizerule", int(Rules::Force)); | ||
2326 | group.writeEntry("wmclass", "org.kde.foo"); | 2326 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2327 | group.writeEntry("wmclasscomplete", false); | 2327 | group.writeEntry("wmclasscomplete", false); | ||
2328 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2328 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2329 | group.sync(); | 2329 | group.sync(); | ||
2330 | RuleBook::self()->setConfig(config); | 2330 | RuleBook::self()->setConfig(config); | ||
2331 | workspace()->slotReconfigure(); | 2331 | workspace()->slotReconfigure(); | ||
2332 | 2332 | | |||
2333 | // Create the test client. | 2333 | // Create the test client. | ||
2334 | QFETCH(Test::ShellSurfaceType, type); | 2334 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2335 | ShellClient *client; | 2335 | ShellClient *client; | ||
2336 | Surface *surface; | 2336 | Surface *surface; | ||
2337 | XdgShellSurface *shellSurface; | 2337 | XdgShellSurface *shellSurface; | ||
2338 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2338 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2339 | QVERIFY(client); | 2339 | QVERIFY(client); | ||
2340 | QVERIFY(!client->isMinimizable()); | 2340 | QVERIFY(!client->isMinimizable()); | ||
2341 | QVERIFY(!client->isMinimized()); | 2341 | QVERIFY(!client->isMinimized()); | ||
2342 | 2342 | | |||
2343 | // Any attempt to minimize the client should fail. | 2343 | // Any attempt to minimize the client should fail. | ||
2344 | client->minimize(); | 2344 | client->minimize(); | ||
2345 | QVERIFY(!client->isMinimized()); | 2345 | QVERIFY(!client->isMinimized()); | ||
2346 | 2346 | | |||
2347 | // If we re-open the client, the minimized state should still be forced. | 2347 | // If we re-open the client, the minimized state should still be forced. | ||
2348 | delete shellSurface; | 2348 | delete shellSurface; | ||
2349 | delete surface; | 2349 | delete surface; | ||
2350 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2350 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2351 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2351 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2352 | QVERIFY(client); | 2352 | QVERIFY(client); | ||
2353 | QVERIFY(!client->isMinimizable()); | 2353 | QVERIFY(!client->isMinimizable()); | ||
2354 | QVERIFY(!client->isMinimized()); | 2354 | QVERIFY(!client->isMinimized()); | ||
2355 | client->minimize(); | 2355 | client->minimize(); | ||
2356 | QVERIFY(!client->isMinimized()); | 2356 | QVERIFY(!client->isMinimized()); | ||
2357 | 2357 | | |||
2358 | // Destroy the client. | 2358 | // Destroy the client. | ||
2359 | delete shellSurface; | 2359 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2360 | delete surface; | 2360 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2361 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2361 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2362 | } | 2362 | } | ||
2363 | 2363 | | |||
2364 | TEST_DATA(testMinimizeApplyNow) | 2364 | TEST_DATA(testMinimizeApplyNow) | ||
2365 | 2365 | | |||
2366 | void TestShellClientRules::testMinimizeApplyNow() | 2366 | void TestShellClientRules::testMinimizeApplyNow() | ||
2367 | { | 2367 | { | ||
2368 | // Create the test client. | 2368 | // Create the test client. | ||
2369 | QFETCH(Test::ShellSurfaceType, type); | 2369 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2370 | ShellClient *client; | 2370 | ShellClient *client; | ||
2371 | Surface *surface; | 2371 | Surface *surface; | ||
2372 | XdgShellSurface *shellSurface; | 2372 | XdgShellSurface *shellSurface; | ||
2373 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2373 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2374 | QVERIFY(client); | 2374 | QVERIFY(client); | ||
2375 | QVERIFY(client->isMinimizable()); | 2375 | QVERIFY(client->isMinimizable()); | ||
2376 | QVERIFY(!client->isMinimized()); | 2376 | QVERIFY(!client->isMinimized()); | ||
2377 | 2377 | | |||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 2413 | { | |||
2420 | group.writeEntry("wmclass", "org.kde.foo"); | 2420 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2421 | group.writeEntry("wmclasscomplete", false); | 2421 | group.writeEntry("wmclasscomplete", false); | ||
2422 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2422 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2423 | group.sync(); | 2423 | group.sync(); | ||
2424 | RuleBook::self()->setConfig(config); | 2424 | RuleBook::self()->setConfig(config); | ||
2425 | workspace()->slotReconfigure(); | 2425 | workspace()->slotReconfigure(); | ||
2426 | 2426 | | |||
2427 | // Create the test client. | 2427 | // Create the test client. | ||
2428 | QFETCH(Test::ShellSurfaceType, type); | 2428 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2429 | ShellClient *client; | 2429 | ShellClient *client; | ||
2430 | Surface *surface; | 2430 | Surface *surface; | ||
2431 | XdgShellSurface *shellSurface; | 2431 | XdgShellSurface *shellSurface; | ||
2432 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2432 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2433 | QVERIFY(client); | 2433 | QVERIFY(client); | ||
2434 | QVERIFY(!client->isMinimizable()); | 2434 | QVERIFY(!client->isMinimizable()); | ||
2435 | QVERIFY(!client->isMinimized()); | 2435 | QVERIFY(!client->isMinimized()); | ||
2436 | 2436 | | |||
2437 | // Any attempt to minimize the client should fail until the client is closed. | 2437 | // Any attempt to minimize the client should fail until the client is closed. | ||
2438 | client->minimize(); | 2438 | client->minimize(); | ||
2439 | QVERIFY(!client->isMinimized()); | 2439 | QVERIFY(!client->isMinimized()); | ||
2440 | 2440 | | |||
2441 | // The rule should be discarded when the client is closed. | 2441 | // The rule should be discarded when the client is closed. | ||
2442 | delete shellSurface; | 2442 | delete shellSurface; | ||
2443 | delete surface; | 2443 | delete surface; | ||
2444 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2444 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2445 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2445 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2446 | QVERIFY(client); | 2446 | QVERIFY(client); | ||
2447 | QVERIFY(client->isMinimizable()); | 2447 | QVERIFY(client->isMinimizable()); | ||
2448 | QVERIFY(!client->isMinimized()); | 2448 | QVERIFY(!client->isMinimized()); | ||
2449 | client->minimize(); | 2449 | client->minimize(); | ||
2450 | QVERIFY(client->isMinimized()); | 2450 | QVERIFY(client->isMinimized()); | ||
2451 | 2451 | | |||
2452 | // Destroy the client. | 2452 | // Destroy the client. | ||
2453 | delete shellSurface; | 2453 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2454 | delete surface; | 2454 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2455 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2455 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2456 | } | 2456 | } | ||
2457 | 2457 | | |||
2458 | TEST_DATA(testSkipTaskbarDontAffect) | 2458 | TEST_DATA(testSkipTaskbarDontAffect) | ||
2459 | 2459 | | |||
2460 | void TestShellClientRules::testSkipTaskbarDontAffect() | 2460 | void TestShellClientRules::testSkipTaskbarDontAffect() | ||
2461 | { | 2461 | { | ||
2462 | // Initialize RuleBook with the test rule. | 2462 | // Initialize RuleBook with the test rule. | ||
2463 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2463 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2464 | config->group("General").writeEntry("count", 1); | 2464 | config->group("General").writeEntry("count", 1); | ||
2465 | KConfigGroup group = config->group("1"); | 2465 | KConfigGroup group = config->group("1"); | ||
2466 | group.writeEntry("skiptaskbar", true); | 2466 | group.writeEntry("skiptaskbar", true); | ||
2467 | group.writeEntry("skiptaskbarrule", int(Rules::DontAffect)); | 2467 | group.writeEntry("skiptaskbarrule", int(Rules::DontAffect)); | ||
2468 | group.writeEntry("wmclass", "org.kde.foo"); | 2468 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2469 | group.writeEntry("wmclasscomplete", false); | 2469 | group.writeEntry("wmclasscomplete", false); | ||
2470 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2470 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2471 | group.sync(); | 2471 | group.sync(); | ||
2472 | RuleBook::self()->setConfig(config); | 2472 | RuleBook::self()->setConfig(config); | ||
2473 | workspace()->slotReconfigure(); | 2473 | workspace()->slotReconfigure(); | ||
2474 | 2474 | | |||
2475 | // Create the test client. | 2475 | // Create the test client. | ||
2476 | QFETCH(Test::ShellSurfaceType, type); | 2476 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2477 | ShellClient *client; | 2477 | ShellClient *client; | ||
2478 | Surface *surface; | 2478 | Surface *surface; | ||
2479 | XdgShellSurface *shellSurface; | 2479 | XdgShellSurface *shellSurface; | ||
2480 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2480 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2481 | QVERIFY(client); | 2481 | QVERIFY(client); | ||
2482 | 2482 | | |||
2483 | // The client should not be affected by the rule. | 2483 | // The client should not be affected by the rule. | ||
2484 | QVERIFY(!client->skipTaskbar()); | 2484 | QVERIFY(!client->skipTaskbar()); | ||
Show All 17 Lines | 2495 | { | |||
2502 | group.writeEntry("wmclass", "org.kde.foo"); | 2502 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2503 | group.writeEntry("wmclasscomplete", false); | 2503 | group.writeEntry("wmclasscomplete", false); | ||
2504 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2504 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2505 | group.sync(); | 2505 | group.sync(); | ||
2506 | RuleBook::self()->setConfig(config); | 2506 | RuleBook::self()->setConfig(config); | ||
2507 | workspace()->slotReconfigure(); | 2507 | workspace()->slotReconfigure(); | ||
2508 | 2508 | | |||
2509 | // Create the test client. | 2509 | // Create the test client. | ||
2510 | QFETCH(Test::ShellSurfaceType, type); | 2510 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2511 | ShellClient *client; | 2511 | ShellClient *client; | ||
2512 | Surface *surface; | 2512 | Surface *surface; | ||
2513 | XdgShellSurface *shellSurface; | 2513 | XdgShellSurface *shellSurface; | ||
2514 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2514 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2515 | QVERIFY(client); | 2515 | QVERIFY(client); | ||
2516 | 2516 | | |||
2517 | // The client should not be included on a taskbar. | 2517 | // The client should not be included on a taskbar. | ||
2518 | QVERIFY(client->skipTaskbar()); | 2518 | QVERIFY(client->skipTaskbar()); | ||
2519 | 2519 | | |||
2520 | // Though one can change that. | 2520 | // Though one can change that. | ||
2521 | client->setOriginalSkipTaskbar(false); | 2521 | client->setOriginalSkipTaskbar(false); | ||
2522 | QVERIFY(!client->skipTaskbar()); | 2522 | QVERIFY(!client->skipTaskbar()); | ||
2523 | 2523 | | |||
2524 | // Reopen the client, the rule should be applied again. | 2524 | // Reopen the client, the rule should be applied again. | ||
2525 | delete shellSurface; | 2525 | delete shellSurface; | ||
2526 | delete surface; | 2526 | delete surface; | ||
2527 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2527 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2528 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2528 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2529 | QVERIFY(client); | 2529 | QVERIFY(client); | ||
2530 | QVERIFY(client->skipTaskbar()); | 2530 | QVERIFY(client->skipTaskbar()); | ||
2531 | 2531 | | |||
2532 | // Destroy the client. | 2532 | // Destroy the client. | ||
2533 | delete shellSurface; | 2533 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2534 | delete surface; | 2534 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2535 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2535 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2536 | } | 2536 | } | ||
2537 | 2537 | | |||
2538 | TEST_DATA(testSkipTaskbarRemember) | 2538 | TEST_DATA(testSkipTaskbarRemember) | ||
2539 | 2539 | | |||
2540 | void TestShellClientRules::testSkipTaskbarRemember() | 2540 | void TestShellClientRules::testSkipTaskbarRemember() | ||
2541 | { | 2541 | { | ||
2542 | // Initialize RuleBook with the test rule. | 2542 | // Initialize RuleBook with the test rule. | ||
2543 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2543 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2544 | config->group("General").writeEntry("count", 1); | 2544 | config->group("General").writeEntry("count", 1); | ||
2545 | KConfigGroup group = config->group("1"); | 2545 | KConfigGroup group = config->group("1"); | ||
2546 | group.writeEntry("skiptaskbar", true); | 2546 | group.writeEntry("skiptaskbar", true); | ||
2547 | group.writeEntry("skiptaskbarrule", int(Rules::Remember)); | 2547 | group.writeEntry("skiptaskbarrule", int(Rules::Remember)); | ||
2548 | group.writeEntry("wmclass", "org.kde.foo"); | 2548 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2549 | group.writeEntry("wmclasscomplete", false); | 2549 | group.writeEntry("wmclasscomplete", false); | ||
2550 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2550 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2551 | group.sync(); | 2551 | group.sync(); | ||
2552 | RuleBook::self()->setConfig(config); | 2552 | RuleBook::self()->setConfig(config); | ||
2553 | workspace()->slotReconfigure(); | 2553 | workspace()->slotReconfigure(); | ||
2554 | 2554 | | |||
2555 | // Create the test client. | 2555 | // Create the test client. | ||
2556 | QFETCH(Test::ShellSurfaceType, type); | 2556 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2557 | ShellClient *client; | 2557 | ShellClient *client; | ||
2558 | Surface *surface; | 2558 | Surface *surface; | ||
2559 | XdgShellSurface *shellSurface; | 2559 | XdgShellSurface *shellSurface; | ||
2560 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2560 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2561 | QVERIFY(client); | 2561 | QVERIFY(client); | ||
2562 | 2562 | | |||
2563 | // The client should not be included on a taskbar. | 2563 | // The client should not be included on a taskbar. | ||
2564 | QVERIFY(client->skipTaskbar()); | 2564 | QVERIFY(client->skipTaskbar()); | ||
2565 | 2565 | | |||
2566 | // Change the skip-taskbar state. | 2566 | // Change the skip-taskbar state. | ||
2567 | client->setOriginalSkipTaskbar(false); | 2567 | client->setOriginalSkipTaskbar(false); | ||
2568 | QVERIFY(!client->skipTaskbar()); | 2568 | QVERIFY(!client->skipTaskbar()); | ||
2569 | 2569 | | |||
2570 | // Reopen the client. | 2570 | // Reopen the client. | ||
2571 | delete shellSurface; | 2571 | delete shellSurface; | ||
2572 | delete surface; | 2572 | delete surface; | ||
2573 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2573 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2574 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2574 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2575 | QVERIFY(client); | 2575 | QVERIFY(client); | ||
2576 | 2576 | | |||
2577 | // The client should be included on a taskbar. | 2577 | // The client should be included on a taskbar. | ||
2578 | QVERIFY(!client->skipTaskbar()); | 2578 | QVERIFY(!client->skipTaskbar()); | ||
2579 | 2579 | | |||
2580 | // Destroy the client. | 2580 | // Destroy the client. | ||
2581 | delete shellSurface; | 2581 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2582 | delete surface; | 2582 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2583 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2583 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2584 | } | 2584 | } | ||
2585 | 2585 | | |||
2586 | TEST_DATA(testSkipTaskbarForce) | 2586 | TEST_DATA(testSkipTaskbarForce) | ||
2587 | 2587 | | |||
2588 | void TestShellClientRules::testSkipTaskbarForce() | 2588 | void TestShellClientRules::testSkipTaskbarForce() | ||
2589 | { | 2589 | { | ||
2590 | // Initialize RuleBook with the test rule. | 2590 | // Initialize RuleBook with the test rule. | ||
2591 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2591 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2592 | config->group("General").writeEntry("count", 1); | 2592 | config->group("General").writeEntry("count", 1); | ||
2593 | KConfigGroup group = config->group("1"); | 2593 | KConfigGroup group = config->group("1"); | ||
2594 | group.writeEntry("skiptaskbar", true); | 2594 | group.writeEntry("skiptaskbar", true); | ||
2595 | group.writeEntry("skiptaskbarrule", int(Rules::Force)); | 2595 | group.writeEntry("skiptaskbarrule", int(Rules::Force)); | ||
2596 | group.writeEntry("wmclass", "org.kde.foo"); | 2596 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2597 | group.writeEntry("wmclasscomplete", false); | 2597 | group.writeEntry("wmclasscomplete", false); | ||
2598 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2598 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2599 | group.sync(); | 2599 | group.sync(); | ||
2600 | RuleBook::self()->setConfig(config); | 2600 | RuleBook::self()->setConfig(config); | ||
2601 | workspace()->slotReconfigure(); | 2601 | workspace()->slotReconfigure(); | ||
2602 | 2602 | | |||
2603 | // Create the test client. | 2603 | // Create the test client. | ||
2604 | QFETCH(Test::ShellSurfaceType, type); | 2604 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2605 | ShellClient *client; | 2605 | ShellClient *client; | ||
2606 | Surface *surface; | 2606 | Surface *surface; | ||
2607 | XdgShellSurface *shellSurface; | 2607 | XdgShellSurface *shellSurface; | ||
2608 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2608 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2609 | QVERIFY(client); | 2609 | QVERIFY(client); | ||
2610 | 2610 | | |||
2611 | // The client should not be included on a taskbar. | 2611 | // The client should not be included on a taskbar. | ||
2612 | QVERIFY(client->skipTaskbar()); | 2612 | QVERIFY(client->skipTaskbar()); | ||
2613 | 2613 | | |||
2614 | // Any attempt to change the skip-taskbar state should not succeed. | 2614 | // Any attempt to change the skip-taskbar state should not succeed. | ||
2615 | client->setOriginalSkipTaskbar(false); | 2615 | client->setOriginalSkipTaskbar(false); | ||
2616 | QVERIFY(client->skipTaskbar()); | 2616 | QVERIFY(client->skipTaskbar()); | ||
2617 | 2617 | | |||
2618 | // Reopen the client. | 2618 | // Reopen the client. | ||
2619 | delete shellSurface; | 2619 | delete shellSurface; | ||
2620 | delete surface; | 2620 | delete surface; | ||
2621 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2621 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2622 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2622 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2623 | QVERIFY(client); | 2623 | QVERIFY(client); | ||
2624 | 2624 | | |||
2625 | // The skip-taskbar state should be still forced. | 2625 | // The skip-taskbar state should be still forced. | ||
2626 | QVERIFY(client->skipTaskbar()); | 2626 | QVERIFY(client->skipTaskbar()); | ||
2627 | 2627 | | |||
2628 | // Destroy the client. | 2628 | // Destroy the client. | ||
2629 | delete shellSurface; | 2629 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2630 | delete surface; | 2630 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2631 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2631 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2632 | } | 2632 | } | ||
2633 | 2633 | | |||
2634 | TEST_DATA(testSkipTaskbarApplyNow) | 2634 | TEST_DATA(testSkipTaskbarApplyNow) | ||
2635 | 2635 | | |||
2636 | void TestShellClientRules::testSkipTaskbarApplyNow() | 2636 | void TestShellClientRules::testSkipTaskbarApplyNow() | ||
2637 | { | 2637 | { | ||
2638 | // Create the test client. | 2638 | // Create the test client. | ||
2639 | QFETCH(Test::ShellSurfaceType, type); | 2639 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2640 | ShellClient *client; | 2640 | ShellClient *client; | ||
2641 | Surface *surface; | 2641 | Surface *surface; | ||
2642 | XdgShellSurface *shellSurface; | 2642 | XdgShellSurface *shellSurface; | ||
2643 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2643 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2644 | QVERIFY(client); | 2644 | QVERIFY(client); | ||
2645 | QVERIFY(!client->skipTaskbar()); | 2645 | QVERIFY(!client->skipTaskbar()); | ||
2646 | 2646 | | |||
2647 | // Initialize RuleBook with the test rule. | 2647 | // Initialize RuleBook with the test rule. | ||
Show All 39 Lines | 2680 | { | |||
2687 | group.writeEntry("wmclass", "org.kde.foo"); | 2687 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2688 | group.writeEntry("wmclasscomplete", false); | 2688 | group.writeEntry("wmclasscomplete", false); | ||
2689 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2689 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2690 | group.sync(); | 2690 | group.sync(); | ||
2691 | RuleBook::self()->setConfig(config); | 2691 | RuleBook::self()->setConfig(config); | ||
2692 | workspace()->slotReconfigure(); | 2692 | workspace()->slotReconfigure(); | ||
2693 | 2693 | | |||
2694 | // Create the test client. | 2694 | // Create the test client. | ||
2695 | QFETCH(Test::ShellSurfaceType, type); | 2695 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2696 | ShellClient *client; | 2696 | ShellClient *client; | ||
2697 | Surface *surface; | 2697 | Surface *surface; | ||
2698 | XdgShellSurface *shellSurface; | 2698 | XdgShellSurface *shellSurface; | ||
2699 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2699 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2700 | QVERIFY(client); | 2700 | QVERIFY(client); | ||
2701 | 2701 | | |||
2702 | // The client should not be included on a taskbar. | 2702 | // The client should not be included on a taskbar. | ||
2703 | QVERIFY(client->skipTaskbar()); | 2703 | QVERIFY(client->skipTaskbar()); | ||
Show All 10 Lines | |||||
2714 | QVERIFY(client); | 2714 | QVERIFY(client); | ||
2715 | QVERIFY(!client->skipTaskbar()); | 2715 | QVERIFY(!client->skipTaskbar()); | ||
2716 | 2716 | | |||
2717 | // The skip-taskbar state is no longer forced. | 2717 | // The skip-taskbar state is no longer forced. | ||
2718 | client->setOriginalSkipTaskbar(true); | 2718 | client->setOriginalSkipTaskbar(true); | ||
2719 | QVERIFY(client->skipTaskbar()); | 2719 | QVERIFY(client->skipTaskbar()); | ||
2720 | 2720 | | |||
2721 | // Destroy the client. | 2721 | // Destroy the client. | ||
2722 | delete shellSurface; | 2722 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2723 | delete surface; | 2723 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2724 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2724 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2725 | } | 2725 | } | ||
2726 | 2726 | | |||
2727 | TEST_DATA(testSkipPagerDontAffect) | 2727 | TEST_DATA(testSkipPagerDontAffect) | ||
2728 | 2728 | | |||
2729 | void TestShellClientRules::testSkipPagerDontAffect() | 2729 | void TestShellClientRules::testSkipPagerDontAffect() | ||
2730 | { | 2730 | { | ||
2731 | // Initialize RuleBook with the test rule. | 2731 | // Initialize RuleBook with the test rule. | ||
2732 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2732 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2733 | config->group("General").writeEntry("count", 1); | 2733 | config->group("General").writeEntry("count", 1); | ||
2734 | KConfigGroup group = config->group("1"); | 2734 | KConfigGroup group = config->group("1"); | ||
2735 | group.writeEntry("skippager", true); | 2735 | group.writeEntry("skippager", true); | ||
2736 | group.writeEntry("skippagerrule", int(Rules::DontAffect)); | 2736 | group.writeEntry("skippagerrule", int(Rules::DontAffect)); | ||
2737 | group.writeEntry("wmclass", "org.kde.foo"); | 2737 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2738 | group.writeEntry("wmclasscomplete", false); | 2738 | group.writeEntry("wmclasscomplete", false); | ||
2739 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2739 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2740 | group.sync(); | 2740 | group.sync(); | ||
2741 | RuleBook::self()->setConfig(config); | 2741 | RuleBook::self()->setConfig(config); | ||
2742 | workspace()->slotReconfigure(); | 2742 | workspace()->slotReconfigure(); | ||
2743 | 2743 | | |||
2744 | // Create the test client. | 2744 | // Create the test client. | ||
2745 | QFETCH(Test::ShellSurfaceType, type); | 2745 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2746 | ShellClient *client; | 2746 | ShellClient *client; | ||
2747 | Surface *surface; | 2747 | Surface *surface; | ||
2748 | XdgShellSurface *shellSurface; | 2748 | XdgShellSurface *shellSurface; | ||
2749 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2749 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2750 | QVERIFY(client); | 2750 | QVERIFY(client); | ||
2751 | 2751 | | |||
2752 | // The client should not be affected by the rule. | 2752 | // The client should not be affected by the rule. | ||
2753 | QVERIFY(!client->skipPager()); | 2753 | QVERIFY(!client->skipPager()); | ||
Show All 17 Lines | 2764 | { | |||
2771 | group.writeEntry("wmclass", "org.kde.foo"); | 2771 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2772 | group.writeEntry("wmclasscomplete", false); | 2772 | group.writeEntry("wmclasscomplete", false); | ||
2773 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2773 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2774 | group.sync(); | 2774 | group.sync(); | ||
2775 | RuleBook::self()->setConfig(config); | 2775 | RuleBook::self()->setConfig(config); | ||
2776 | workspace()->slotReconfigure(); | 2776 | workspace()->slotReconfigure(); | ||
2777 | 2777 | | |||
2778 | // Create the test client. | 2778 | // Create the test client. | ||
2779 | QFETCH(Test::ShellSurfaceType, type); | 2779 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2780 | ShellClient *client; | 2780 | ShellClient *client; | ||
2781 | Surface *surface; | 2781 | Surface *surface; | ||
2782 | XdgShellSurface *shellSurface; | 2782 | XdgShellSurface *shellSurface; | ||
2783 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2783 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2784 | QVERIFY(client); | 2784 | QVERIFY(client); | ||
2785 | 2785 | | |||
2786 | // The client should not be included on a pager. | 2786 | // The client should not be included on a pager. | ||
2787 | QVERIFY(client->skipPager()); | 2787 | QVERIFY(client->skipPager()); | ||
2788 | 2788 | | |||
2789 | // Though one can change that. | 2789 | // Though one can change that. | ||
2790 | client->setSkipPager(false); | 2790 | client->setSkipPager(false); | ||
2791 | QVERIFY(!client->skipPager()); | 2791 | QVERIFY(!client->skipPager()); | ||
2792 | 2792 | | |||
2793 | // Reopen the client, the rule should be applied again. | 2793 | // Reopen the client, the rule should be applied again. | ||
2794 | delete shellSurface; | 2794 | delete shellSurface; | ||
2795 | delete surface; | 2795 | delete surface; | ||
2796 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2796 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2797 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2797 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2798 | QVERIFY(client); | 2798 | QVERIFY(client); | ||
2799 | QVERIFY(client->skipPager()); | 2799 | QVERIFY(client->skipPager()); | ||
2800 | 2800 | | |||
2801 | // Destroy the client. | 2801 | // Destroy the client. | ||
2802 | delete shellSurface; | 2802 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2803 | delete surface; | 2803 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2804 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2804 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2805 | } | 2805 | } | ||
2806 | 2806 | | |||
2807 | TEST_DATA(testSkipPagerRemember) | 2807 | TEST_DATA(testSkipPagerRemember) | ||
2808 | 2808 | | |||
2809 | void TestShellClientRules::testSkipPagerRemember() | 2809 | void TestShellClientRules::testSkipPagerRemember() | ||
2810 | { | 2810 | { | ||
2811 | // Initialize RuleBook with the test rule. | 2811 | // Initialize RuleBook with the test rule. | ||
2812 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2812 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2813 | config->group("General").writeEntry("count", 1); | 2813 | config->group("General").writeEntry("count", 1); | ||
2814 | KConfigGroup group = config->group("1"); | 2814 | KConfigGroup group = config->group("1"); | ||
2815 | group.writeEntry("skippager", true); | 2815 | group.writeEntry("skippager", true); | ||
2816 | group.writeEntry("skippagerrule", int(Rules::Remember)); | 2816 | group.writeEntry("skippagerrule", int(Rules::Remember)); | ||
2817 | group.writeEntry("wmclass", "org.kde.foo"); | 2817 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2818 | group.writeEntry("wmclasscomplete", false); | 2818 | group.writeEntry("wmclasscomplete", false); | ||
2819 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2819 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2820 | group.sync(); | 2820 | group.sync(); | ||
2821 | RuleBook::self()->setConfig(config); | 2821 | RuleBook::self()->setConfig(config); | ||
2822 | workspace()->slotReconfigure(); | 2822 | workspace()->slotReconfigure(); | ||
2823 | 2823 | | |||
2824 | // Create the test client. | 2824 | // Create the test client. | ||
2825 | QFETCH(Test::ShellSurfaceType, type); | 2825 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2826 | ShellClient *client; | 2826 | ShellClient *client; | ||
2827 | Surface *surface; | 2827 | Surface *surface; | ||
2828 | XdgShellSurface *shellSurface; | 2828 | XdgShellSurface *shellSurface; | ||
2829 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2829 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2830 | QVERIFY(client); | 2830 | QVERIFY(client); | ||
2831 | 2831 | | |||
2832 | // The client should not be included on a pager. | 2832 | // The client should not be included on a pager. | ||
2833 | QVERIFY(client->skipPager()); | 2833 | QVERIFY(client->skipPager()); | ||
2834 | 2834 | | |||
2835 | // Change the skip-pager state. | 2835 | // Change the skip-pager state. | ||
2836 | client->setSkipPager(false); | 2836 | client->setSkipPager(false); | ||
2837 | QVERIFY(!client->skipPager()); | 2837 | QVERIFY(!client->skipPager()); | ||
2838 | 2838 | | |||
2839 | // Reopen the client. | 2839 | // Reopen the client. | ||
2840 | delete shellSurface; | 2840 | delete shellSurface; | ||
2841 | delete surface; | 2841 | delete surface; | ||
2842 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2842 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2843 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2843 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2844 | QVERIFY(client); | 2844 | QVERIFY(client); | ||
2845 | 2845 | | |||
2846 | // The client should be included on a pager. | 2846 | // The client should be included on a pager. | ||
2847 | QVERIFY(!client->skipPager()); | 2847 | QVERIFY(!client->skipPager()); | ||
2848 | 2848 | | |||
2849 | // Destroy the client. | 2849 | // Destroy the client. | ||
2850 | delete shellSurface; | 2850 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2851 | delete surface; | 2851 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2852 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2852 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2853 | } | 2853 | } | ||
2854 | 2854 | | |||
2855 | TEST_DATA(testSkipPagerForce) | 2855 | TEST_DATA(testSkipPagerForce) | ||
2856 | 2856 | | |||
2857 | void TestShellClientRules::testSkipPagerForce() | 2857 | void TestShellClientRules::testSkipPagerForce() | ||
2858 | { | 2858 | { | ||
2859 | // Initialize RuleBook with the test rule. | 2859 | // Initialize RuleBook with the test rule. | ||
2860 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 2860 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
2861 | config->group("General").writeEntry("count", 1); | 2861 | config->group("General").writeEntry("count", 1); | ||
2862 | KConfigGroup group = config->group("1"); | 2862 | KConfigGroup group = config->group("1"); | ||
2863 | group.writeEntry("skippager", true); | 2863 | group.writeEntry("skippager", true); | ||
2864 | group.writeEntry("skippagerrule", int(Rules::Force)); | 2864 | group.writeEntry("skippagerrule", int(Rules::Force)); | ||
2865 | group.writeEntry("wmclass", "org.kde.foo"); | 2865 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2866 | group.writeEntry("wmclasscomplete", false); | 2866 | group.writeEntry("wmclasscomplete", false); | ||
2867 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2867 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2868 | group.sync(); | 2868 | group.sync(); | ||
2869 | RuleBook::self()->setConfig(config); | 2869 | RuleBook::self()->setConfig(config); | ||
2870 | workspace()->slotReconfigure(); | 2870 | workspace()->slotReconfigure(); | ||
2871 | 2871 | | |||
2872 | // Create the test client. | 2872 | // Create the test client. | ||
2873 | QFETCH(Test::ShellSurfaceType, type); | 2873 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2874 | ShellClient *client; | 2874 | ShellClient *client; | ||
2875 | Surface *surface; | 2875 | Surface *surface; | ||
2876 | XdgShellSurface *shellSurface; | 2876 | XdgShellSurface *shellSurface; | ||
2877 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2877 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2878 | QVERIFY(client); | 2878 | QVERIFY(client); | ||
2879 | 2879 | | |||
2880 | // The client should not be included on a pager. | 2880 | // The client should not be included on a pager. | ||
2881 | QVERIFY(client->skipPager()); | 2881 | QVERIFY(client->skipPager()); | ||
2882 | 2882 | | |||
2883 | // Any attempt to change the skip-pager state should not succeed. | 2883 | // Any attempt to change the skip-pager state should not succeed. | ||
2884 | client->setSkipPager(false); | 2884 | client->setSkipPager(false); | ||
2885 | QVERIFY(client->skipPager()); | 2885 | QVERIFY(client->skipPager()); | ||
2886 | 2886 | | |||
2887 | // Reopen the client. | 2887 | // Reopen the client. | ||
2888 | delete shellSurface; | 2888 | delete shellSurface; | ||
2889 | delete surface; | 2889 | delete surface; | ||
2890 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2890 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2891 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2891 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2892 | QVERIFY(client); | 2892 | QVERIFY(client); | ||
2893 | 2893 | | |||
2894 | // The skip-pager state should be still forced. | 2894 | // The skip-pager state should be still forced. | ||
2895 | QVERIFY(client->skipPager()); | 2895 | QVERIFY(client->skipPager()); | ||
2896 | 2896 | | |||
2897 | // Destroy the client. | 2897 | // Destroy the client. | ||
2898 | delete shellSurface; | 2898 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2899 | delete surface; | 2899 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2900 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2900 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2901 | } | 2901 | } | ||
2902 | 2902 | | |||
2903 | TEST_DATA(testSkipPagerApplyNow) | 2903 | TEST_DATA(testSkipPagerApplyNow) | ||
2904 | 2904 | | |||
2905 | void TestShellClientRules::testSkipPagerApplyNow() | 2905 | void TestShellClientRules::testSkipPagerApplyNow() | ||
2906 | { | 2906 | { | ||
2907 | // Create the test client. | 2907 | // Create the test client. | ||
2908 | QFETCH(Test::ShellSurfaceType, type); | 2908 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2909 | ShellClient *client; | 2909 | ShellClient *client; | ||
2910 | Surface *surface; | 2910 | Surface *surface; | ||
2911 | XdgShellSurface *shellSurface; | 2911 | XdgShellSurface *shellSurface; | ||
2912 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2912 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2913 | QVERIFY(client); | 2913 | QVERIFY(client); | ||
2914 | QVERIFY(!client->skipPager()); | 2914 | QVERIFY(!client->skipPager()); | ||
2915 | 2915 | | |||
2916 | // Initialize RuleBook with the test rule. | 2916 | // Initialize RuleBook with the test rule. | ||
Show All 39 Lines | 2949 | { | |||
2956 | group.writeEntry("wmclass", "org.kde.foo"); | 2956 | group.writeEntry("wmclass", "org.kde.foo"); | ||
2957 | group.writeEntry("wmclasscomplete", false); | 2957 | group.writeEntry("wmclasscomplete", false); | ||
2958 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 2958 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
2959 | group.sync(); | 2959 | group.sync(); | ||
2960 | RuleBook::self()->setConfig(config); | 2960 | RuleBook::self()->setConfig(config); | ||
2961 | workspace()->slotReconfigure(); | 2961 | workspace()->slotReconfigure(); | ||
2962 | 2962 | | |||
2963 | // Create the test client. | 2963 | // Create the test client. | ||
2964 | QFETCH(Test::ShellSurfaceType, type); | 2964 | QFETCH(Test::XdgShellSurfaceType, type); | ||
2965 | ShellClient *client; | 2965 | ShellClient *client; | ||
2966 | Surface *surface; | 2966 | Surface *surface; | ||
2967 | XdgShellSurface *shellSurface; | 2967 | XdgShellSurface *shellSurface; | ||
2968 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 2968 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
2969 | QVERIFY(client); | 2969 | QVERIFY(client); | ||
2970 | 2970 | | |||
2971 | // The client should not be included on a pager. | 2971 | // The client should not be included on a pager. | ||
2972 | QVERIFY(client->skipPager()); | 2972 | QVERIFY(client->skipPager()); | ||
Show All 10 Lines | |||||
2983 | QVERIFY(client); | 2983 | QVERIFY(client); | ||
2984 | QVERIFY(!client->skipPager()); | 2984 | QVERIFY(!client->skipPager()); | ||
2985 | 2985 | | |||
2986 | // The skip-pager state is no longer forced. | 2986 | // The skip-pager state is no longer forced. | ||
2987 | client->setSkipPager(true); | 2987 | client->setSkipPager(true); | ||
2988 | QVERIFY(client->skipPager()); | 2988 | QVERIFY(client->skipPager()); | ||
2989 | 2989 | | |||
2990 | // Destroy the client. | 2990 | // Destroy the client. | ||
2991 | delete shellSurface; | 2991 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
2992 | delete surface; | 2992 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
2993 | QVERIFY(Test::waitForWindowDestroyed(client)); | 2993 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
2994 | } | 2994 | } | ||
2995 | 2995 | | |||
2996 | TEST_DATA(testSkipSwitcherDontAffect) | 2996 | TEST_DATA(testSkipSwitcherDontAffect) | ||
2997 | 2997 | | |||
2998 | void TestShellClientRules::testSkipSwitcherDontAffect() | 2998 | void TestShellClientRules::testSkipSwitcherDontAffect() | ||
2999 | { | 2999 | { | ||
3000 | // Initialize RuleBook with the test rule. | 3000 | // Initialize RuleBook with the test rule. | ||
3001 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3001 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3002 | config->group("General").writeEntry("count", 1); | 3002 | config->group("General").writeEntry("count", 1); | ||
3003 | KConfigGroup group = config->group("1"); | 3003 | KConfigGroup group = config->group("1"); | ||
3004 | group.writeEntry("skipswitcher", true); | 3004 | group.writeEntry("skipswitcher", true); | ||
3005 | group.writeEntry("skipswitcherrule", int(Rules::DontAffect)); | 3005 | group.writeEntry("skipswitcherrule", int(Rules::DontAffect)); | ||
3006 | group.writeEntry("wmclass", "org.kde.foo"); | 3006 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3007 | group.writeEntry("wmclasscomplete", false); | 3007 | group.writeEntry("wmclasscomplete", false); | ||
3008 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3008 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3009 | group.sync(); | 3009 | group.sync(); | ||
3010 | RuleBook::self()->setConfig(config); | 3010 | RuleBook::self()->setConfig(config); | ||
3011 | workspace()->slotReconfigure(); | 3011 | workspace()->slotReconfigure(); | ||
3012 | 3012 | | |||
3013 | // Create the test client. | 3013 | // Create the test client. | ||
3014 | QFETCH(Test::ShellSurfaceType, type); | 3014 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3015 | ShellClient *client; | 3015 | ShellClient *client; | ||
3016 | Surface *surface; | 3016 | Surface *surface; | ||
3017 | XdgShellSurface *shellSurface; | 3017 | XdgShellSurface *shellSurface; | ||
3018 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3018 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3019 | QVERIFY(client); | 3019 | QVERIFY(client); | ||
3020 | 3020 | | |||
3021 | // The client should not be affected by the rule. | 3021 | // The client should not be affected by the rule. | ||
3022 | QVERIFY(!client->skipSwitcher()); | 3022 | QVERIFY(!client->skipSwitcher()); | ||
Show All 17 Lines | 3033 | { | |||
3040 | group.writeEntry("wmclass", "org.kde.foo"); | 3040 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3041 | group.writeEntry("wmclasscomplete", false); | 3041 | group.writeEntry("wmclasscomplete", false); | ||
3042 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3042 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3043 | group.sync(); | 3043 | group.sync(); | ||
3044 | RuleBook::self()->setConfig(config); | 3044 | RuleBook::self()->setConfig(config); | ||
3045 | workspace()->slotReconfigure(); | 3045 | workspace()->slotReconfigure(); | ||
3046 | 3046 | | |||
3047 | // Create the test client. | 3047 | // Create the test client. | ||
3048 | QFETCH(Test::ShellSurfaceType, type); | 3048 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3049 | ShellClient *client; | 3049 | ShellClient *client; | ||
3050 | Surface *surface; | 3050 | Surface *surface; | ||
3051 | XdgShellSurface *shellSurface; | 3051 | XdgShellSurface *shellSurface; | ||
3052 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3052 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3053 | QVERIFY(client); | 3053 | QVERIFY(client); | ||
3054 | 3054 | | |||
3055 | // The client should be excluded from window switching effects. | 3055 | // The client should be excluded from window switching effects. | ||
3056 | QVERIFY(client->skipSwitcher()); | 3056 | QVERIFY(client->skipSwitcher()); | ||
3057 | 3057 | | |||
3058 | // Though one can change that. | 3058 | // Though one can change that. | ||
3059 | client->setSkipSwitcher(false); | 3059 | client->setSkipSwitcher(false); | ||
3060 | QVERIFY(!client->skipSwitcher()); | 3060 | QVERIFY(!client->skipSwitcher()); | ||
3061 | 3061 | | |||
3062 | // Reopen the client, the rule should be applied again. | 3062 | // Reopen the client, the rule should be applied again. | ||
3063 | delete shellSurface; | 3063 | delete shellSurface; | ||
3064 | delete surface; | 3064 | delete surface; | ||
3065 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3065 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3066 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3066 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3067 | QVERIFY(client); | 3067 | QVERIFY(client); | ||
3068 | QVERIFY(client->skipSwitcher()); | 3068 | QVERIFY(client->skipSwitcher()); | ||
3069 | 3069 | | |||
3070 | // Destroy the client. | 3070 | // Destroy the client. | ||
3071 | delete shellSurface; | 3071 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3072 | delete surface; | 3072 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3073 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3073 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3074 | } | 3074 | } | ||
3075 | 3075 | | |||
3076 | TEST_DATA(testSkipSwitcherRemember) | 3076 | TEST_DATA(testSkipSwitcherRemember) | ||
3077 | 3077 | | |||
3078 | void TestShellClientRules::testSkipSwitcherRemember() | 3078 | void TestShellClientRules::testSkipSwitcherRemember() | ||
3079 | { | 3079 | { | ||
3080 | // Initialize RuleBook with the test rule. | 3080 | // Initialize RuleBook with the test rule. | ||
3081 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3081 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3082 | config->group("General").writeEntry("count", 1); | 3082 | config->group("General").writeEntry("count", 1); | ||
3083 | KConfigGroup group = config->group("1"); | 3083 | KConfigGroup group = config->group("1"); | ||
3084 | group.writeEntry("skipswitcher", true); | 3084 | group.writeEntry("skipswitcher", true); | ||
3085 | group.writeEntry("skipswitcherrule", int(Rules::Remember)); | 3085 | group.writeEntry("skipswitcherrule", int(Rules::Remember)); | ||
3086 | group.writeEntry("wmclass", "org.kde.foo"); | 3086 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3087 | group.writeEntry("wmclasscomplete", false); | 3087 | group.writeEntry("wmclasscomplete", false); | ||
3088 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3088 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3089 | group.sync(); | 3089 | group.sync(); | ||
3090 | RuleBook::self()->setConfig(config); | 3090 | RuleBook::self()->setConfig(config); | ||
3091 | workspace()->slotReconfigure(); | 3091 | workspace()->slotReconfigure(); | ||
3092 | 3092 | | |||
3093 | // Create the test client. | 3093 | // Create the test client. | ||
3094 | QFETCH(Test::ShellSurfaceType, type); | 3094 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3095 | ShellClient *client; | 3095 | ShellClient *client; | ||
3096 | Surface *surface; | 3096 | Surface *surface; | ||
3097 | XdgShellSurface *shellSurface; | 3097 | XdgShellSurface *shellSurface; | ||
3098 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3098 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3099 | QVERIFY(client); | 3099 | QVERIFY(client); | ||
3100 | 3100 | | |||
3101 | // The client should be excluded from window switching effects. | 3101 | // The client should be excluded from window switching effects. | ||
3102 | QVERIFY(client->skipSwitcher()); | 3102 | QVERIFY(client->skipSwitcher()); | ||
3103 | 3103 | | |||
3104 | // Change the skip-switcher state. | 3104 | // Change the skip-switcher state. | ||
3105 | client->setSkipSwitcher(false); | 3105 | client->setSkipSwitcher(false); | ||
3106 | QVERIFY(!client->skipSwitcher()); | 3106 | QVERIFY(!client->skipSwitcher()); | ||
3107 | 3107 | | |||
3108 | // Reopen the client. | 3108 | // Reopen the client. | ||
3109 | delete shellSurface; | 3109 | delete shellSurface; | ||
3110 | delete surface; | 3110 | delete surface; | ||
3111 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3111 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3112 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3112 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3113 | QVERIFY(client); | 3113 | QVERIFY(client); | ||
3114 | 3114 | | |||
3115 | // The client should be included in window switching effects. | 3115 | // The client should be included in window switching effects. | ||
3116 | QVERIFY(!client->skipSwitcher()); | 3116 | QVERIFY(!client->skipSwitcher()); | ||
3117 | 3117 | | |||
3118 | // Destroy the client. | 3118 | // Destroy the client. | ||
3119 | delete shellSurface; | 3119 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3120 | delete surface; | 3120 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3121 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3121 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3122 | } | 3122 | } | ||
3123 | 3123 | | |||
3124 | TEST_DATA(testSkipSwitcherForce) | 3124 | TEST_DATA(testSkipSwitcherForce) | ||
3125 | 3125 | | |||
3126 | void TestShellClientRules::testSkipSwitcherForce() | 3126 | void TestShellClientRules::testSkipSwitcherForce() | ||
3127 | { | 3127 | { | ||
3128 | // Initialize RuleBook with the test rule. | 3128 | // Initialize RuleBook with the test rule. | ||
3129 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3129 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3130 | config->group("General").writeEntry("count", 1); | 3130 | config->group("General").writeEntry("count", 1); | ||
3131 | KConfigGroup group = config->group("1"); | 3131 | KConfigGroup group = config->group("1"); | ||
3132 | group.writeEntry("skipswitcher", true); | 3132 | group.writeEntry("skipswitcher", true); | ||
3133 | group.writeEntry("skipswitcherrule", int(Rules::Force)); | 3133 | group.writeEntry("skipswitcherrule", int(Rules::Force)); | ||
3134 | group.writeEntry("wmclass", "org.kde.foo"); | 3134 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3135 | group.writeEntry("wmclasscomplete", false); | 3135 | group.writeEntry("wmclasscomplete", false); | ||
3136 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3136 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3137 | group.sync(); | 3137 | group.sync(); | ||
3138 | RuleBook::self()->setConfig(config); | 3138 | RuleBook::self()->setConfig(config); | ||
3139 | workspace()->slotReconfigure(); | 3139 | workspace()->slotReconfigure(); | ||
3140 | 3140 | | |||
3141 | // Create the test client. | 3141 | // Create the test client. | ||
3142 | QFETCH(Test::ShellSurfaceType, type); | 3142 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3143 | ShellClient *client; | 3143 | ShellClient *client; | ||
3144 | Surface *surface; | 3144 | Surface *surface; | ||
3145 | XdgShellSurface *shellSurface; | 3145 | XdgShellSurface *shellSurface; | ||
3146 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3146 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3147 | QVERIFY(client); | 3147 | QVERIFY(client); | ||
3148 | 3148 | | |||
3149 | // The client should be excluded from window switching effects. | 3149 | // The client should be excluded from window switching effects. | ||
3150 | QVERIFY(client->skipSwitcher()); | 3150 | QVERIFY(client->skipSwitcher()); | ||
3151 | 3151 | | |||
3152 | // Any attempt to change the skip-switcher state should not succeed. | 3152 | // Any attempt to change the skip-switcher state should not succeed. | ||
3153 | client->setSkipSwitcher(false); | 3153 | client->setSkipSwitcher(false); | ||
3154 | QVERIFY(client->skipSwitcher()); | 3154 | QVERIFY(client->skipSwitcher()); | ||
3155 | 3155 | | |||
3156 | // Reopen the client. | 3156 | // Reopen the client. | ||
3157 | delete shellSurface; | 3157 | delete shellSurface; | ||
3158 | delete surface; | 3158 | delete surface; | ||
3159 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3159 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3160 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3160 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3161 | QVERIFY(client); | 3161 | QVERIFY(client); | ||
3162 | 3162 | | |||
3163 | // The skip-switcher state should be still forced. | 3163 | // The skip-switcher state should be still forced. | ||
3164 | QVERIFY(client->skipSwitcher()); | 3164 | QVERIFY(client->skipSwitcher()); | ||
3165 | 3165 | | |||
3166 | // Destroy the client. | 3166 | // Destroy the client. | ||
3167 | delete shellSurface; | 3167 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3168 | delete surface; | 3168 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3169 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3169 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3170 | } | 3170 | } | ||
3171 | 3171 | | |||
3172 | TEST_DATA(testSkipSwitcherApplyNow) | 3172 | TEST_DATA(testSkipSwitcherApplyNow) | ||
3173 | 3173 | | |||
3174 | void TestShellClientRules::testSkipSwitcherApplyNow() | 3174 | void TestShellClientRules::testSkipSwitcherApplyNow() | ||
3175 | { | 3175 | { | ||
3176 | // Create the test client. | 3176 | // Create the test client. | ||
3177 | QFETCH(Test::ShellSurfaceType, type); | 3177 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3178 | ShellClient *client; | 3178 | ShellClient *client; | ||
3179 | Surface *surface; | 3179 | Surface *surface; | ||
3180 | XdgShellSurface *shellSurface; | 3180 | XdgShellSurface *shellSurface; | ||
3181 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3181 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3182 | QVERIFY(client); | 3182 | QVERIFY(client); | ||
3183 | QVERIFY(!client->skipSwitcher()); | 3183 | QVERIFY(!client->skipSwitcher()); | ||
3184 | 3184 | | |||
3185 | // Initialize RuleBook with the test rule. | 3185 | // Initialize RuleBook with the test rule. | ||
Show All 39 Lines | 3218 | { | |||
3225 | group.writeEntry("wmclass", "org.kde.foo"); | 3225 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3226 | group.writeEntry("wmclasscomplete", false); | 3226 | group.writeEntry("wmclasscomplete", false); | ||
3227 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3227 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3228 | group.sync(); | 3228 | group.sync(); | ||
3229 | RuleBook::self()->setConfig(config); | 3229 | RuleBook::self()->setConfig(config); | ||
3230 | workspace()->slotReconfigure(); | 3230 | workspace()->slotReconfigure(); | ||
3231 | 3231 | | |||
3232 | // Create the test client. | 3232 | // Create the test client. | ||
3233 | QFETCH(Test::ShellSurfaceType, type); | 3233 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3234 | ShellClient *client; | 3234 | ShellClient *client; | ||
3235 | Surface *surface; | 3235 | Surface *surface; | ||
3236 | XdgShellSurface *shellSurface; | 3236 | XdgShellSurface *shellSurface; | ||
3237 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3237 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3238 | QVERIFY(client); | 3238 | QVERIFY(client); | ||
3239 | 3239 | | |||
3240 | // The client should be excluded from window switching effects. | 3240 | // The client should be excluded from window switching effects. | ||
3241 | QVERIFY(client->skipSwitcher()); | 3241 | QVERIFY(client->skipSwitcher()); | ||
Show All 10 Lines | |||||
3252 | QVERIFY(client); | 3252 | QVERIFY(client); | ||
3253 | QVERIFY(!client->skipSwitcher()); | 3253 | QVERIFY(!client->skipSwitcher()); | ||
3254 | 3254 | | |||
3255 | // The skip-switcher state is no longer forced. | 3255 | // The skip-switcher state is no longer forced. | ||
3256 | client->setSkipSwitcher(true); | 3256 | client->setSkipSwitcher(true); | ||
3257 | QVERIFY(client->skipSwitcher()); | 3257 | QVERIFY(client->skipSwitcher()); | ||
3258 | 3258 | | |||
3259 | // Destroy the client. | 3259 | // Destroy the client. | ||
3260 | delete shellSurface; | 3260 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3261 | delete surface; | 3261 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3262 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3262 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3263 | } | 3263 | } | ||
3264 | 3264 | | |||
3265 | TEST_DATA(testKeepAboveDontAffect) | 3265 | TEST_DATA(testKeepAboveDontAffect) | ||
3266 | 3266 | | |||
3267 | void TestShellClientRules::testKeepAboveDontAffect() | 3267 | void TestShellClientRules::testKeepAboveDontAffect() | ||
3268 | { | 3268 | { | ||
3269 | // Initialize RuleBook with the test rule. | 3269 | // Initialize RuleBook with the test rule. | ||
3270 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3270 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3271 | config->group("General").writeEntry("count", 1); | 3271 | config->group("General").writeEntry("count", 1); | ||
3272 | KConfigGroup group = config->group("1"); | 3272 | KConfigGroup group = config->group("1"); | ||
3273 | group.writeEntry("above", true); | 3273 | group.writeEntry("above", true); | ||
3274 | group.writeEntry("aboverule", int(Rules::DontAffect)); | 3274 | group.writeEntry("aboverule", int(Rules::DontAffect)); | ||
3275 | group.writeEntry("wmclass", "org.kde.foo"); | 3275 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3276 | group.writeEntry("wmclasscomplete", false); | 3276 | group.writeEntry("wmclasscomplete", false); | ||
3277 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3277 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3278 | group.sync(); | 3278 | group.sync(); | ||
3279 | RuleBook::self()->setConfig(config); | 3279 | RuleBook::self()->setConfig(config); | ||
3280 | workspace()->slotReconfigure(); | 3280 | workspace()->slotReconfigure(); | ||
3281 | 3281 | | |||
3282 | // Create the test client. | 3282 | // Create the test client. | ||
3283 | QFETCH(Test::ShellSurfaceType, type); | 3283 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3284 | ShellClient *client; | 3284 | ShellClient *client; | ||
3285 | Surface *surface; | 3285 | Surface *surface; | ||
3286 | XdgShellSurface *shellSurface; | 3286 | XdgShellSurface *shellSurface; | ||
3287 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3287 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3288 | QVERIFY(client); | 3288 | QVERIFY(client); | ||
3289 | 3289 | | |||
3290 | // The keep-above state of the client should not be affected by the rule. | 3290 | // The keep-above state of the client should not be affected by the rule. | ||
3291 | QVERIFY(!client->keepAbove()); | 3291 | QVERIFY(!client->keepAbove()); | ||
Show All 17 Lines | 3302 | { | |||
3309 | group.writeEntry("wmclass", "org.kde.foo"); | 3309 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3310 | group.writeEntry("wmclasscomplete", false); | 3310 | group.writeEntry("wmclasscomplete", false); | ||
3311 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3311 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3312 | group.sync(); | 3312 | group.sync(); | ||
3313 | RuleBook::self()->setConfig(config); | 3313 | RuleBook::self()->setConfig(config); | ||
3314 | workspace()->slotReconfigure(); | 3314 | workspace()->slotReconfigure(); | ||
3315 | 3315 | | |||
3316 | // Create the test client. | 3316 | // Create the test client. | ||
3317 | QFETCH(Test::ShellSurfaceType, type); | 3317 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3318 | ShellClient *client; | 3318 | ShellClient *client; | ||
3319 | Surface *surface; | 3319 | Surface *surface; | ||
3320 | XdgShellSurface *shellSurface; | 3320 | XdgShellSurface *shellSurface; | ||
3321 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3321 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3322 | QVERIFY(client); | 3322 | QVERIFY(client); | ||
3323 | 3323 | | |||
3324 | // Initially, the client should be kept above. | 3324 | // Initially, the client should be kept above. | ||
3325 | QVERIFY(client->keepAbove()); | 3325 | QVERIFY(client->keepAbove()); | ||
3326 | 3326 | | |||
3327 | // One should also be able to alter the keep-above state. | 3327 | // One should also be able to alter the keep-above state. | ||
3328 | client->setKeepAbove(false); | 3328 | client->setKeepAbove(false); | ||
3329 | QVERIFY(!client->keepAbove()); | 3329 | QVERIFY(!client->keepAbove()); | ||
3330 | 3330 | | |||
3331 | // If one re-opens the client, it should be kept above back again. | 3331 | // If one re-opens the client, it should be kept above back again. | ||
3332 | delete shellSurface; | 3332 | delete shellSurface; | ||
3333 | delete surface; | 3333 | delete surface; | ||
3334 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3334 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3335 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3335 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3336 | QVERIFY(client); | 3336 | QVERIFY(client); | ||
3337 | QVERIFY(client->keepAbove()); | 3337 | QVERIFY(client->keepAbove()); | ||
3338 | 3338 | | |||
3339 | // Destroy the client. | 3339 | // Destroy the client. | ||
3340 | delete shellSurface; | 3340 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3341 | delete surface; | 3341 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3342 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3342 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3343 | } | 3343 | } | ||
3344 | 3344 | | |||
3345 | TEST_DATA(testKeepAboveRemember) | 3345 | TEST_DATA(testKeepAboveRemember) | ||
3346 | 3346 | | |||
3347 | void TestShellClientRules::testKeepAboveRemember() | 3347 | void TestShellClientRules::testKeepAboveRemember() | ||
3348 | { | 3348 | { | ||
3349 | // Initialize RuleBook with the test rule. | 3349 | // Initialize RuleBook with the test rule. | ||
3350 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3350 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3351 | config->group("General").writeEntry("count", 1); | 3351 | config->group("General").writeEntry("count", 1); | ||
3352 | KConfigGroup group = config->group("1"); | 3352 | KConfigGroup group = config->group("1"); | ||
3353 | group.writeEntry("above", true); | 3353 | group.writeEntry("above", true); | ||
3354 | group.writeEntry("aboverule", int(Rules::Remember)); | 3354 | group.writeEntry("aboverule", int(Rules::Remember)); | ||
3355 | group.writeEntry("wmclass", "org.kde.foo"); | 3355 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3356 | group.writeEntry("wmclasscomplete", false); | 3356 | group.writeEntry("wmclasscomplete", false); | ||
3357 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3357 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3358 | group.sync(); | 3358 | group.sync(); | ||
3359 | RuleBook::self()->setConfig(config); | 3359 | RuleBook::self()->setConfig(config); | ||
3360 | workspace()->slotReconfigure(); | 3360 | workspace()->slotReconfigure(); | ||
3361 | 3361 | | |||
3362 | // Create the test client. | 3362 | // Create the test client. | ||
3363 | QFETCH(Test::ShellSurfaceType, type); | 3363 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3364 | ShellClient *client; | 3364 | ShellClient *client; | ||
3365 | Surface *surface; | 3365 | Surface *surface; | ||
3366 | XdgShellSurface *shellSurface; | 3366 | XdgShellSurface *shellSurface; | ||
3367 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3367 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3368 | QVERIFY(client); | 3368 | QVERIFY(client); | ||
3369 | 3369 | | |||
3370 | // Initially, the client should be kept above. | 3370 | // Initially, the client should be kept above. | ||
3371 | QVERIFY(client->keepAbove()); | 3371 | QVERIFY(client->keepAbove()); | ||
3372 | 3372 | | |||
3373 | // Unset the keep-above state. | 3373 | // Unset the keep-above state. | ||
3374 | client->setKeepAbove(false); | 3374 | client->setKeepAbove(false); | ||
3375 | QVERIFY(!client->keepAbove()); | 3375 | QVERIFY(!client->keepAbove()); | ||
3376 | delete shellSurface; | 3376 | delete shellSurface; | ||
3377 | delete surface; | 3377 | delete surface; | ||
3378 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3378 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3379 | 3379 | | |||
3380 | // Re-open the client, it should not be kept above. | 3380 | // Re-open the client, it should not be kept above. | ||
3381 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3381 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3382 | QVERIFY(client); | 3382 | QVERIFY(client); | ||
3383 | QVERIFY(!client->keepAbove()); | 3383 | QVERIFY(!client->keepAbove()); | ||
3384 | 3384 | | |||
3385 | // Destroy the client. | 3385 | // Destroy the client. | ||
3386 | delete shellSurface; | 3386 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3387 | delete surface; | 3387 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3388 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3388 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3389 | } | 3389 | } | ||
3390 | 3390 | | |||
3391 | TEST_DATA(testKeepAboveForce) | 3391 | TEST_DATA(testKeepAboveForce) | ||
3392 | 3392 | | |||
3393 | void TestShellClientRules::testKeepAboveForce() | 3393 | void TestShellClientRules::testKeepAboveForce() | ||
3394 | { | 3394 | { | ||
3395 | // Initialize RuleBook with the test rule. | 3395 | // Initialize RuleBook with the test rule. | ||
3396 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3396 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3397 | config->group("General").writeEntry("count", 1); | 3397 | config->group("General").writeEntry("count", 1); | ||
3398 | KConfigGroup group = config->group("1"); | 3398 | KConfigGroup group = config->group("1"); | ||
3399 | group.writeEntry("above", true); | 3399 | group.writeEntry("above", true); | ||
3400 | group.writeEntry("aboverule", int(Rules::Force)); | 3400 | group.writeEntry("aboverule", int(Rules::Force)); | ||
3401 | group.writeEntry("wmclass", "org.kde.foo"); | 3401 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3402 | group.writeEntry("wmclasscomplete", false); | 3402 | group.writeEntry("wmclasscomplete", false); | ||
3403 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3403 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3404 | group.sync(); | 3404 | group.sync(); | ||
3405 | RuleBook::self()->setConfig(config); | 3405 | RuleBook::self()->setConfig(config); | ||
3406 | workspace()->slotReconfigure(); | 3406 | workspace()->slotReconfigure(); | ||
3407 | 3407 | | |||
3408 | // Create the test client. | 3408 | // Create the test client. | ||
3409 | QFETCH(Test::ShellSurfaceType, type); | 3409 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3410 | ShellClient *client; | 3410 | ShellClient *client; | ||
3411 | Surface *surface; | 3411 | Surface *surface; | ||
3412 | XdgShellSurface *shellSurface; | 3412 | XdgShellSurface *shellSurface; | ||
3413 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3413 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3414 | QVERIFY(client); | 3414 | QVERIFY(client); | ||
3415 | 3415 | | |||
3416 | // Initially, the client should be kept above. | 3416 | // Initially, the client should be kept above. | ||
3417 | QVERIFY(client->keepAbove()); | 3417 | QVERIFY(client->keepAbove()); | ||
3418 | 3418 | | |||
3419 | // Any attemt to unset the keep-above should not succeed. | 3419 | // Any attemt to unset the keep-above should not succeed. | ||
3420 | client->setKeepAbove(false); | 3420 | client->setKeepAbove(false); | ||
3421 | QVERIFY(client->keepAbove()); | 3421 | QVERIFY(client->keepAbove()); | ||
3422 | 3422 | | |||
3423 | // If we re-open the client, it should still be kept above. | 3423 | // If we re-open the client, it should still be kept above. | ||
3424 | delete shellSurface; | 3424 | delete shellSurface; | ||
3425 | delete surface; | 3425 | delete surface; | ||
3426 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3426 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3427 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3427 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3428 | QVERIFY(client); | 3428 | QVERIFY(client); | ||
3429 | QVERIFY(client->keepAbove()); | 3429 | QVERIFY(client->keepAbove()); | ||
3430 | 3430 | | |||
3431 | // Destroy the client. | 3431 | // Destroy the client. | ||
3432 | delete shellSurface; | 3432 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3433 | delete surface; | 3433 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3434 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3434 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3435 | } | 3435 | } | ||
3436 | 3436 | | |||
3437 | TEST_DATA(testKeepAboveApplyNow) | 3437 | TEST_DATA(testKeepAboveApplyNow) | ||
3438 | 3438 | | |||
3439 | void TestShellClientRules::testKeepAboveApplyNow() | 3439 | void TestShellClientRules::testKeepAboveApplyNow() | ||
3440 | { | 3440 | { | ||
3441 | // Create the test client. | 3441 | // Create the test client. | ||
3442 | QFETCH(Test::ShellSurfaceType, type); | 3442 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3443 | ShellClient *client; | 3443 | ShellClient *client; | ||
3444 | Surface *surface; | 3444 | Surface *surface; | ||
3445 | XdgShellSurface *shellSurface; | 3445 | XdgShellSurface *shellSurface; | ||
3446 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3446 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3447 | QVERIFY(client); | 3447 | QVERIFY(client); | ||
3448 | QVERIFY(!client->keepAbove()); | 3448 | QVERIFY(!client->keepAbove()); | ||
3449 | 3449 | | |||
3450 | // Initialize RuleBook with the test rule. | 3450 | // Initialize RuleBook with the test rule. | ||
Show All 39 Lines | 3483 | { | |||
3490 | group.writeEntry("wmclass", "org.kde.foo"); | 3490 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3491 | group.writeEntry("wmclasscomplete", false); | 3491 | group.writeEntry("wmclasscomplete", false); | ||
3492 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3492 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3493 | group.sync(); | 3493 | group.sync(); | ||
3494 | RuleBook::self()->setConfig(config); | 3494 | RuleBook::self()->setConfig(config); | ||
3495 | workspace()->slotReconfigure(); | 3495 | workspace()->slotReconfigure(); | ||
3496 | 3496 | | |||
3497 | // Create the test client. | 3497 | // Create the test client. | ||
3498 | QFETCH(Test::ShellSurfaceType, type); | 3498 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3499 | ShellClient *client; | 3499 | ShellClient *client; | ||
3500 | Surface *surface; | 3500 | Surface *surface; | ||
3501 | XdgShellSurface *shellSurface; | 3501 | XdgShellSurface *shellSurface; | ||
3502 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3502 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3503 | QVERIFY(client); | 3503 | QVERIFY(client); | ||
3504 | 3504 | | |||
3505 | // Initially, the client should be kept above. | 3505 | // Initially, the client should be kept above. | ||
3506 | QVERIFY(client->keepAbove()); | 3506 | QVERIFY(client->keepAbove()); | ||
Show All 12 Lines | |||||
3519 | 3519 | | |||
3520 | // The keep-above state is no longer forced. | 3520 | // The keep-above state is no longer forced. | ||
3521 | client->setKeepAbove(true); | 3521 | client->setKeepAbove(true); | ||
3522 | QVERIFY(client->keepAbove()); | 3522 | QVERIFY(client->keepAbove()); | ||
3523 | client->setKeepAbove(false); | 3523 | client->setKeepAbove(false); | ||
3524 | QVERIFY(!client->keepAbove()); | 3524 | QVERIFY(!client->keepAbove()); | ||
3525 | 3525 | | |||
3526 | // Destroy the client. | 3526 | // Destroy the client. | ||
3527 | delete shellSurface; | 3527 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3528 | delete surface; | 3528 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3529 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3529 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3530 | } | 3530 | } | ||
3531 | 3531 | | |||
3532 | TEST_DATA(testKeepBelowDontAffect) | 3532 | TEST_DATA(testKeepBelowDontAffect) | ||
3533 | 3533 | | |||
3534 | void TestShellClientRules::testKeepBelowDontAffect() | 3534 | void TestShellClientRules::testKeepBelowDontAffect() | ||
3535 | { | 3535 | { | ||
3536 | // Initialize RuleBook with the test rule. | 3536 | // Initialize RuleBook with the test rule. | ||
3537 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3537 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3538 | config->group("General").writeEntry("count", 1); | 3538 | config->group("General").writeEntry("count", 1); | ||
3539 | KConfigGroup group = config->group("1"); | 3539 | KConfigGroup group = config->group("1"); | ||
3540 | group.writeEntry("below", true); | 3540 | group.writeEntry("below", true); | ||
3541 | group.writeEntry("belowrule", int(Rules::DontAffect)); | 3541 | group.writeEntry("belowrule", int(Rules::DontAffect)); | ||
3542 | group.writeEntry("wmclass", "org.kde.foo"); | 3542 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3543 | group.writeEntry("wmclasscomplete", false); | 3543 | group.writeEntry("wmclasscomplete", false); | ||
3544 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3544 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3545 | group.sync(); | 3545 | group.sync(); | ||
3546 | RuleBook::self()->setConfig(config); | 3546 | RuleBook::self()->setConfig(config); | ||
3547 | workspace()->slotReconfigure(); | 3547 | workspace()->slotReconfigure(); | ||
3548 | 3548 | | |||
3549 | // Create the test client. | 3549 | // Create the test client. | ||
3550 | QFETCH(Test::ShellSurfaceType, type); | 3550 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3551 | ShellClient *client; | 3551 | ShellClient *client; | ||
3552 | Surface *surface; | 3552 | Surface *surface; | ||
3553 | XdgShellSurface *shellSurface; | 3553 | XdgShellSurface *shellSurface; | ||
3554 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3554 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3555 | QVERIFY(client); | 3555 | QVERIFY(client); | ||
3556 | 3556 | | |||
3557 | // The keep-below state of the client should not be affected by the rule. | 3557 | // The keep-below state of the client should not be affected by the rule. | ||
3558 | QVERIFY(!client->keepBelow()); | 3558 | QVERIFY(!client->keepBelow()); | ||
Show All 17 Lines | 3569 | { | |||
3576 | group.writeEntry("wmclass", "org.kde.foo"); | 3576 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3577 | group.writeEntry("wmclasscomplete", false); | 3577 | group.writeEntry("wmclasscomplete", false); | ||
3578 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3578 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3579 | group.sync(); | 3579 | group.sync(); | ||
3580 | RuleBook::self()->setConfig(config); | 3580 | RuleBook::self()->setConfig(config); | ||
3581 | workspace()->slotReconfigure(); | 3581 | workspace()->slotReconfigure(); | ||
3582 | 3582 | | |||
3583 | // Create the test client. | 3583 | // Create the test client. | ||
3584 | QFETCH(Test::ShellSurfaceType, type); | 3584 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3585 | ShellClient *client; | 3585 | ShellClient *client; | ||
3586 | Surface *surface; | 3586 | Surface *surface; | ||
3587 | XdgShellSurface *shellSurface; | 3587 | XdgShellSurface *shellSurface; | ||
3588 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3588 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3589 | QVERIFY(client); | 3589 | QVERIFY(client); | ||
3590 | 3590 | | |||
3591 | // Initially, the client should be kept below. | 3591 | // Initially, the client should be kept below. | ||
3592 | QVERIFY(client->keepBelow()); | 3592 | QVERIFY(client->keepBelow()); | ||
3593 | 3593 | | |||
3594 | // One should also be able to alter the keep-below state. | 3594 | // One should also be able to alter the keep-below state. | ||
3595 | client->setKeepBelow(false); | 3595 | client->setKeepBelow(false); | ||
3596 | QVERIFY(!client->keepBelow()); | 3596 | QVERIFY(!client->keepBelow()); | ||
3597 | 3597 | | |||
3598 | // If one re-opens the client, it should be kept above back again. | 3598 | // If one re-opens the client, it should be kept above back again. | ||
3599 | delete shellSurface; | 3599 | delete shellSurface; | ||
3600 | delete surface; | 3600 | delete surface; | ||
3601 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3601 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3602 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3602 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3603 | QVERIFY(client); | 3603 | QVERIFY(client); | ||
3604 | QVERIFY(client->keepBelow()); | 3604 | QVERIFY(client->keepBelow()); | ||
3605 | 3605 | | |||
3606 | // Destroy the client. | 3606 | // Destroy the client. | ||
3607 | delete shellSurface; | 3607 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3608 | delete surface; | 3608 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3609 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3609 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3610 | } | 3610 | } | ||
3611 | 3611 | | |||
3612 | TEST_DATA(testKeepBelowRemember) | 3612 | TEST_DATA(testKeepBelowRemember) | ||
3613 | 3613 | | |||
3614 | void TestShellClientRules::testKeepBelowRemember() | 3614 | void TestShellClientRules::testKeepBelowRemember() | ||
3615 | { | 3615 | { | ||
3616 | // Initialize RuleBook with the test rule. | 3616 | // Initialize RuleBook with the test rule. | ||
3617 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3617 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3618 | config->group("General").writeEntry("count", 1); | 3618 | config->group("General").writeEntry("count", 1); | ||
3619 | KConfigGroup group = config->group("1"); | 3619 | KConfigGroup group = config->group("1"); | ||
3620 | group.writeEntry("below", true); | 3620 | group.writeEntry("below", true); | ||
3621 | group.writeEntry("belowrule", int(Rules::Remember)); | 3621 | group.writeEntry("belowrule", int(Rules::Remember)); | ||
3622 | group.writeEntry("wmclass", "org.kde.foo"); | 3622 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3623 | group.writeEntry("wmclasscomplete", false); | 3623 | group.writeEntry("wmclasscomplete", false); | ||
3624 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3624 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3625 | group.sync(); | 3625 | group.sync(); | ||
3626 | RuleBook::self()->setConfig(config); | 3626 | RuleBook::self()->setConfig(config); | ||
3627 | workspace()->slotReconfigure(); | 3627 | workspace()->slotReconfigure(); | ||
3628 | 3628 | | |||
3629 | // Create the test client. | 3629 | // Create the test client. | ||
3630 | QFETCH(Test::ShellSurfaceType, type); | 3630 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3631 | ShellClient *client; | 3631 | ShellClient *client; | ||
3632 | Surface *surface; | 3632 | Surface *surface; | ||
3633 | XdgShellSurface *shellSurface; | 3633 | XdgShellSurface *shellSurface; | ||
3634 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3634 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3635 | QVERIFY(client); | 3635 | QVERIFY(client); | ||
3636 | 3636 | | |||
3637 | // Initially, the client should be kept below. | 3637 | // Initially, the client should be kept below. | ||
3638 | QVERIFY(client->keepBelow()); | 3638 | QVERIFY(client->keepBelow()); | ||
3639 | 3639 | | |||
3640 | // Unset the keep-below state. | 3640 | // Unset the keep-below state. | ||
3641 | client->setKeepBelow(false); | 3641 | client->setKeepBelow(false); | ||
3642 | QVERIFY(!client->keepBelow()); | 3642 | QVERIFY(!client->keepBelow()); | ||
3643 | delete shellSurface; | 3643 | delete shellSurface; | ||
3644 | delete surface; | 3644 | delete surface; | ||
3645 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3645 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3646 | 3646 | | |||
3647 | // Re-open the client, it should not be kept below. | 3647 | // Re-open the client, it should not be kept below. | ||
3648 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3648 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3649 | QVERIFY(client); | 3649 | QVERIFY(client); | ||
3650 | QVERIFY(!client->keepBelow()); | 3650 | QVERIFY(!client->keepBelow()); | ||
3651 | 3651 | | |||
3652 | // Destroy the client. | 3652 | // Destroy the client. | ||
3653 | delete shellSurface; | 3653 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3654 | delete surface; | 3654 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3655 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3655 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3656 | } | 3656 | } | ||
3657 | 3657 | | |||
3658 | TEST_DATA(testKeepBelowForce) | 3658 | TEST_DATA(testKeepBelowForce) | ||
3659 | 3659 | | |||
3660 | void TestShellClientRules::testKeepBelowForce() | 3660 | void TestShellClientRules::testKeepBelowForce() | ||
3661 | { | 3661 | { | ||
3662 | // Initialize RuleBook with the test rule. | 3662 | // Initialize RuleBook with the test rule. | ||
3663 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3663 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3664 | config->group("General").writeEntry("count", 1); | 3664 | config->group("General").writeEntry("count", 1); | ||
3665 | KConfigGroup group = config->group("1"); | 3665 | KConfigGroup group = config->group("1"); | ||
3666 | group.writeEntry("below", true); | 3666 | group.writeEntry("below", true); | ||
3667 | group.writeEntry("belowrule", int(Rules::Force)); | 3667 | group.writeEntry("belowrule", int(Rules::Force)); | ||
3668 | group.writeEntry("wmclass", "org.kde.foo"); | 3668 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3669 | group.writeEntry("wmclasscomplete", false); | 3669 | group.writeEntry("wmclasscomplete", false); | ||
3670 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3670 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3671 | group.sync(); | 3671 | group.sync(); | ||
3672 | RuleBook::self()->setConfig(config); | 3672 | RuleBook::self()->setConfig(config); | ||
3673 | workspace()->slotReconfigure(); | 3673 | workspace()->slotReconfigure(); | ||
3674 | 3674 | | |||
3675 | // Create the test client. | 3675 | // Create the test client. | ||
3676 | QFETCH(Test::ShellSurfaceType, type); | 3676 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3677 | ShellClient *client; | 3677 | ShellClient *client; | ||
3678 | Surface *surface; | 3678 | Surface *surface; | ||
3679 | XdgShellSurface *shellSurface; | 3679 | XdgShellSurface *shellSurface; | ||
3680 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3680 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3681 | QVERIFY(client); | 3681 | QVERIFY(client); | ||
3682 | 3682 | | |||
3683 | // Initially, the client should be kept below. | 3683 | // Initially, the client should be kept below. | ||
3684 | QVERIFY(client->keepBelow()); | 3684 | QVERIFY(client->keepBelow()); | ||
3685 | 3685 | | |||
3686 | // Any attemt to unset the keep-below should not succeed. | 3686 | // Any attemt to unset the keep-below should not succeed. | ||
3687 | client->setKeepBelow(false); | 3687 | client->setKeepBelow(false); | ||
3688 | QVERIFY(client->keepBelow()); | 3688 | QVERIFY(client->keepBelow()); | ||
3689 | 3689 | | |||
3690 | // If we re-open the client, it should still be kept below. | 3690 | // If we re-open the client, it should still be kept below. | ||
3691 | delete shellSurface; | 3691 | delete shellSurface; | ||
3692 | delete surface; | 3692 | delete surface; | ||
3693 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3693 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3694 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3694 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3695 | QVERIFY(client); | 3695 | QVERIFY(client); | ||
3696 | QVERIFY(client->keepBelow()); | 3696 | QVERIFY(client->keepBelow()); | ||
3697 | 3697 | | |||
3698 | // Destroy the client. | 3698 | // Destroy the client. | ||
3699 | delete shellSurface; | 3699 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3700 | delete surface; | 3700 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3701 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3701 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3702 | } | 3702 | } | ||
3703 | 3703 | | |||
3704 | TEST_DATA(testKeepBelowApplyNow) | 3704 | TEST_DATA(testKeepBelowApplyNow) | ||
3705 | 3705 | | |||
3706 | void TestShellClientRules::testKeepBelowApplyNow() | 3706 | void TestShellClientRules::testKeepBelowApplyNow() | ||
3707 | { | 3707 | { | ||
3708 | // Create the test client. | 3708 | // Create the test client. | ||
3709 | QFETCH(Test::ShellSurfaceType, type); | 3709 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3710 | ShellClient *client; | 3710 | ShellClient *client; | ||
3711 | Surface *surface; | 3711 | Surface *surface; | ||
3712 | XdgShellSurface *shellSurface; | 3712 | XdgShellSurface *shellSurface; | ||
3713 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3713 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3714 | QVERIFY(client); | 3714 | QVERIFY(client); | ||
3715 | QVERIFY(!client->keepBelow()); | 3715 | QVERIFY(!client->keepBelow()); | ||
3716 | 3716 | | |||
3717 | // Initialize RuleBook with the test rule. | 3717 | // Initialize RuleBook with the test rule. | ||
Show All 39 Lines | 3750 | { | |||
3757 | group.writeEntry("wmclass", "org.kde.foo"); | 3757 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3758 | group.writeEntry("wmclasscomplete", false); | 3758 | group.writeEntry("wmclasscomplete", false); | ||
3759 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3759 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3760 | group.sync(); | 3760 | group.sync(); | ||
3761 | RuleBook::self()->setConfig(config); | 3761 | RuleBook::self()->setConfig(config); | ||
3762 | workspace()->slotReconfigure(); | 3762 | workspace()->slotReconfigure(); | ||
3763 | 3763 | | |||
3764 | // Create the test client. | 3764 | // Create the test client. | ||
3765 | QFETCH(Test::ShellSurfaceType, type); | 3765 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3766 | ShellClient *client; | 3766 | ShellClient *client; | ||
3767 | Surface *surface; | 3767 | Surface *surface; | ||
3768 | XdgShellSurface *shellSurface; | 3768 | XdgShellSurface *shellSurface; | ||
3769 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3769 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3770 | QVERIFY(client); | 3770 | QVERIFY(client); | ||
3771 | 3771 | | |||
3772 | // Initially, the client should be kept below. | 3772 | // Initially, the client should be kept below. | ||
3773 | QVERIFY(client->keepBelow()); | 3773 | QVERIFY(client->keepBelow()); | ||
Show All 12 Lines | |||||
3786 | 3786 | | |||
3787 | // The keep-below state is no longer forced. | 3787 | // The keep-below state is no longer forced. | ||
3788 | client->setKeepBelow(true); | 3788 | client->setKeepBelow(true); | ||
3789 | QVERIFY(client->keepBelow()); | 3789 | QVERIFY(client->keepBelow()); | ||
3790 | client->setKeepBelow(false); | 3790 | client->setKeepBelow(false); | ||
3791 | QVERIFY(!client->keepBelow()); | 3791 | QVERIFY(!client->keepBelow()); | ||
3792 | 3792 | | |||
3793 | // Destroy the client. | 3793 | // Destroy the client. | ||
3794 | delete shellSurface; | 3794 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3795 | delete surface; | 3795 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3796 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3796 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3797 | } | 3797 | } | ||
3798 | 3798 | | |||
3799 | TEST_DATA(testShortcutDontAffect) | 3799 | TEST_DATA(testShortcutDontAffect) | ||
3800 | 3800 | | |||
3801 | void TestShellClientRules::testShortcutDontAffect() | 3801 | void TestShellClientRules::testShortcutDontAffect() | ||
3802 | { | 3802 | { | ||
3803 | // Initialize RuleBook with the test rule. | 3803 | // Initialize RuleBook with the test rule. | ||
3804 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3804 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3805 | config->group("General").writeEntry("count", 1); | 3805 | config->group("General").writeEntry("count", 1); | ||
3806 | KConfigGroup group = config->group("1"); | 3806 | KConfigGroup group = config->group("1"); | ||
3807 | group.writeEntry("shortcut", "Ctrl+Alt+1"); | 3807 | group.writeEntry("shortcut", "Ctrl+Alt+1"); | ||
3808 | group.writeEntry("shortcutrule", int(Rules::DontAffect)); | 3808 | group.writeEntry("shortcutrule", int(Rules::DontAffect)); | ||
3809 | group.writeEntry("wmclass", "org.kde.foo"); | 3809 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3810 | group.writeEntry("wmclasscomplete", false); | 3810 | group.writeEntry("wmclasscomplete", false); | ||
3811 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3811 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3812 | group.sync(); | 3812 | group.sync(); | ||
3813 | RuleBook::self()->setConfig(config); | 3813 | RuleBook::self()->setConfig(config); | ||
3814 | workspace()->slotReconfigure(); | 3814 | workspace()->slotReconfigure(); | ||
3815 | 3815 | | |||
3816 | // Create the test client. | 3816 | // Create the test client. | ||
3817 | QFETCH(Test::ShellSurfaceType, type); | 3817 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3818 | ShellClient *client; | 3818 | ShellClient *client; | ||
3819 | Surface *surface; | 3819 | Surface *surface; | ||
3820 | XdgShellSurface *shellSurface; | 3820 | XdgShellSurface *shellSurface; | ||
3821 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3821 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3822 | QVERIFY(client); | 3822 | QVERIFY(client); | ||
3823 | QCOMPARE(client->shortcut(), QKeySequence()); | 3823 | QCOMPARE(client->shortcut(), QKeySequence()); | ||
3824 | client->minimize(); | 3824 | client->minimize(); | ||
3825 | QVERIFY(client->isMinimized()); | 3825 | QVERIFY(client->isMinimized()); | ||
Show All 30 Lines | 3849 | { | |||
3856 | group.writeEntry("wmclass", "org.kde.foo"); | 3856 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3857 | group.writeEntry("wmclasscomplete", false); | 3857 | group.writeEntry("wmclasscomplete", false); | ||
3858 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3858 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3859 | group.sync(); | 3859 | group.sync(); | ||
3860 | RuleBook::self()->setConfig(config); | 3860 | RuleBook::self()->setConfig(config); | ||
3861 | workspace()->slotReconfigure(); | 3861 | workspace()->slotReconfigure(); | ||
3862 | 3862 | | |||
3863 | // Create the test client. | 3863 | // Create the test client. | ||
3864 | QFETCH(Test::ShellSurfaceType, type); | 3864 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3865 | ShellClient *client; | 3865 | ShellClient *client; | ||
3866 | Surface *surface; | 3866 | Surface *surface; | ||
3867 | XdgShellSurface *shellSurface; | 3867 | XdgShellSurface *shellSurface; | ||
3868 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3868 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3869 | QVERIFY(client); | 3869 | QVERIFY(client); | ||
3870 | 3870 | | |||
3871 | // If we press the window shortcut, the window should be brought back to user. | 3871 | // If we press the window shortcut, the window should be brought back to user. | ||
3872 | QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized); | 3872 | QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized); | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | |||||
3916 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3916 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3917 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3917 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3918 | QVERIFY(client); | 3918 | QVERIFY(client); | ||
3919 | 3919 | | |||
3920 | // The window shortcut should be set back to Ctrl+Alt+1. | 3920 | // The window shortcut should be set back to Ctrl+Alt+1. | ||
3921 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | 3921 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | ||
3922 | 3922 | | |||
3923 | // Destroy the client. | 3923 | // Destroy the client. | ||
3924 | delete shellSurface; | 3924 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3925 | delete surface; | 3925 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3926 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3926 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3927 | } | 3927 | } | ||
3928 | 3928 | | |||
3929 | TEST_DATA(testShortcutRemember) | 3929 | TEST_DATA(testShortcutRemember) | ||
3930 | 3930 | | |||
3931 | void TestShellClientRules::testShortcutRemember() | 3931 | void TestShellClientRules::testShortcutRemember() | ||
3932 | { | 3932 | { | ||
3933 | QSKIP("KWin core doesn't try to save the last used window shortcut"); | 3933 | QSKIP("KWin core doesn't try to save the last used window shortcut"); | ||
3934 | 3934 | | |||
3935 | // Initialize RuleBook with the test rule. | 3935 | // Initialize RuleBook with the test rule. | ||
3936 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 3936 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
3937 | config->group("General").writeEntry("count", 1); | 3937 | config->group("General").writeEntry("count", 1); | ||
3938 | KConfigGroup group = config->group("1"); | 3938 | KConfigGroup group = config->group("1"); | ||
3939 | group.writeEntry("shortcut", "Ctrl+Alt+1"); | 3939 | group.writeEntry("shortcut", "Ctrl+Alt+1"); | ||
3940 | group.writeEntry("shortcutrule", int(Rules::Remember)); | 3940 | group.writeEntry("shortcutrule", int(Rules::Remember)); | ||
3941 | group.writeEntry("wmclass", "org.kde.foo"); | 3941 | group.writeEntry("wmclass", "org.kde.foo"); | ||
3942 | group.writeEntry("wmclasscomplete", false); | 3942 | group.writeEntry("wmclasscomplete", false); | ||
3943 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 3943 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
3944 | group.sync(); | 3944 | group.sync(); | ||
3945 | RuleBook::self()->setConfig(config); | 3945 | RuleBook::self()->setConfig(config); | ||
3946 | workspace()->slotReconfigure(); | 3946 | workspace()->slotReconfigure(); | ||
3947 | 3947 | | |||
3948 | // Create the test client. | 3948 | // Create the test client. | ||
3949 | QFETCH(Test::ShellSurfaceType, type); | 3949 | QFETCH(Test::XdgShellSurfaceType, type); | ||
3950 | ShellClient *client; | 3950 | ShellClient *client; | ||
3951 | Surface *surface; | 3951 | Surface *surface; | ||
3952 | XdgShellSurface *shellSurface; | 3952 | XdgShellSurface *shellSurface; | ||
3953 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3953 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3954 | QVERIFY(client); | 3954 | QVERIFY(client); | ||
3955 | 3955 | | |||
3956 | // If we press the window shortcut, the window should be brought back to user. | 3956 | // If we press the window shortcut, the window should be brought back to user. | ||
3957 | QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized); | 3957 | QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized); | ||
Show All 31 Lines | |||||
3989 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3989 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
3990 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 3990 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
3991 | QVERIFY(client); | 3991 | QVERIFY(client); | ||
3992 | 3992 | | |||
3993 | // The window shortcut should be set to the last known value. | 3993 | // The window shortcut should be set to the last known value. | ||
3994 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_2})); | 3994 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_2})); | ||
3995 | 3995 | | |||
3996 | // Destroy the client. | 3996 | // Destroy the client. | ||
3997 | delete shellSurface; | 3997 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
3998 | delete surface; | 3998 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
3999 | QVERIFY(Test::waitForWindowDestroyed(client)); | 3999 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4000 | } | 4000 | } | ||
4001 | 4001 | | |||
4002 | TEST_DATA(testShortcutForce) | 4002 | TEST_DATA(testShortcutForce) | ||
4003 | 4003 | | |||
4004 | void TestShellClientRules::testShortcutForce() | 4004 | void TestShellClientRules::testShortcutForce() | ||
4005 | { | 4005 | { | ||
4006 | QSKIP("KWin core can't release forced window shortcuts"); | 4006 | QSKIP("KWin core can't release forced window shortcuts"); | ||
4007 | 4007 | | |||
4008 | // Initialize RuleBook with the test rule. | 4008 | // Initialize RuleBook with the test rule. | ||
4009 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 4009 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
4010 | config->group("General").writeEntry("count", 1); | 4010 | config->group("General").writeEntry("count", 1); | ||
4011 | KConfigGroup group = config->group("1"); | 4011 | KConfigGroup group = config->group("1"); | ||
4012 | group.writeEntry("shortcut", "Ctrl+Alt+1"); | 4012 | group.writeEntry("shortcut", "Ctrl+Alt+1"); | ||
4013 | group.writeEntry("shortcutrule", int(Rules::Force)); | 4013 | group.writeEntry("shortcutrule", int(Rules::Force)); | ||
4014 | group.writeEntry("wmclass", "org.kde.foo"); | 4014 | group.writeEntry("wmclass", "org.kde.foo"); | ||
4015 | group.writeEntry("wmclasscomplete", false); | 4015 | group.writeEntry("wmclasscomplete", false); | ||
4016 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 4016 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
4017 | group.sync(); | 4017 | group.sync(); | ||
4018 | RuleBook::self()->setConfig(config); | 4018 | RuleBook::self()->setConfig(config); | ||
4019 | workspace()->slotReconfigure(); | 4019 | workspace()->slotReconfigure(); | ||
4020 | 4020 | | |||
4021 | // Create the test client. | 4021 | // Create the test client. | ||
4022 | QFETCH(Test::ShellSurfaceType, type); | 4022 | QFETCH(Test::XdgShellSurfaceType, type); | ||
4023 | ShellClient *client; | 4023 | ShellClient *client; | ||
4024 | Surface *surface; | 4024 | Surface *surface; | ||
4025 | XdgShellSurface *shellSurface; | 4025 | XdgShellSurface *shellSurface; | ||
4026 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4026 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4027 | QVERIFY(client); | 4027 | QVERIFY(client); | ||
4028 | 4028 | | |||
4029 | // If we press the window shortcut, the window should be brought back to user. | 4029 | // If we press the window shortcut, the window should be brought back to user. | ||
4030 | QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized); | 4030 | QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized); | ||
Show All 31 Lines | |||||
4062 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4062 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4063 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4063 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4064 | QVERIFY(client); | 4064 | QVERIFY(client); | ||
4065 | 4065 | | |||
4066 | // The window shortcut should still be forced. | 4066 | // The window shortcut should still be forced. | ||
4067 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | 4067 | QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL + Qt::ALT + Qt::Key_1})); | ||
4068 | 4068 | | |||
4069 | // Destroy the client. | 4069 | // Destroy the client. | ||
4070 | delete shellSurface; | 4070 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
4071 | delete surface; | 4071 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
4072 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4072 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4073 | } | 4073 | } | ||
4074 | 4074 | | |||
4075 | TEST_DATA(testShortcutApplyNow) | 4075 | TEST_DATA(testShortcutApplyNow) | ||
4076 | 4076 | | |||
4077 | void TestShellClientRules::testShortcutApplyNow() | 4077 | void TestShellClientRules::testShortcutApplyNow() | ||
4078 | { | 4078 | { | ||
4079 | // Create the test client. | 4079 | // Create the test client. | ||
4080 | QFETCH(Test::ShellSurfaceType, type); | 4080 | QFETCH(Test::XdgShellSurfaceType, type); | ||
4081 | ShellClient *client; | 4081 | ShellClient *client; | ||
4082 | Surface *surface; | 4082 | Surface *surface; | ||
4083 | XdgShellSurface *shellSurface; | 4083 | XdgShellSurface *shellSurface; | ||
4084 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4084 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4085 | QVERIFY(client); | 4085 | QVERIFY(client); | ||
4086 | QVERIFY(client->shortcut().isEmpty()); | 4086 | QVERIFY(client->shortcut().isEmpty()); | ||
4087 | 4087 | | |||
4088 | // Initialize RuleBook with the test rule. | 4088 | // Initialize RuleBook with the test rule. | ||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Line(s) | 4144 | { | |||
4153 | group.writeEntry("wmclass", "org.kde.foo"); | 4153 | group.writeEntry("wmclass", "org.kde.foo"); | ||
4154 | group.writeEntry("wmclasscomplete", false); | 4154 | group.writeEntry("wmclasscomplete", false); | ||
4155 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 4155 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
4156 | group.sync(); | 4156 | group.sync(); | ||
4157 | RuleBook::self()->setConfig(config); | 4157 | RuleBook::self()->setConfig(config); | ||
4158 | workspace()->slotReconfigure(); | 4158 | workspace()->slotReconfigure(); | ||
4159 | 4159 | | |||
4160 | // Create the test client. | 4160 | // Create the test client. | ||
4161 | QFETCH(Test::ShellSurfaceType, type); | 4161 | QFETCH(Test::XdgShellSurfaceType, type); | ||
4162 | ShellClient *client; | 4162 | ShellClient *client; | ||
4163 | Surface *surface; | 4163 | Surface *surface; | ||
4164 | XdgShellSurface *shellSurface; | 4164 | XdgShellSurface *shellSurface; | ||
4165 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4165 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4166 | QVERIFY(client); | 4166 | QVERIFY(client); | ||
4167 | 4167 | | |||
4168 | // If we press the window shortcut, the window should be brought back to user. | 4168 | // If we press the window shortcut, the window should be brought back to user. | ||
4169 | QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized); | 4169 | QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized); | ||
Show All 29 Lines | |||||
4199 | delete shellSurface; | 4199 | delete shellSurface; | ||
4200 | delete surface; | 4200 | delete surface; | ||
4201 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4201 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4202 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4202 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4203 | QVERIFY(client); | 4203 | QVERIFY(client); | ||
4204 | QVERIFY(client->shortcut().isEmpty()); | 4204 | QVERIFY(client->shortcut().isEmpty()); | ||
4205 | 4205 | | |||
4206 | // Destroy the client. | 4206 | // Destroy the client. | ||
4207 | delete shellSurface; | 4207 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
4208 | delete surface; | 4208 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
4209 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4209 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4210 | } | 4210 | } | ||
4211 | 4211 | | |||
4212 | TEST_DATA(testDesktopFileDontAffect) | 4212 | TEST_DATA(testDesktopFileDontAffect) | ||
4213 | 4213 | | |||
4214 | void TestShellClientRules::testDesktopFileDontAffect() | 4214 | void TestShellClientRules::testDesktopFileDontAffect() | ||
4215 | { | 4215 | { | ||
4216 | // Currently, the desktop file name is derived from the app id. If the app id is | 4216 | // Currently, the desktop file name is derived from the app id. If the app id is | ||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 4275 | { | |||
4282 | group.writeEntry("wmclass", "org.kde.foo"); | 4282 | group.writeEntry("wmclass", "org.kde.foo"); | ||
4283 | group.writeEntry("wmclasscomplete", false); | 4283 | group.writeEntry("wmclasscomplete", false); | ||
4284 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 4284 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
4285 | group.sync(); | 4285 | group.sync(); | ||
4286 | RuleBook::self()->setConfig(config); | 4286 | RuleBook::self()->setConfig(config); | ||
4287 | workspace()->slotReconfigure(); | 4287 | workspace()->slotReconfigure(); | ||
4288 | 4288 | | |||
4289 | // Create the test client. | 4289 | // Create the test client. | ||
4290 | QFETCH(Test::ShellSurfaceType, type); | 4290 | QFETCH(Test::XdgShellSurfaceType, type); | ||
4291 | ShellClient *client; | 4291 | ShellClient *client; | ||
4292 | Surface *surface; | 4292 | Surface *surface; | ||
4293 | XdgShellSurface *shellSurface; | 4293 | XdgShellSurface *shellSurface; | ||
4294 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4294 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4295 | QVERIFY(client); | 4295 | QVERIFY(client); | ||
4296 | QVERIFY(client->isActive()); | 4296 | QVERIFY(client->isActive()); | ||
4297 | 4297 | | |||
4298 | // The opacity should not be affected by the rule. | 4298 | // The opacity should not be affected by the rule. | ||
Show All 18 Lines | 4310 | { | |||
4317 | group.writeEntry("wmclass", "org.kde.foo"); | 4317 | group.writeEntry("wmclass", "org.kde.foo"); | ||
4318 | group.writeEntry("wmclasscomplete", false); | 4318 | group.writeEntry("wmclasscomplete", false); | ||
4319 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 4319 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
4320 | group.sync(); | 4320 | group.sync(); | ||
4321 | RuleBook::self()->setConfig(config); | 4321 | RuleBook::self()->setConfig(config); | ||
4322 | workspace()->slotReconfigure(); | 4322 | workspace()->slotReconfigure(); | ||
4323 | 4323 | | |||
4324 | // Create the test client. | 4324 | // Create the test client. | ||
4325 | QFETCH(Test::ShellSurfaceType, type); | 4325 | QFETCH(Test::XdgShellSurfaceType, type); | ||
4326 | ShellClient *client; | 4326 | ShellClient *client; | ||
4327 | Surface *surface; | 4327 | Surface *surface; | ||
4328 | XdgShellSurface *shellSurface; | 4328 | XdgShellSurface *shellSurface; | ||
4329 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4329 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4330 | QVERIFY(client); | 4330 | QVERIFY(client); | ||
4331 | QVERIFY(client->isActive()); | 4331 | QVERIFY(client->isActive()); | ||
4332 | QCOMPARE(client->opacity(), 0.9); | 4332 | QCOMPARE(client->opacity(), 0.9); | ||
4333 | 4333 | | |||
Show All 16 Lines | 4343 | { | |||
4350 | group.writeEntry("wmclass", "org.kde.foo"); | 4350 | group.writeEntry("wmclass", "org.kde.foo"); | ||
4351 | group.writeEntry("wmclasscomplete", false); | 4351 | group.writeEntry("wmclasscomplete", false); | ||
4352 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 4352 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
4353 | group.sync(); | 4353 | group.sync(); | ||
4354 | RuleBook::self()->setConfig(config); | 4354 | RuleBook::self()->setConfig(config); | ||
4355 | workspace()->slotReconfigure(); | 4355 | workspace()->slotReconfigure(); | ||
4356 | 4356 | | |||
4357 | // Create the test client. | 4357 | // Create the test client. | ||
4358 | QFETCH(Test::ShellSurfaceType, type); | 4358 | QFETCH(Test::XdgShellSurfaceType, type); | ||
4359 | ShellClient *client; | 4359 | ShellClient *client; | ||
4360 | Surface *surface; | 4360 | Surface *surface; | ||
4361 | XdgShellSurface *shellSurface; | 4361 | XdgShellSurface *shellSurface; | ||
4362 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4362 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4363 | QVERIFY(client); | 4363 | QVERIFY(client); | ||
4364 | QVERIFY(client->isActive()); | 4364 | QVERIFY(client->isActive()); | ||
4365 | QCOMPARE(client->opacity(), 0.9); | 4365 | QCOMPARE(client->opacity(), 0.9); | ||
4366 | 4366 | | |||
4367 | // The rule should be discarded when the client is closed. | 4367 | // The rule should be discarded when the client is closed. | ||
4368 | delete shellSurface; | 4368 | delete shellSurface; | ||
4369 | delete surface; | 4369 | delete surface; | ||
4370 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4370 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4371 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4371 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4372 | QVERIFY(client); | 4372 | QVERIFY(client); | ||
4373 | QVERIFY(client->isActive()); | 4373 | QVERIFY(client->isActive()); | ||
4374 | QCOMPARE(client->opacity(), 1.0); | 4374 | QCOMPARE(client->opacity(), 1.0); | ||
4375 | 4375 | | |||
4376 | // Destroy the client. | 4376 | // Destroy the client. | ||
4377 | delete shellSurface; | 4377 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
4378 | delete surface; | 4378 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
4379 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4379 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4380 | } | 4380 | } | ||
4381 | 4381 | | |||
4382 | TEST_DATA(testInactiveOpacityDontAffect) | 4382 | TEST_DATA(testInactiveOpacityDontAffect) | ||
4383 | 4383 | | |||
4384 | void TestShellClientRules::testInactiveOpacityDontAffect() | 4384 | void TestShellClientRules::testInactiveOpacityDontAffect() | ||
4385 | { | 4385 | { | ||
4386 | // Initialize RuleBook with the test rule. | 4386 | // Initialize RuleBook with the test rule. | ||
4387 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 4387 | auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
4388 | config->group("General").writeEntry("count", 1); | 4388 | config->group("General").writeEntry("count", 1); | ||
4389 | KConfigGroup group = config->group("1"); | 4389 | KConfigGroup group = config->group("1"); | ||
4390 | group.writeEntry("opacityinactive", 80); | 4390 | group.writeEntry("opacityinactive", 80); | ||
4391 | group.writeEntry("opacityinactiverule", int(Rules::DontAffect)); | 4391 | group.writeEntry("opacityinactiverule", int(Rules::DontAffect)); | ||
4392 | group.writeEntry("wmclass", "org.kde.foo"); | 4392 | group.writeEntry("wmclass", "org.kde.foo"); | ||
4393 | group.writeEntry("wmclasscomplete", false); | 4393 | group.writeEntry("wmclasscomplete", false); | ||
4394 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 4394 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
4395 | group.sync(); | 4395 | group.sync(); | ||
4396 | RuleBook::self()->setConfig(config); | 4396 | RuleBook::self()->setConfig(config); | ||
4397 | workspace()->slotReconfigure(); | 4397 | workspace()->slotReconfigure(); | ||
4398 | 4398 | | |||
4399 | // Create the test client. | 4399 | // Create the test client. | ||
4400 | QFETCH(Test::ShellSurfaceType, type); | 4400 | QFETCH(Test::XdgShellSurfaceType, type); | ||
4401 | ShellClient *client; | 4401 | ShellClient *client; | ||
4402 | Surface *surface; | 4402 | Surface *surface; | ||
4403 | XdgShellSurface *shellSurface; | 4403 | XdgShellSurface *shellSurface; | ||
4404 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4404 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4405 | QVERIFY(client); | 4405 | QVERIFY(client); | ||
4406 | QVERIFY(client->isActive()); | 4406 | QVERIFY(client->isActive()); | ||
4407 | 4407 | | |||
4408 | // Make the client inactive. | 4408 | // Make the client inactive. | ||
Show All 22 Lines | 4424 | { | |||
4431 | group.writeEntry("wmclass", "org.kde.foo"); | 4431 | group.writeEntry("wmclass", "org.kde.foo"); | ||
4432 | group.writeEntry("wmclasscomplete", false); | 4432 | group.writeEntry("wmclasscomplete", false); | ||
4433 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 4433 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
4434 | group.sync(); | 4434 | group.sync(); | ||
4435 | RuleBook::self()->setConfig(config); | 4435 | RuleBook::self()->setConfig(config); | ||
4436 | workspace()->slotReconfigure(); | 4436 | workspace()->slotReconfigure(); | ||
4437 | 4437 | | |||
4438 | // Create the test client. | 4438 | // Create the test client. | ||
4439 | QFETCH(Test::ShellSurfaceType, type); | 4439 | QFETCH(Test::XdgShellSurfaceType, type); | ||
4440 | ShellClient *client; | 4440 | ShellClient *client; | ||
4441 | Surface *surface; | 4441 | Surface *surface; | ||
4442 | XdgShellSurface *shellSurface; | 4442 | XdgShellSurface *shellSurface; | ||
4443 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4443 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4444 | QVERIFY(client); | 4444 | QVERIFY(client); | ||
4445 | QVERIFY(client->isActive()); | 4445 | QVERIFY(client->isActive()); | ||
4446 | QCOMPARE(client->opacity(), 1.0); | 4446 | QCOMPARE(client->opacity(), 1.0); | ||
4447 | 4447 | | |||
Show All 23 Lines | 4464 | { | |||
4471 | group.writeEntry("wmclass", "org.kde.foo"); | 4471 | group.writeEntry("wmclass", "org.kde.foo"); | ||
4472 | group.writeEntry("wmclasscomplete", false); | 4472 | group.writeEntry("wmclasscomplete", false); | ||
4473 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | 4473 | group.writeEntry("wmclassmatch", int(Rules::ExactMatch)); | ||
4474 | group.sync(); | 4474 | group.sync(); | ||
4475 | RuleBook::self()->setConfig(config); | 4475 | RuleBook::self()->setConfig(config); | ||
4476 | workspace()->slotReconfigure(); | 4476 | workspace()->slotReconfigure(); | ||
4477 | 4477 | | |||
4478 | // Create the test client. | 4478 | // Create the test client. | ||
4479 | QFETCH(Test::ShellSurfaceType, type); | 4479 | QFETCH(Test::XdgShellSurfaceType, type); | ||
4480 | ShellClient *client; | 4480 | ShellClient *client; | ||
4481 | Surface *surface; | 4481 | Surface *surface; | ||
4482 | XdgShellSurface *shellSurface; | 4482 | XdgShellSurface *shellSurface; | ||
4483 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | 4483 | std::tie(client, surface, shellSurface) = createWindow(type, "org.kde.foo"); | ||
4484 | QVERIFY(client); | 4484 | QVERIFY(client); | ||
4485 | QVERIFY(client->isActive()); | 4485 | QVERIFY(client->isActive()); | ||
4486 | QCOMPARE(client->opacity(), 1.0); | 4486 | QCOMPARE(client->opacity(), 1.0); | ||
4487 | 4487 | | |||
Show All 11 Lines | |||||
4499 | QVERIFY(client); | 4499 | QVERIFY(client); | ||
4500 | QVERIFY(client->isActive()); | 4500 | QVERIFY(client->isActive()); | ||
4501 | QCOMPARE(client->opacity(), 1.0); | 4501 | QCOMPARE(client->opacity(), 1.0); | ||
4502 | workspace()->setActiveClient(nullptr); | 4502 | workspace()->setActiveClient(nullptr); | ||
4503 | QVERIFY(!client->isActive()); | 4503 | QVERIFY(!client->isActive()); | ||
4504 | QCOMPARE(client->opacity(), 1.0); | 4504 | QCOMPARE(client->opacity(), 1.0); | ||
4505 | 4505 | | |||
4506 | // Destroy the client. | 4506 | // Destroy the client. | ||
4507 | delete shellSurface; | 4507 | delete shellSurface; | ||
Lint: doubleFree: Memory pointed to by 'shellSurface' is freed twice. | |||||
4508 | delete surface; | 4508 | delete surface; | ||
Lint: doubleFree: Memory pointed to by 'surface' is freed twice. | |||||
4509 | QVERIFY(Test::waitForWindowDestroyed(client)); | 4509 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
4510 | } | 4510 | } | ||
4511 | 4511 | | |||
4512 | void TestShellClientRules::testMatchAfterNameChange() | 4512 | void TestShellClientRules::testMatchAfterNameChange() | ||
4513 | { | 4513 | { | ||
4514 | KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | 4514 | KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); | ||
4515 | config->group("General").writeEntry("count", 1); | 4515 | config->group("General").writeEntry("count", 1); | ||
4516 | 4516 | | |||
Show All 29 Lines |
Memory pointed to by 'shellSurface' is freed twice.