Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/internal_window.cpp
Show First 20 Lines • Show All 599 Lines • ▼ Show 20 Line(s) | 595 | { | |||
---|---|---|---|---|---|
600 | win.setFlags(win.flags() & ~Qt::FramelessWindowHint); | 600 | win.setFlags(win.flags() & ~Qt::FramelessWindowHint); | ||
601 | win.show(); | 601 | win.show(); | ||
602 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 602 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
603 | auto internalClient = clientAddedSpy.first().first().value<InternalClient *>(); | 603 | auto internalClient = clientAddedSpy.first().first().value<InternalClient *>(); | ||
604 | QVERIFY(internalClient); | 604 | QVERIFY(internalClient); | ||
605 | QVERIFY(internalClient->isDecorated()); | 605 | QVERIFY(internalClient->isDecorated()); | ||
606 | 606 | | |||
607 | KConfigGroup group = kwinApp()->config()->group("MouseBindings"); | 607 | KConfigGroup group = kwinApp()->config()->group("MouseBindings"); | ||
608 | group.writeEntry("CommandAllKey", "Alt"); | 608 | group.writeEntry("CommandAllKey", "Meta"); | ||
609 | group.writeEntry("CommandAll1", "Move"); | 609 | group.writeEntry("CommandAll1", "Move"); | ||
610 | group.writeEntry("CommandAll2", "Move"); | 610 | group.writeEntry("CommandAll2", "Move"); | ||
611 | group.writeEntry("CommandAll3", "Move"); | 611 | group.writeEntry("CommandAll3", "Move"); | ||
612 | group.sync(); | 612 | group.sync(); | ||
613 | workspace()->slotReconfigure(); | 613 | workspace()->slotReconfigure(); | ||
614 | QCOMPARE(options->commandAllModifier(), Qt::AltModifier); | 614 | QCOMPARE(options->commandAllModifier(), Qt::MetaModifier); | ||
615 | QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove); | 615 | QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove); | ||
616 | QCOMPARE(options->commandAll2(), Options::MouseUnrestrictedMove); | 616 | QCOMPARE(options->commandAll2(), Options::MouseUnrestrictedMove); | ||
617 | QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove); | 617 | QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove); | ||
618 | 618 | | |||
619 | // move cursor on window | 619 | // move cursor on window | ||
620 | Cursors::self()->mouse()->setPos(internalClient->frameGeometry().center()); | 620 | Cursors::self()->mouse()->setPos(internalClient->frameGeometry().center()); | ||
621 | 621 | | |||
622 | // simulate modifier+click | 622 | // simulate modifier+click | ||
623 | quint32 timestamp = 1; | 623 | quint32 timestamp = 1; | ||
624 | kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); | 624 | kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); | ||
625 | QVERIFY(!internalClient->isMove()); | 625 | QVERIFY(!internalClient->isMove()); | ||
626 | kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); | 626 | kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); | ||
627 | QVERIFY(internalClient->isMove()); | 627 | QVERIFY(internalClient->isMove()); | ||
628 | // release modifier should not change it | 628 | // release modifier should not change it | ||
629 | kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); | 629 | kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); | ||
630 | QVERIFY(internalClient->isMove()); | 630 | QVERIFY(internalClient->isMove()); | ||
631 | // but releasing the key should end move/resize | 631 | // but releasing the key should end move/resize | ||
632 | kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); | 632 | kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); | ||
633 | QVERIFY(!internalClient->isMove()); | 633 | QVERIFY(!internalClient->isMove()); | ||
634 | } | 634 | } | ||
635 | 635 | | |||
636 | void InternalWindowTest::testModifierScroll() | 636 | void InternalWindowTest::testModifierScroll() | ||
637 | { | 637 | { | ||
638 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | 638 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
639 | QVERIFY(clientAddedSpy.isValid()); | 639 | QVERIFY(clientAddedSpy.isValid()); | ||
640 | HelperWindow win; | 640 | HelperWindow win; | ||
641 | win.setGeometry(0, 0, 100, 100); | 641 | win.setGeometry(0, 0, 100, 100); | ||
642 | win.setFlags(win.flags() & ~Qt::FramelessWindowHint); | 642 | win.setFlags(win.flags() & ~Qt::FramelessWindowHint); | ||
643 | win.show(); | 643 | win.show(); | ||
644 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 644 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
645 | auto internalClient = clientAddedSpy.first().first().value<InternalClient *>(); | 645 | auto internalClient = clientAddedSpy.first().first().value<InternalClient *>(); | ||
646 | QVERIFY(internalClient); | 646 | QVERIFY(internalClient); | ||
647 | QVERIFY(internalClient->isDecorated()); | 647 | QVERIFY(internalClient->isDecorated()); | ||
648 | 648 | | |||
649 | KConfigGroup group = kwinApp()->config()->group("MouseBindings"); | 649 | KConfigGroup group = kwinApp()->config()->group("MouseBindings"); | ||
650 | group.writeEntry("CommandAllKey", "Alt"); | 650 | group.writeEntry("CommandAllKey", "Meta"); | ||
651 | group.writeEntry("CommandAllWheel", "change opacity"); | 651 | group.writeEntry("CommandAllWheel", "change opacity"); | ||
652 | group.sync(); | 652 | group.sync(); | ||
653 | workspace()->slotReconfigure(); | 653 | workspace()->slotReconfigure(); | ||
654 | 654 | | |||
655 | // move cursor on window | 655 | // move cursor on window | ||
656 | Cursors::self()->mouse()->setPos(internalClient->frameGeometry().center()); | 656 | Cursors::self()->mouse()->setPos(internalClient->frameGeometry().center()); | ||
657 | 657 | | |||
658 | // set the opacity to 0.5 | 658 | // set the opacity to 0.5 | ||
659 | internalClient->setOpacity(0.5); | 659 | internalClient->setOpacity(0.5); | ||
660 | QCOMPARE(internalClient->opacity(), 0.5); | 660 | QCOMPARE(internalClient->opacity(), 0.5); | ||
661 | quint32 timestamp = 1; | 661 | quint32 timestamp = 1; | ||
662 | kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); | 662 | kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); | ||
663 | kwinApp()->platform()->pointerAxisVertical(-5, timestamp++); | 663 | kwinApp()->platform()->pointerAxisVertical(-5, timestamp++); | ||
664 | QCOMPARE(internalClient->opacity(), 0.6); | 664 | QCOMPARE(internalClient->opacity(), 0.6); | ||
665 | kwinApp()->platform()->pointerAxisVertical(5, timestamp++); | 665 | kwinApp()->platform()->pointerAxisVertical(5, timestamp++); | ||
666 | QCOMPARE(internalClient->opacity(), 0.5); | 666 | QCOMPARE(internalClient->opacity(), 0.5); | ||
667 | kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); | 667 | kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); | ||
668 | } | 668 | } | ||
669 | 669 | | |||
670 | void InternalWindowTest::testPopup() | 670 | void InternalWindowTest::testPopup() | ||
671 | { | 671 | { | ||
672 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | 672 | QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
673 | QVERIFY(clientAddedSpy.isValid()); | 673 | QVERIFY(clientAddedSpy.isValid()); | ||
674 | HelperWindow win; | 674 | HelperWindow win; | ||
675 | win.setGeometry(0, 0, 100, 100); | 675 | win.setGeometry(0, 0, 100, 100); | ||
▲ Show 20 Lines • Show All 124 Lines • Show Last 20 Lines |