Directory: | ./ |
---|---|
File: | autotests/client/xdg_foreign.cpp |
Date: | 2024-01-22 17:25:27 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 230 | 230 | 100.0% |
Branches: | 406 | 824 | 49.3% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /******************************************************************** | ||
2 | Copyright 2014 Martin Gräßlin <mgraesslin@kde.org> | ||
3 | Copyright 2017 Marco Martin <mart@kde.org> | ||
4 | Copyright 2020 Roman Gilg <subdiff@gmail.com> | ||
5 | |||
6 | This library is free software; you can redistribute it and/or | ||
7 | modify it under the terms of the GNU Lesser General Public | ||
8 | License as published by the Free Software Foundation; either | ||
9 | version 2.1 of the License, or (at your option) version 3, or any | ||
10 | later version accepted by the membership of KDE e.V. (or its | ||
11 | successor approved by the membership of KDE e.V.), which shall | ||
12 | act as a proxy defined in Section 6 of version 3 of the license. | ||
13 | |||
14 | This library is distributed in the hope that it will be useful, | ||
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | Lesser General Public License for more details. | ||
18 | |||
19 | You should have received a copy of the GNU Lesser General Public | ||
20 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
21 | *********************************************************************/ | ||
22 | #include <QtTest> | ||
23 | |||
24 | #include "../../src/client/compositor.h" | ||
25 | #include "../../src/client/connection_thread.h" | ||
26 | #include "../../src/client/event_queue.h" | ||
27 | #include "../../src/client/region.h" | ||
28 | #include "../../src/client/registry.h" | ||
29 | #include "../../src/client/surface.h" | ||
30 | #include "../../src/client/xdgforeign.h" | ||
31 | |||
32 | #include "../../server/compositor.h" | ||
33 | #include "../../server/display.h" | ||
34 | #include "../../server/surface.h" | ||
35 | #include "../../server/xdg_foreign.h" | ||
36 | |||
37 | #include "../tests/globals.h" | ||
38 | |||
39 | using namespace Wrapland::Client; | ||
40 | |||
41 | class TestForeign : public QObject | ||
42 | { | ||
43 | Q_OBJECT | ||
44 | public: | ||
45 | explicit TestForeign(QObject* parent = nullptr); | ||
46 | |||
47 | private Q_SLOTS: | ||
48 | void init(); | ||
49 | void cleanup(); | ||
50 | |||
51 | void testExport(); | ||
52 | void testDeleteImported(); | ||
53 | void testDeleteChildSurface(); | ||
54 | void testDeleteParentSurface(); | ||
55 | void testDeleteExported(); | ||
56 | void testExportTwoTimes(); | ||
57 | void testImportTwoTimes(); | ||
58 | |||
59 | private: | ||
60 | void doExport(); | ||
61 | |||
62 | 1 | struct { | |
63 | std::unique_ptr<Wrapland::Server::Display> display; | ||
64 | Wrapland::Server::globals globals; | ||
65 | 1 | Wrapland::Server::Surface* child_surface{nullptr}; | |
66 | } server; | ||
67 | |||
68 | Wrapland::Client::ConnectionThread* m_connection; | ||
69 | Wrapland::Client::Compositor* m_compositor; | ||
70 | Wrapland::Client::EventQueue* m_queue; | ||
71 | Wrapland::Client::XdgExporter* m_exporter; | ||
72 | Wrapland::Client::XdgImporter* m_importer; | ||
73 | |||
74 | Wrapland::Client::Surface* m_exportedSurface; | ||
75 | Wrapland::Server::Surface* m_exportedServerSurface; | ||
76 | |||
77 | Wrapland::Client::XdgExported* m_exported; | ||
78 | Wrapland::Client::XdgImported* m_imported; | ||
79 | |||
80 | Wrapland::Client::Surface* m_childSurface; | ||
81 | |||
82 | QThread* m_thread; | ||
83 | }; | ||
84 | |||
85 | constexpr auto socket_name{"wrapland-test-xdg-foreign-0"}; | ||
86 | |||
87 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | TestForeign::TestForeign(QObject* parent) |
88 | 1 | : QObject(parent) | |
89 | 1 | , m_connection(nullptr) | |
90 | 1 | , m_compositor(nullptr) | |
91 | 1 | , m_queue(nullptr) | |
92 | 1 | , m_exporter(nullptr) | |
93 | 1 | , m_importer(nullptr) | |
94 | 1 | , m_thread(nullptr) | |
95 | 1 | { | |
96 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | qRegisterMetaType<Wrapland::Server::Surface*>(); |
97 | 1 | } | |
98 | |||
99 | 7 | void TestForeign::init() | |
100 | { | ||
101 | 7 | server.display = std::make_unique<Wrapland::Server::Display>(); | |
102 |
2/4✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
|
7 | server.display->set_socket_name(socket_name); |
103 | 7 | server.display->start(); | |
104 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | QVERIFY(server.display->running()); |
105 | |||
106 | // setup connection | ||
107 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | m_connection = new Wrapland::Client::ConnectionThread; |
108 | 7 | QSignalSpy connectedSpy(m_connection, &ConnectionThread::establishedChanged); | |
109 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | QVERIFY(connectedSpy.isValid()); |
110 |
2/4✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
|
7 | m_connection->setSocketName(socket_name); |
111 | |||
112 |
2/4✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
|
7 | m_thread = new QThread(this); |
113 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | m_connection->moveToThread(m_thread); |
114 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | m_thread->start(); |
115 | |||
116 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | m_connection->establishConnection(); |
117 |
6/12✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 7 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 7 times.
|
7 | QVERIFY(connectedSpy.count() || connectedSpy.wait()); |
118 |
2/4✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
|
7 | QCOMPARE(connectedSpy.count(), 1); |
119 | |||
120 |
2/4✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
|
7 | m_queue = new Wrapland::Client::EventQueue(this); |
121 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | QVERIFY(!m_queue->isValid()); |
122 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | m_queue->setup(m_connection); |
123 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | QVERIFY(m_queue->isValid()); |
124 | |||
125 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | Registry registry; |
126 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | QSignalSpy compositorSpy(®istry, &Registry::compositorAnnounced); |
127 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | QVERIFY(compositorSpy.isValid()); |
128 | |||
129 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | QSignalSpy exporterSpy(®istry, &Registry::exporterUnstableV2Announced); |
130 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | QVERIFY(exporterSpy.isValid()); |
131 | |||
132 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | QSignalSpy importerSpy(®istry, &Registry::importerUnstableV2Announced); |
133 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | QVERIFY(importerSpy.isValid()); |
134 | |||
135 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | QVERIFY(!registry.eventQueue()); |
136 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | registry.setEventQueue(m_queue); |
137 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | QCOMPARE(registry.eventQueue(), m_queue); |
138 |
2/4✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
|
7 | registry.create(m_connection->display()); |
139 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | QVERIFY(registry.isValid()); |
140 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | registry.setup(); |
141 | |||
142 | 14 | server.globals.compositor | |
143 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | = std::make_unique<Wrapland::Server::Compositor>(server.display.get()); |
144 |
5/10✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 7 times.
|
7 | QVERIFY(compositorSpy.wait()); |
145 |
4/8✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7 times.
✗ Branch 7 not taken.
|
14 | m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), |
146 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | compositorSpy.first().last().value<quint32>(), |
147 | this); | ||
148 | |||
149 | 14 | server.globals.xdg_foreign | |
150 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | = std::make_unique<Wrapland::Server::XdgForeign>(server.display.get()); |
151 | |||
152 |
5/10✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 7 times.
|
7 | QVERIFY(exporterSpy.wait()); |
153 | // Both importer and exporter should have been triggered by now | ||
154 |
2/4✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
|
7 | QCOMPARE(exporterSpy.count(), 1); |
155 |
2/4✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
|
7 | QCOMPARE(importerSpy.count(), 1); |
156 | |||
157 |
4/8✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7 times.
✗ Branch 7 not taken.
|
14 | m_exporter = registry.createXdgExporter(exporterSpy.first().first().value<quint32>(), |
158 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | exporterSpy.first().last().value<quint32>(), |
159 | this); | ||
160 |
4/8✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7 times.
✗ Branch 7 not taken.
|
14 | m_importer = registry.createXdgImporter(importerSpy.first().first().value<quint32>(), |
161 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | importerSpy.first().last().value<quint32>(), |
162 | this); | ||
163 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | } |
164 | |||
165 | 7 | void TestForeign::cleanup() | |
166 | { | ||
167 | #define CLEANUP(variable) \ | ||
168 | if (variable) { \ | ||
169 | delete variable; \ | ||
170 | variable = nullptr; \ | ||
171 | } | ||
172 | |||
173 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
|
7 | CLEANUP(m_compositor) |
174 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
|
7 | CLEANUP(m_exporter) |
175 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
|
7 | CLEANUP(m_importer) |
176 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
|
7 | CLEANUP(m_queue) |
177 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | if (m_connection) { |
178 | 7 | m_connection->deleteLater(); | |
179 | 7 | m_connection = nullptr; | |
180 | 7 | } | |
181 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | if (m_thread) { |
182 | 7 | m_thread->quit(); | |
183 | 7 | m_thread->wait(); | |
184 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | delete m_thread; |
185 | 7 | m_thread = nullptr; | |
186 | 7 | } | |
187 | #undef CLEANUP | ||
188 | |||
189 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | server = {}; |
190 | 7 | } | |
191 | |||
192 | 7 | void TestForeign::doExport() | |
193 | { | ||
194 | 7 | QSignalSpy serverSurfaceCreated(server.globals.compositor.get(), | |
195 | &Wrapland::Server::Compositor::surfaceCreated); | ||
196 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | QVERIFY(serverSurfaceCreated.isValid()); |
197 | |||
198 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | m_exportedSurface = m_compositor->createSurface(); |
199 |
5/10✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 7 times.
|
7 | QVERIFY(serverSurfaceCreated.wait()); |
200 | |||
201 | 7 | m_exportedServerSurface | |
202 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | = serverSurfaceCreated.first().first().value<Wrapland::Server::Surface*>(); |
203 | |||
204 | // Export a window | ||
205 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | m_exported = m_exporter->exportTopLevel(m_exportedSurface); |
206 | |||
207 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 7 times.
|
7 | QVERIFY(m_exported->handle().isEmpty()); |
208 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | QSignalSpy doneSpy(m_exported, &XdgExported::done); |
209 |
5/10✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 7 times.
|
7 | QVERIFY(doneSpy.wait()); |
210 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 7 times.
|
7 | QVERIFY(!m_exported->handle().isEmpty()); |
211 | |||
212 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | QSignalSpy parentSpy(server.globals.xdg_foreign.get(), |
213 | &Wrapland::Server::XdgForeign::parentChanged); | ||
214 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | QVERIFY(parentSpy.isValid()); |
215 | |||
216 | // Import the just exported window | ||
217 |
2/4✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
|
7 | m_imported = m_importer->importTopLevel(m_exported->handle()); |
218 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | QVERIFY(m_imported->isValid()); |
219 | |||
220 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | QSignalSpy childServerSurfaceCreated(server.globals.compositor.get(), |
221 | &Wrapland::Server::Compositor::surfaceCreated); | ||
222 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | QVERIFY(serverSurfaceCreated.isValid()); |
223 | |||
224 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | m_childSurface = m_compositor->createSurface(); |
225 |
5/10✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 7 times.
|
7 | QVERIFY(childServerSurfaceCreated.wait()); |
226 | |||
227 | 7 | server.child_surface | |
228 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | = childServerSurfaceCreated.first().first().value<Wrapland::Server::Surface*>(); |
229 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | m_childSurface->commit(Surface::CommitFlag::None); |
230 | |||
231 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | m_imported->setParentOf(m_childSurface); |
232 | |||
233 |
5/10✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 7 times.
|
7 | QVERIFY(parentSpy.wait()); |
234 | |||
235 |
4/8✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7 times.
✗ Branch 7 not taken.
|
7 | QCOMPARE(parentSpy.first().at(0).value<Wrapland::Server::Surface*>(), m_exportedServerSurface); |
236 |
4/8✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7 times.
✗ Branch 7 not taken.
|
7 | QCOMPARE(parentSpy.first().at(1).value<Wrapland::Server::Surface*>(), server.child_surface); |
237 | |||
238 | // parentOf API | ||
239 |
3/6✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
7 | QCOMPARE(server.globals.xdg_foreign->parentOf(server.child_surface), m_exportedServerSurface); |
240 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | } |
241 | |||
242 | 1 | void TestForeign::testExport() | |
243 | { | ||
244 | 1 | doExport(); | |
245 | |||
246 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | delete m_imported; |
247 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | delete m_exportedSurface; |
248 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | delete m_exported; |
249 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | delete m_childSurface; |
250 | 1 | } | |
251 | |||
252 | 1 | void TestForeign::testDeleteImported() | |
253 | { | ||
254 | 1 | doExport(); | |
255 | |||
256 | 1 | QSignalSpy parentSpy(server.globals.xdg_foreign.get(), | |
257 | &Wrapland::Server::XdgForeign::parentChanged); | ||
258 | |||
259 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QVERIFY(parentSpy.isValid()); |
260 | |||
261 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | m_imported->deleteLater(); |
262 | |||
263 |
5/10✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
|
1 | QVERIFY(parentSpy.wait()); |
264 | |||
265 |
4/8✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
1 | QCOMPARE(parentSpy.first().at(0).value<Wrapland::Server::Surface*>(), m_exportedServerSurface); |
266 |
4/8✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
1 | QVERIFY(!parentSpy.first().at(1).value<Wrapland::Server::Surface*>()); |
267 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QVERIFY(!server.globals.xdg_foreign->parentOf(server.child_surface)); |
268 | |||
269 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete m_exportedSurface; |
270 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete m_exported; |
271 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete m_childSurface; |
272 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | } |
273 | |||
274 | 1 | void TestForeign::testDeleteChildSurface() | |
275 | { | ||
276 | 1 | doExport(); | |
277 | |||
278 | 1 | QSignalSpy parentSpy(server.globals.xdg_foreign.get(), | |
279 | &Wrapland::Server::XdgForeign::parentChanged); | ||
280 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QVERIFY(parentSpy.isValid()); |
281 | |||
282 | // When the client surface dies, the server one will eventually die too | ||
283 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | QSignalSpy surfaceDestroyedSpy(server.child_surface, |
284 | &Wrapland::Server::Surface::resourceDestroyed); | ||
285 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QVERIFY(surfaceDestroyedSpy.isValid()); |
286 | |||
287 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | m_childSurface->deleteLater(); |
288 | |||
289 |
5/10✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
|
1 | QVERIFY(parentSpy.wait()); |
290 |
3/12✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
|
1 | QVERIFY(surfaceDestroyedSpy.count() || surfaceDestroyedSpy.wait()); |
291 | |||
292 | // QVERIFY(surfaceDestroyedSpy.wait()); | ||
293 | |||
294 |
4/8✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
1 | QCOMPARE(parentSpy.first().at(0).value<Wrapland::Server::Surface*>(), m_exportedServerSurface); |
295 |
4/8✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
1 | QVERIFY(!parentSpy.first().at(1).value<Wrapland::Server::Surface*>()); |
296 | |||
297 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | delete m_imported; |
298 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | delete m_exportedSurface; |
299 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | delete m_exported; |
300 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | } |
301 | |||
302 | 1 | void TestForeign::testDeleteParentSurface() | |
303 | { | ||
304 | 1 | doExport(); | |
305 | |||
306 | 1 | QSignalSpy parentSpy(server.globals.xdg_foreign.get(), | |
307 | &Wrapland::Server::XdgForeign::parentChanged); | ||
308 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QVERIFY(parentSpy.isValid()); |
309 | |||
310 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | QSignalSpy exportedSurfaceDestroyedSpy(m_exportedServerSurface, |
311 | &Wrapland::Server::Surface::resourceDestroyed); | ||
312 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QVERIFY(exportedSurfaceDestroyedSpy.isValid()); |
313 | |||
314 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | m_exportedSurface->deleteLater(); |
315 | |||
316 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | exportedSurfaceDestroyedSpy.wait(); |
317 | |||
318 |
3/12✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
|
1 | QVERIFY(parentSpy.count() || parentSpy.wait()); |
319 | |||
320 |
4/8✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
1 | QVERIFY(!parentSpy.first().at(0).value<Wrapland::Server::Surface*>()); |
321 |
4/8✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
1 | QCOMPARE(parentSpy.first().at(1).value<Wrapland::Server::Surface*>(), server.child_surface); |
322 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QVERIFY(!server.globals.xdg_foreign->parentOf(server.child_surface)); |
323 | |||
324 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete m_imported; |
325 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete m_exported; |
326 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete m_childSurface; |
327 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | } |
328 | |||
329 | 1 | void TestForeign::testDeleteExported() | |
330 | { | ||
331 | 1 | doExport(); | |
332 | |||
333 | 1 | QSignalSpy parentSpy(server.globals.xdg_foreign.get(), | |
334 | &Wrapland::Server::XdgForeign::parentChanged); | ||
335 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | QSignalSpy destroyedSpy(m_imported, &Wrapland::Client::XdgImported::importedDestroyed); |
336 | |||
337 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QVERIFY(parentSpy.isValid()); |
338 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | m_exported->deleteLater(); |
339 | |||
340 |
5/10✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
|
1 | QVERIFY(parentSpy.wait()); |
341 |
5/10✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
|
1 | QVERIFY(destroyedSpy.wait()); |
342 | |||
343 |
4/8✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
1 | QCOMPARE(parentSpy.first().at(1).value<Wrapland::Server::Surface*>(), server.child_surface); |
344 |
4/8✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
1 | QVERIFY(!parentSpy.first().at(0).value<Wrapland::Server::Surface*>()); |
345 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QVERIFY(!server.globals.xdg_foreign->parentOf(server.child_surface)); |
346 | |||
347 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QVERIFY(!m_imported->isValid()); |
348 | |||
349 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | delete m_imported; |
350 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | delete m_exportedSurface; |
351 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | delete m_childSurface; |
352 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | } |
353 | |||
354 | 1 | void TestForeign::testExportTwoTimes() | |
355 | { | ||
356 | 1 | doExport(); | |
357 | |||
358 | // Export second window | ||
359 | 1 | Wrapland::Client::XdgExported* exported2 = m_exporter->exportTopLevel(m_exportedSurface); | |
360 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
1 | QVERIFY(exported2->handle().isEmpty()); |
361 | 1 | QSignalSpy doneSpy(exported2, &XdgExported::done); | |
362 |
5/10✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
|
1 | QVERIFY(doneSpy.wait()); |
363 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
1 | QVERIFY(!exported2->handle().isEmpty()); |
364 | |||
365 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | QSignalSpy parentSpy(server.globals.xdg_foreign.get(), |
366 | &Wrapland::Server::XdgForeign::parentChanged); | ||
367 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QVERIFY(parentSpy.isValid()); |
368 | |||
369 | // Import the just exported window | ||
370 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | Wrapland::Client::XdgImported* imported2 = m_importer->importTopLevel(exported2->handle()); |
371 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QVERIFY(imported2->isValid()); |
372 | |||
373 | // create a second child surface | ||
374 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | QSignalSpy serverSurfaceCreated(server.globals.compositor.get(), |
375 | &Wrapland::Server::Compositor::surfaceCreated); | ||
376 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QVERIFY(serverSurfaceCreated.isValid()); |
377 | |||
378 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | Wrapland::Client::Surface* childSurface2 = m_compositor->createSurface(); |
379 |
5/10✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
|
1 | QVERIFY(serverSurfaceCreated.wait()); |
380 | |||
381 | 1 | Wrapland::Server::Surface* childSurface2Interface | |
382 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | = serverSurfaceCreated.first().first().value<Wrapland::Server::Surface*>(); |
383 | |||
384 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | imported2->setParentOf(childSurface2); |
385 |
5/10✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
|
1 | QVERIFY(parentSpy.wait()); |
386 | |||
387 |
4/8✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
1 | QCOMPARE(parentSpy.first().at(1).value<Wrapland::Server::Surface*>(), childSurface2Interface); |
388 |
4/8✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
1 | QCOMPARE(parentSpy.first().at(0).value<Wrapland::Server::Surface*>(), m_exportedServerSurface); |
389 | |||
390 | // parentOf API: | ||
391 | // Check the old relationship is still here. | ||
392 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QCOMPARE(server.globals.xdg_foreign->parentOf(server.child_surface), m_exportedServerSurface); |
393 | |||
394 | // Check the new relationship. | ||
395 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QCOMPARE(server.globals.xdg_foreign->parentOf(childSurface2Interface), m_exportedServerSurface); |
396 | |||
397 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete childSurface2; |
398 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete imported2; |
399 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete exported2; |
400 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete m_imported; |
401 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete m_exportedSurface; |
402 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete m_exported; |
403 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete m_childSurface; |
404 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | } |
405 | |||
406 | 1 | void TestForeign::testImportTwoTimes() | |
407 | { | ||
408 | 1 | doExport(); | |
409 | |||
410 | 1 | QSignalSpy parentSpy(server.globals.xdg_foreign.get(), | |
411 | &Wrapland::Server::XdgForeign::parentChanged); | ||
412 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QVERIFY(parentSpy.isValid()); |
413 | |||
414 | // Import another time the exported window | ||
415 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | Wrapland::Client::XdgImported* imported2 = m_importer->importTopLevel(m_exported->handle()); |
416 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QVERIFY(imported2->isValid()); |
417 | |||
418 | // create a second child surface | ||
419 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | QSignalSpy serverSurfaceCreated(server.globals.compositor.get(), |
420 | &Wrapland::Server::Compositor::surfaceCreated); | ||
421 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QVERIFY(serverSurfaceCreated.isValid()); |
422 | |||
423 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | auto childSurface2 = m_compositor->createSurface(); |
424 |
5/10✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
|
1 | QVERIFY(serverSurfaceCreated.wait()); |
425 | |||
426 | 1 | Wrapland::Server::Surface* childSurface2Interface | |
427 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | = serverSurfaceCreated.first().first().value<Wrapland::Server::Surface*>(); |
428 | |||
429 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | imported2->setParentOf(childSurface2); |
430 |
5/10✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
|
1 | QVERIFY(parentSpy.wait()); |
431 | |||
432 |
4/8✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
1 | QCOMPARE(parentSpy.first().at(1).value<Wrapland::Server::Surface*>(), childSurface2Interface); |
433 |
4/8✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
1 | QCOMPARE(parentSpy.first().at(0).value<Wrapland::Server::Surface*>(), m_exportedServerSurface); |
434 | |||
435 | // parentOf API: | ||
436 | // Check the old relationship is still here. | ||
437 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QCOMPARE(server.globals.xdg_foreign->parentOf(server.child_surface), m_exportedServerSurface); |
438 | // Check the new relationship. | ||
439 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | QCOMPARE(server.globals.xdg_foreign->parentOf(childSurface2Interface), m_exportedServerSurface); |
440 | |||
441 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete imported2; |
442 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete m_imported; |
443 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete m_exportedSurface; |
444 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete m_exported; |
445 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete m_childSurface; |
446 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete childSurface2; |
447 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | } |
448 | |||
449 |
4/8✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
1 | QTEST_GUILESS_MAIN(TestForeign) |
450 | #include "xdg_foreign.moc" | ||
451 |