Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/internal_window.cpp
Show All 27 Lines | |||||
28 | #include <QPainter> | 28 | #include <QPainter> | ||
29 | #include <QRasterWindow> | 29 | #include <QRasterWindow> | ||
30 | 30 | | |||
31 | #include <KWayland/Client/keyboard.h> | 31 | #include <KWayland/Client/keyboard.h> | ||
32 | #include <KWayland/Client/surface.h> | 32 | #include <KWayland/Client/surface.h> | ||
33 | #include <KWayland/Client/seat.h> | 33 | #include <KWayland/Client/seat.h> | ||
34 | #include <KWayland/Client/shell.h> | 34 | #include <KWayland/Client/shell.h> | ||
35 | 35 | | |||
36 | #include <KWayland/Server/surface_interface.h> | ||||
37 | | ||||
36 | #include <linux/input.h> | 38 | #include <linux/input.h> | ||
37 | 39 | | |||
38 | using namespace KWayland::Client; | 40 | using namespace KWayland::Client; | ||
39 | 41 | | |||
40 | namespace KWin | 42 | namespace KWin | ||
41 | { | 43 | { | ||
42 | 44 | | |||
43 | static const QString s_socketName = QStringLiteral("wayland_test_kwin_internal_window-0"); | 45 | static const QString s_socketName = QStringLiteral("wayland_test_kwin_internal_window-0"); | ||
Show All 15 Lines | 50 | private Q_SLOTS: | |||
59 | void testTouch(); | 61 | void testTouch(); | ||
60 | void testOpacity(); | 62 | void testOpacity(); | ||
61 | void testMove(); | 63 | void testMove(); | ||
62 | void testSkipCloseAnimation_data(); | 64 | void testSkipCloseAnimation_data(); | ||
63 | void testSkipCloseAnimation(); | 65 | void testSkipCloseAnimation(); | ||
64 | void testModifierClickUnrestrictedMove(); | 66 | void testModifierClickUnrestrictedMove(); | ||
65 | void testModifierScroll(); | 67 | void testModifierScroll(); | ||
66 | void testPopup(); | 68 | void testPopup(); | ||
69 | void testScale(); | ||||
67 | }; | 70 | }; | ||
68 | 71 | | |||
69 | class HelperWindow : public QRasterWindow | 72 | class HelperWindow : public QRasterWindow | ||
70 | { | 73 | { | ||
71 | Q_OBJECT | 74 | Q_OBJECT | ||
72 | public: | 75 | public: | ||
73 | HelperWindow(); | 76 | HelperWindow(); | ||
74 | ~HelperWindow(); | 77 | ~HelperWindow(); | ||
▲ Show 20 Lines • Show All 607 Lines • ▼ Show 20 Line(s) | 679 | { | |||
682 | win.show(); | 685 | win.show(); | ||
683 | QVERIFY(clientAddedSpy.wait()); | 686 | QVERIFY(clientAddedSpy.wait()); | ||
684 | QCOMPARE(clientAddedSpy.count(), 1); | 687 | QCOMPARE(clientAddedSpy.count(), 1); | ||
685 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 688 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | ||
686 | QVERIFY(internalClient); | 689 | QVERIFY(internalClient); | ||
687 | QCOMPARE(internalClient->isPopupWindow(), true); | 690 | QCOMPARE(internalClient->isPopupWindow(), true); | ||
688 | } | 691 | } | ||
689 | 692 | | |||
693 | void InternalWindowTest::testScale() | ||||
694 | { | ||||
695 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, | ||||
696 | Q_ARG(int, 2), | ||||
697 | Q_ARG(QVector<QRect>, QVector<QRect>({QRect(0,0,1280, 1024), QRect(1280/2, 0, 1280, 1024)})), | ||||
698 | Q_ARG(QVector<int>, QVector<int>({2,2}))); | ||||
699 | | ||||
700 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||||
701 | QVERIFY(clientAddedSpy.isValid()); | ||||
702 | HelperWindow win; | ||||
703 | win.setGeometry(0, 0, 100, 100); | ||||
704 | win.setFlags(win.flags() | Qt::Popup); | ||||
705 | win.show(); | ||||
706 | QCOMPARE(win.devicePixelRatio(), 2.0); | ||||
707 | QVERIFY(clientAddedSpy.wait()); | ||||
708 | QCOMPARE(clientAddedSpy.count(), 1); | ||||
709 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | ||||
710 | QCOMPARE(internalClient->surface()->scale(), 2); | ||||
711 | | ||||
712 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | ||||
713 | } | ||||
714 | | ||||
715 | | ||||
690 | } | 716 | } | ||
691 | 717 | | |||
692 | WAYLANDTEST_MAIN(KWin::InternalWindowTest) | 718 | WAYLANDTEST_MAIN(KWin::InternalWindowTest) | ||
693 | #include "internal_window.moc" | 719 | #include "internal_window.moc" |