Changeset View
Changeset View
Standalone View
Standalone View
autotests/client/test_xdg_shell.h
- This file was added.
1 | /******************************************************************** | ||||
---|---|---|---|---|---|
2 | Copyright 2016 Martin Gräßlin <mgraesslin@kde.org> | ||||
3 | | ||||
4 | This library is free software; you can redistribute it and/or | ||||
5 | modify it under the terms of the GNU Lesser General Public | ||||
6 | License as published by the Free Software Foundation; either | ||||
7 | version 2.1 of the License, or (at your option) version 3, or any | ||||
8 | later version accepted by the membership of KDE e.V. (or its | ||||
9 | successor approved by the membership of KDE e.V.), which shall | ||||
10 | act as a proxy defined in Section 6 of version 3 of the license. | ||||
11 | | ||||
12 | This library is distributed in the hope that it will be useful, | ||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
15 | Lesser General Public License for more details. | ||||
16 | | ||||
17 | You should have received a copy of the GNU Lesser General Public | ||||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | *********************************************************************/ | ||||
20 | // Qt | ||||
21 | #include <QtTest/QtTest> | ||||
22 | // client | ||||
23 | #include "../../src/client/xdgshell.h" | ||||
24 | #include "../../src/client/connection_thread.h" | ||||
25 | #include "../../src/client/compositor.h" | ||||
26 | #include "../../src/client/event_queue.h" | ||||
27 | #include "../../src/client/registry.h" | ||||
28 | #include "../../src/client/output.h" | ||||
29 | #include "../../src/client/seat.h" | ||||
30 | #include "../../src/client/shm_pool.h" | ||||
31 | #include "../../src/client/surface.h" | ||||
32 | // server | ||||
33 | #include "../../src/server/display.h" | ||||
34 | #include "../../src/server/compositor_interface.h" | ||||
35 | #include "../../src/server/output_interface.h" | ||||
36 | #include "../../src/server/seat_interface.h" | ||||
37 | #include "../../src/server/surface_interface.h" | ||||
38 | #include "../../src/server/xdgshell_interface.h" | ||||
39 | | ||||
40 | using namespace KWayland::Client; | ||||
41 | using namespace KWayland::Server; | ||||
42 | | ||||
43 | Q_DECLARE_METATYPE(Qt::MouseButton) | ||||
44 | | ||||
45 | class XdgShellTest : public QObject | ||||
46 | { | ||||
47 | Q_OBJECT | ||||
48 | | ||||
49 | protected: | ||||
50 | XdgShellTest(XdgShellInterfaceVersion version); | ||||
51 | private Q_SLOTS: | ||||
52 | void init(); | ||||
53 | void cleanup(); | ||||
54 | | ||||
55 | void testCreateSurface(); | ||||
56 | void testTitle(); | ||||
57 | void testWindowClass(); | ||||
58 | void testMaximize(); | ||||
59 | void testMinimize(); | ||||
60 | void testFullscreen(); | ||||
61 | void testShowWindowMenu(); | ||||
62 | void testMove(); | ||||
63 | void testResize_data(); | ||||
64 | void testResize(); | ||||
65 | void testTransient(); | ||||
66 | void testPing(); | ||||
67 | void testClose(); | ||||
68 | void testConfigureStates_data(); | ||||
69 | void testConfigureStates(); | ||||
70 | void testConfigureMultipleAcks(); | ||||
71 | | ||||
72 | protected: | ||||
73 | XdgShellInterface *m_xdgShellInterface = nullptr; | ||||
74 | Compositor *m_compositor = nullptr; | ||||
75 | XdgShell *m_xdgShell = nullptr; | ||||
76 | Display *m_display = nullptr; | ||||
77 | CompositorInterface *m_compositorInterface = nullptr; | ||||
78 | OutputInterface *m_o1Interface = nullptr; | ||||
79 | OutputInterface *m_o2Interface = nullptr; | ||||
80 | SeatInterface *m_seatInterface = nullptr; | ||||
81 | ConnectionThread *m_connection = nullptr; | ||||
82 | QThread *m_thread = nullptr; | ||||
83 | EventQueue *m_queue = nullptr; | ||||
84 | ShmPool *m_shmPool = nullptr; | ||||
85 | Output *m_output1 = nullptr; | ||||
86 | Output *m_output2 = nullptr; | ||||
87 | Seat *m_seat = nullptr; | ||||
88 | | ||||
89 | private: | ||||
90 | XdgShellInterfaceVersion m_version; | ||||
91 | }; | ||||
92 | | ||||
93 | #define SURFACE \ | ||||
94 | QSignalSpy xdgSurfaceCreatedSpy(m_xdgShellInterface, &XdgShellInterface::surfaceCreated); \ | ||||
95 | QVERIFY(xdgSurfaceCreatedSpy.isValid()); \ | ||||
96 | QScopedPointer<Surface> surface(m_compositor->createSurface()); \ | ||||
97 | QScopedPointer<XdgShellSurface> xdgSurface(m_xdgShell->createSurface(surface.data())); \ | ||||
98 | QCOMPARE(xdgSurface->size(), QSize()); \ | ||||
99 | QVERIFY(xdgSurfaceCreatedSpy.wait()); \ | ||||
100 | auto serverXdgSurface = xdgSurfaceCreatedSpy.first().first().value<XdgShellSurfaceInterface*>(); \ | ||||
101 | QVERIFY(serverXdgSurface); |