Changeset View
Changeset View
Standalone View
Standalone View
autotests/test_screen_edges.cpp
Show First 20 Lines • Show All 646 Lines • ▼ Show 20 Line(s) | 639 | { | |||
---|---|---|---|---|---|
647 | auto s = ScreenEdges::self(); | 647 | auto s = ScreenEdges::self(); | ||
648 | s->setConfig(config); | 648 | s->setConfig(config); | ||
649 | s->init(); | 649 | s->init(); | ||
650 | TestObject callback; | 650 | TestObject callback; | ||
651 | QSignalSpy spy(&callback, SIGNAL(gotCallback(KWin::ElectricBorder))); | 651 | QSignalSpy spy(&callback, SIGNAL(gotCallback(KWin::ElectricBorder))); | ||
652 | QVERIFY(spy.isValid()); | 652 | QVERIFY(spy.isValid()); | ||
653 | s->reserve(KWin::ElectricLeft, &callback, "callback"); | 653 | s->reserve(KWin::ElectricLeft, &callback, "callback"); | ||
654 | s->reserve(KWin::ElectricBottomRight, &callback, "callback"); | 654 | s->reserve(KWin::ElectricBottomRight, &callback, "callback"); | ||
655 | QAction action; | ||||
656 | s->reserveTouch(KWin::ElectricRight, &action); | ||||
655 | // currently there is no active client yet, so check blocking shouldn't do anything | 657 | // currently there is no active client yet, so check blocking shouldn't do anything | ||
656 | emit s->checkBlocking(); | 658 | emit s->checkBlocking(); | ||
659 | for (auto e: s->findChildren<Edge*>()) { | ||||
660 | QCOMPARE(e->activatesForTouchGesture(), e->border() == KWin::ElectricRight); | ||||
661 | } | ||||
657 | 662 | | |||
658 | xcb_enter_notify_event_t event; | 663 | xcb_enter_notify_event_t event; | ||
659 | Cursor::setPos(0, 50); | 664 | Cursor::setPos(0, 50); | ||
660 | event.root_x = 0; | 665 | event.root_x = 0; | ||
661 | event.root_y = 50; | 666 | event.root_y = 50; | ||
662 | event.event_x = 0; | 667 | event.event_x = 0; | ||
663 | event.event_y = 50; | 668 | event.event_y = 50; | ||
664 | event.root = XCB_WINDOW_NONE; | 669 | event.root = XCB_WINDOW_NONE; | ||
665 | event.child = XCB_WINDOW_NONE; | 670 | event.child = XCB_WINDOW_NONE; | ||
666 | event.event = s->windows().first(); | 671 | event.event = s->windows().first(); | ||
667 | event.same_screen_focus = 1; | 672 | event.same_screen_focus = 1; | ||
668 | event.time = QDateTime::currentMSecsSinceEpoch(); | 673 | event.time = QDateTime::currentMSecsSinceEpoch(); | ||
669 | QVERIFY(s->isEntered(&event)); | 674 | QVERIFY(s->isEntered(&event)); | ||
670 | QVERIFY(spy.isEmpty()); | 675 | QVERIFY(spy.isEmpty()); | ||
671 | QCOMPARE(Cursor::pos(), QPoint(1, 50)); | 676 | QCOMPARE(Cursor::pos(), QPoint(1, 50)); | ||
672 | 677 | | |||
673 | client.setGeometry(screens()->geometry()); | 678 | client.setGeometry(screens()->geometry()); | ||
674 | client.setActive(true); | 679 | client.setActive(true); | ||
675 | client.setFullScreen(true); | 680 | client.setFullScreen(true); | ||
676 | ws.setActiveClient(&client); | 681 | ws.setActiveClient(&client); | ||
677 | emit s->checkBlocking(); | 682 | emit s->checkBlocking(); | ||
678 | // the signal doesn't trigger for corners, let's go over all windows just to be sure that it doesn't call for corners | 683 | // the signal doesn't trigger for corners, let's go over all windows just to be sure that it doesn't call for corners | ||
679 | for (auto e: s->findChildren<Edge*>()) { | 684 | for (auto e: s->findChildren<Edge*>()) { | ||
680 | e->checkBlocking(); | 685 | e->checkBlocking(); | ||
686 | QCOMPARE(e->activatesForTouchGesture(), false); | ||||
681 | } | 687 | } | ||
682 | // calling again should not trigger | 688 | // calling again should not trigger | ||
683 | QTest::qWait(160); | 689 | QTest::qWait(160); | ||
684 | Cursor::setPos(0, 50); | 690 | Cursor::setPos(0, 50); | ||
685 | event.time = QDateTime::currentMSecsSinceEpoch(); | 691 | event.time = QDateTime::currentMSecsSinceEpoch(); | ||
686 | QVERIFY(s->isEntered(&event)); | 692 | QVERIFY(s->isEntered(&event)); | ||
687 | QVERIFY(spy.isEmpty()); | 693 | QVERIFY(spy.isEmpty()); | ||
688 | // and no pushback | 694 | // and no pushback | ||
689 | QCOMPARE(Cursor::pos(), QPoint(0, 50)); | 695 | QCOMPARE(Cursor::pos(), QPoint(0, 50)); | ||
690 | 696 | | |||
691 | // let's make the client not fullscreen, which should trigger | 697 | // let's make the client not fullscreen, which should trigger | ||
692 | client.setFullScreen(false); | 698 | client.setFullScreen(false); | ||
693 | emit s->checkBlocking(); | 699 | emit s->checkBlocking(); | ||
700 | for (auto e: s->findChildren<Edge*>()) { | ||||
701 | QCOMPARE(e->activatesForTouchGesture(), e->border() == KWin::ElectricRight); | ||||
702 | } | ||||
694 | event.time = QDateTime::currentMSecsSinceEpoch(); | 703 | event.time = QDateTime::currentMSecsSinceEpoch(); | ||
695 | QVERIFY(s->isEntered(&event)); | 704 | QVERIFY(s->isEntered(&event)); | ||
696 | QVERIFY(!spy.isEmpty()); | 705 | QVERIFY(!spy.isEmpty()); | ||
697 | QCOMPARE(Cursor::pos(), QPoint(1, 50)); | 706 | QCOMPARE(Cursor::pos(), QPoint(1, 50)); | ||
698 | 707 | | |||
699 | // let's make the client fullscreen again, but with a geometry not intersecting the left edge | 708 | // let's make the client fullscreen again, but with a geometry not intersecting the left edge | ||
700 | QTest::qWait(351); | 709 | QTest::qWait(351); | ||
701 | client.setFullScreen(true); | 710 | client.setFullScreen(true); | ||
▲ Show 20 Lines • Show All 341 Lines • Show Last 20 Lines |