Changeset View
Changeset View
Standalone View
Standalone View
autotests/client/test_xdg_shell_stable.cpp
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 45 | { | |||
---|---|---|---|---|---|
52 | QVERIFY(xdgSurfaceCreatedSpy.wait()); | 52 | QVERIFY(xdgSurfaceCreatedSpy.wait()); | ||
53 | auto serverXdgSurface = xdgSurfaceCreatedSpy.first().first().value<XdgShellSurfaceInterface*>(); | 53 | auto serverXdgSurface = xdgSurfaceCreatedSpy.first().first().value<XdgShellSurfaceInterface*>(); | ||
54 | QVERIFY(serverXdgSurface); | 54 | QVERIFY(serverXdgSurface); | ||
55 | 55 | | |||
56 | QSignalSpy maxSizeSpy(serverXdgSurface, &XdgShellSurfaceInterface::maxSizeChanged); | 56 | QSignalSpy maxSizeSpy(serverXdgSurface, &XdgShellSurfaceInterface::maxSizeChanged); | ||
57 | QVERIFY(maxSizeSpy.isValid()); | 57 | QVERIFY(maxSizeSpy.isValid()); | ||
58 | 58 | | |||
59 | xdgSurface->setMaxSize(QSize(100, 100)); | 59 | xdgSurface->setMaxSize(QSize(100, 100)); | ||
60 | surface->commit(Surface::CommitFlag::None); | ||||
60 | QVERIFY(maxSizeSpy.wait()); | 61 | QVERIFY(maxSizeSpy.wait()); | ||
61 | QCOMPARE(maxSizeSpy.count(), 1); | 62 | QCOMPARE(maxSizeSpy.count(), 1); | ||
62 | QCOMPARE(maxSizeSpy.last().at(0).value<QSize>(), QSize(100,100)); | 63 | QCOMPARE(maxSizeSpy.last().at(0).value<QSize>(), QSize(100,100)); | ||
64 | QCOMPARE(serverXdgSurface->maximumSize(), QSize(100, 100)); | ||||
63 | 65 | | |||
64 | xdgSurface->setMaxSize(QSize(200, 200)); | 66 | xdgSurface->setMaxSize(QSize(200, 200)); | ||
67 | surface->commit(Surface::CommitFlag::None); | ||||
65 | QVERIFY(maxSizeSpy.wait()); | 68 | QVERIFY(maxSizeSpy.wait()); | ||
66 | QCOMPARE(maxSizeSpy.count(), 2); | 69 | QCOMPARE(maxSizeSpy.count(), 2); | ||
67 | QCOMPARE(maxSizeSpy.last().at(0).value<QSize>(), QSize(200,200)); | 70 | QCOMPARE(maxSizeSpy.last().at(0).value<QSize>(), QSize(200,200)); | ||
71 | QCOMPARE(serverXdgSurface->maximumSize(), QSize(200, 200)); | ||||
68 | } | 72 | } | ||
69 | 73 | | |||
70 | 74 | | |||
71 | void XdgShellTestStable::testPopup_data() | 75 | void XdgShellTestStable::testPopup_data() | ||
72 | { | 76 | { | ||
73 | QTest::addColumn<XdgPositioner>("positioner"); | 77 | QTest::addColumn<XdgPositioner>("positioner"); | ||
74 | XdgPositioner positioner(QSize(10,10), QRect(100,100,50,50)); | 78 | XdgPositioner positioner(QSize(10,10), QRect(100,100,50,50)); | ||
75 | QTest::newRow("default") << positioner; | 79 | QTest::newRow("default") << positioner; | ||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | 133 | { | |||
136 | QVERIFY(xdgSurfaceCreatedSpy.wait()); | 140 | QVERIFY(xdgSurfaceCreatedSpy.wait()); | ||
137 | auto serverXdgSurface = xdgSurfaceCreatedSpy.first().first().value<XdgShellSurfaceInterface*>(); | 141 | auto serverXdgSurface = xdgSurfaceCreatedSpy.first().first().value<XdgShellSurfaceInterface*>(); | ||
138 | QVERIFY(serverXdgSurface); | 142 | QVERIFY(serverXdgSurface); | ||
139 | 143 | | |||
140 | QSignalSpy minSizeSpy(serverXdgSurface, &XdgShellSurfaceInterface::minSizeChanged); | 144 | QSignalSpy minSizeSpy(serverXdgSurface, &XdgShellSurfaceInterface::minSizeChanged); | ||
141 | QVERIFY(minSizeSpy.isValid()); | 145 | QVERIFY(minSizeSpy.isValid()); | ||
142 | 146 | | |||
143 | xdgSurface->setMinSize(QSize(200, 200)); | 147 | xdgSurface->setMinSize(QSize(200, 200)); | ||
148 | surface->commit(Surface::CommitFlag::None); | ||||
144 | QVERIFY(minSizeSpy.wait()); | 149 | QVERIFY(minSizeSpy.wait()); | ||
145 | QCOMPARE(minSizeSpy.count(), 1); | 150 | QCOMPARE(minSizeSpy.count(), 1); | ||
146 | QCOMPARE(minSizeSpy.last().at(0).value<QSize>(), QSize(200,200)); | 151 | QCOMPARE(minSizeSpy.last().at(0).value<QSize>(), QSize(200,200)); | ||
152 | QCOMPARE(serverXdgSurface->minimumSize(), QSize(200, 200)); | ||||
147 | 153 | | |||
148 | xdgSurface->setMinSize(QSize(100, 100)); | 154 | xdgSurface->setMinSize(QSize(100, 100)); | ||
155 | surface->commit(Surface::CommitFlag::None); | ||||
149 | QVERIFY(minSizeSpy.wait()); | 156 | QVERIFY(minSizeSpy.wait()); | ||
150 | QCOMPARE(minSizeSpy.count(), 2); | 157 | QCOMPARE(minSizeSpy.count(), 2); | ||
151 | QCOMPARE(minSizeSpy.last().at(0).value<QSize>(), QSize(100,100)); | 158 | QCOMPARE(minSizeSpy.last().at(0).value<QSize>(), QSize(100,100)); | ||
159 | QCOMPARE(serverXdgSurface->minimumSize(), QSize(100, 100)); | ||||
152 | } | 160 | } | ||
153 | 161 | | |||
154 | //top level then toplevel | 162 | //top level then toplevel | ||
155 | void XdgShellTestStable::testMultipleRoles1() | 163 | void XdgShellTestStable::testMultipleRoles1() | ||
156 | { | 164 | { | ||
157 | //setting multiple roles on an xdg surface should fail | 165 | //setting multiple roles on an xdg surface should fail | ||
158 | QSignalSpy xdgSurfaceCreatedSpy(m_xdgShellInterface, &XdgShellInterface::surfaceCreated); | 166 | QSignalSpy xdgSurfaceCreatedSpy(m_xdgShellInterface, &XdgShellInterface::surfaceCreated); | ||
159 | QSignalSpy xdgPopupCreatedSpy(m_xdgShellInterface, &XdgShellInterface::xdgPopupCreated); | 167 | QSignalSpy xdgPopupCreatedSpy(m_xdgShellInterface, &XdgShellInterface::xdgPopupCreated); | ||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | 194 | { | |||
219 | xdg_surface_destroy(xdgSurface); | 227 | xdg_surface_destroy(xdgSurface); | ||
220 | } | 228 | } | ||
221 | 229 | | |||
222 | void XdgShellTestStable::testWindowGeometry() | 230 | void XdgShellTestStable::testWindowGeometry() | ||
223 | { | 231 | { | ||
224 | SURFACE | 232 | SURFACE | ||
225 | QSignalSpy windowGeometryChangedSpy(serverXdgSurface, &XdgShellSurfaceInterface::windowGeometryChanged); | 233 | QSignalSpy windowGeometryChangedSpy(serverXdgSurface, &XdgShellSurfaceInterface::windowGeometryChanged); | ||
226 | xdgSurface->setWindowGeometry(QRect(50, 50, 400, 400)); | 234 | xdgSurface->setWindowGeometry(QRect(50, 50, 400, 400)); | ||
227 | 235 | surface->commit(Surface::CommitFlag::None); | |||
228 | windowGeometryChangedSpy.wait(); | 236 | QVERIFY(windowGeometryChangedSpy.wait()); | ||
229 | QCOMPARE(serverXdgSurface->windowGeometry(), QRect(50, 50, 400, 400)); | 237 | QCOMPARE(serverXdgSurface->windowGeometry(), QRect(50, 50, 400, 400)); | ||
230 | 238 | | |||
231 | | ||||
232 | //add a popup to this surface | 239 | //add a popup to this surface | ||
233 | XdgPositioner positioner(QSize(10,10), QRect(100,100,50,50)); | 240 | XdgPositioner positioner(QSize(10,10), QRect(100,100,50,50)); | ||
234 | QSignalSpy xdgPopupCreatedSpy(m_xdgShellInterface, &XdgShellInterface::xdgPopupCreated); | 241 | QSignalSpy xdgPopupCreatedSpy(m_xdgShellInterface, &XdgShellInterface::xdgPopupCreated); | ||
235 | QScopedPointer<Surface> popupSurface(m_compositor->createSurface()); | 242 | QScopedPointer<Surface> popupSurface(m_compositor->createSurface()); | ||
236 | QScopedPointer<XdgShellPopup> xdgPopupSurface(m_xdgShell->createPopup(popupSurface.data(), xdgSurface.data(), positioner)); | 243 | QScopedPointer<XdgShellPopup> xdgPopupSurface(m_xdgShell->createPopup(popupSurface.data(), xdgSurface.data(), positioner)); | ||
237 | QVERIFY(xdgPopupCreatedSpy.wait()); | 244 | QVERIFY(xdgPopupCreatedSpy.wait()); | ||
238 | auto serverXdgPopup = xdgPopupCreatedSpy.first().first().value<XdgShellPopupInterface*>(); | 245 | auto serverXdgPopup = xdgPopupCreatedSpy.first().first().value<XdgShellPopupInterface*>(); | ||
239 | QVERIFY(serverXdgPopup); | 246 | QVERIFY(serverXdgPopup); | ||
240 | 247 | | |||
241 | QSignalSpy popupWindowGeometryChangedSpy(serverXdgPopup, &XdgShellPopupInterface::windowGeometryChanged); | 248 | QSignalSpy popupWindowGeometryChangedSpy(serverXdgPopup, &XdgShellPopupInterface::windowGeometryChanged); | ||
242 | xdgPopupSurface->setWindowGeometry(QRect(60, 60, 300, 300)); | 249 | xdgPopupSurface->setWindowGeometry(QRect(60, 60, 300, 300)); | ||
243 | popupWindowGeometryChangedSpy.wait(); | 250 | popupSurface->commit(Surface::CommitFlag::None); | ||
251 | QVERIFY(popupWindowGeometryChangedSpy.wait()); | ||||
244 | QCOMPARE(serverXdgPopup->windowGeometry(), QRect(60, 60, 300, 300)); | 252 | QCOMPARE(serverXdgPopup->windowGeometry(), QRect(60, 60, 300, 300)); | ||
245 | } | 253 | } | ||
246 | 254 | | |||
247 | 255 | | |||
248 | QTEST_GUILESS_MAIN(XdgShellTestStable) | 256 | QTEST_GUILESS_MAIN(XdgShellTestStable) | ||
249 | 257 | | |||
250 | #include "test_xdg_shell_stable.moc" | 258 | #include "test_xdg_shell_stable.moc" | ||
251 | 259 | |