Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/transient_placement.cpp
| Show All 34 Lines | |||||
| 35 | #include <KWayland/Client/registry.h> | 35 | #include <KWayland/Client/registry.h> | ||
| 36 | #include <KWayland/Client/pointer.h> | 36 | #include <KWayland/Client/pointer.h> | ||
| 37 | #include <KWayland/Client/shell.h> | 37 | #include <KWayland/Client/shell.h> | ||
| 38 | #include <KWayland/Client/seat.h> | 38 | #include <KWayland/Client/seat.h> | ||
| 39 | #include <KWayland/Client/server_decoration.h> | 39 | #include <KWayland/Client/server_decoration.h> | ||
| 40 | #include <KWayland/Client/shm_pool.h> | 40 | #include <KWayland/Client/shm_pool.h> | ||
| 41 | #include <KWayland/Client/surface.h> | 41 | #include <KWayland/Client/surface.h> | ||
| 42 | #include <KWayland/Client/touch.h> | 42 | #include <KWayland/Client/touch.h> | ||
| 43 | #include <KWayland/Client/xdgshell.h> | ||||
| 43 | #include <KWayland/Server/seat_interface.h> | 44 | #include <KWayland/Server/seat_interface.h> | ||
| 44 | #include <KWayland/Server/surface_interface.h> | 45 | #include <KWayland/Server/surface_interface.h> | ||
| 45 | 46 | | |||
| 47 | | ||||
| 46 | namespace KWin | 48 | namespace KWin | ||
| 47 | { | 49 | { | ||
| 48 | 50 | | |||
| 49 | static const QString s_socketName = QStringLiteral("wayland_test_kwin_transient_placement-0"); | 51 | static const QString s_socketName = QStringLiteral("wayland_test_kwin_transient_placement-0"); | ||
| 50 | 52 | | |||
| 51 | class TransientPlacementTest : public QObject | 53 | class TransientPlacementTest : public QObject | ||
| 52 | { | 54 | { | ||
| 53 | Q_OBJECT | 55 | Q_OBJECT | ||
| 54 | private Q_SLOTS: | 56 | private Q_SLOTS: | ||
| 55 | void initTestCase(); | 57 | void initTestCase(); | ||
| 56 | void init(); | 58 | void init(); | ||
| 57 | void cleanup(); | 59 | void cleanup(); | ||
| 58 | void testSimplePosition_data(); | 60 | void testSimplePosition_data(); | ||
| 59 | void testSimplePosition(); | 61 | void testSimplePosition(); | ||
| 60 | void testDecorationPosition_data(); | 62 | void testDecorationPosition_data(); | ||
| 61 | void testDecorationPosition(); | 63 | void testDecorationPosition(); | ||
| 64 | void testXdgPopup_data(); | ||||
| 65 | void testXdgPopup(); | ||||
| 62 | 66 | | |||
| 63 | private: | 67 | private: | ||
| 64 | AbstractClient *showWindow(const QSize &size, bool decorated = false, KWayland::Client::Surface *parent = nullptr, const QPoint &offset = QPoint()); | 68 | AbstractClient *showWlShellWindow(const QSize &size, bool decorated = false, KWayland::Client::Surface *parent = nullptr, const QPoint &offset = QPoint()); | ||
| 69 | | ||||
| 65 | KWayland::Client::Surface *surfaceForClient(AbstractClient *c) const; | 70 | KWayland::Client::Surface *surfaceForClient(AbstractClient *c) const; | ||
| 66 | }; | 71 | }; | ||
| 67 | 72 | | |||
| 68 | void TransientPlacementTest::initTestCase() | 73 | void TransientPlacementTest::initTestCase() | ||
| 69 | { | 74 | { | ||
| 70 | qRegisterMetaType<KWin::ShellClient*>(); | 75 | qRegisterMetaType<KWin::ShellClient*>(); | ||
| 71 | qRegisterMetaType<KWin::AbstractClient*>(); | 76 | qRegisterMetaType<KWin::AbstractClient*>(); | ||
| 72 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 77 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
| Show All 19 Lines | 93 | { | |||
| 92 | Cursor::setPos(QPoint(640, 512)); | 97 | Cursor::setPos(QPoint(640, 512)); | ||
| 93 | } | 98 | } | ||
| 94 | 99 | | |||
| 95 | void TransientPlacementTest::cleanup() | 100 | void TransientPlacementTest::cleanup() | ||
| 96 | { | 101 | { | ||
| 97 | Test::destroyWaylandConnection(); | 102 | Test::destroyWaylandConnection(); | ||
| 98 | } | 103 | } | ||
| 99 | 104 | | |||
| 100 | AbstractClient *TransientPlacementTest::showWindow(const QSize &size, bool decorated, KWayland::Client::Surface *parent, const QPoint &offset) | 105 | AbstractClient *TransientPlacementTest::showWlShellWindow(const QSize &size, bool decorated, KWayland::Client::Surface *parent, const QPoint &offset) | ||
| 101 | { | 106 | { | ||
| 102 | using namespace KWayland::Client; | 107 | using namespace KWayland::Client; | ||
| 103 | #define VERIFY(statement) \ | 108 | #define VERIFY(statement) \ | ||
| 104 | if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__))\ | 109 | if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__))\ | ||
| 105 | return nullptr; | 110 | return nullptr; | ||
| 106 | #define COMPARE(actual, expected) \ | 111 | #define COMPARE(actual, expected) \ | ||
| 107 | if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__))\ | 112 | if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__))\ | ||
| 108 | return nullptr; | 113 | return nullptr; | ||
| ▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | |||||
| 166 | } | 171 | } | ||
| 167 | 172 | | |||
| 168 | void TransientPlacementTest::testSimplePosition() | 173 | void TransientPlacementTest::testSimplePosition() | ||
| 169 | { | 174 | { | ||
| 170 | // this test verifies that the position of a transient window is taken from the passed position | 175 | // this test verifies that the position of a transient window is taken from the passed position | ||
| 171 | // there are no further constraints like window too large to fit screen, cascading transients, etc | 176 | // there are no further constraints like window too large to fit screen, cascading transients, etc | ||
| 172 | // some test cases also verify that the transient fits on the screen | 177 | // some test cases also verify that the transient fits on the screen | ||
| 173 | QFETCH(QSize, parentSize); | 178 | QFETCH(QSize, parentSize); | ||
| 174 | AbstractClient *parent = showWindow(parentSize); | 179 | AbstractClient *parent = showWlShellWindow(parentSize); | ||
| 175 | QVERIFY(parent->clientPos().isNull()); | 180 | QVERIFY(parent->clientPos().isNull()); | ||
| 176 | QVERIFY(!parent->isDecorated()); | 181 | QVERIFY(!parent->isDecorated()); | ||
| 177 | QFETCH(QPoint, parentPosition); | 182 | QFETCH(QPoint, parentPosition); | ||
| 178 | parent->move(parentPosition); | 183 | parent->move(parentPosition); | ||
| 179 | QFETCH(QSize, transientSize); | 184 | QFETCH(QSize, transientSize); | ||
| 180 | QFETCH(QPoint, transientOffset); | 185 | QFETCH(QPoint, transientOffset); | ||
| 181 | AbstractClient *transient = showWindow(transientSize, false, surfaceForClient(parent), transientOffset); | 186 | AbstractClient *transient = showWlShellWindow(transientSize, false, surfaceForClient(parent), transientOffset); | ||
| 182 | QVERIFY(transient); | 187 | QVERIFY(transient); | ||
| 183 | QVERIFY(!transient->isDecorated()); | 188 | QVERIFY(!transient->isDecorated()); | ||
| 184 | QVERIFY(transient->hasTransientPlacementHint()); | 189 | QVERIFY(transient->hasTransientPlacementHint()); | ||
| 185 | QTEST(transient->geometry(), "expectedGeometry"); | 190 | QTEST(transient->geometry(), "expectedGeometry"); | ||
| 186 | } | 191 | } | ||
| 187 | 192 | | |||
| 188 | void TransientPlacementTest::testDecorationPosition_data() | 193 | void TransientPlacementTest::testDecorationPosition_data() | ||
| 189 | { | 194 | { | ||
| 190 | QTest::addColumn<QSize>("parentSize"); | 195 | QTest::addColumn<QSize>("parentSize"); | ||
| 191 | QTest::addColumn<QPoint>("parentPosition"); | 196 | QTest::addColumn<QPoint>("parentPosition"); | ||
| 192 | QTest::addColumn<QSize>("transientSize"); | 197 | QTest::addColumn<QSize>("transientSize"); | ||
| 193 | QTest::addColumn<QPoint>("transientOffset"); | 198 | QTest::addColumn<QPoint>("transientOffset"); | ||
| 194 | QTest::addColumn<QRect>("expectedGeometry"); | 199 | QTest::addColumn<QRect>("expectedGeometry"); | ||
| 195 | 200 | | |||
| 196 | QTest::newRow("0/0") << QSize(640, 512) << QPoint(0, 0) << QSize(10, 100) << QPoint(0, 0) << QRect(0, 0, 10, 100); | 201 | QTest::newRow("0/0") << QSize(640, 512) << QPoint(0, 0) << QSize(10, 100) << QPoint(0, 0) << QRect(0, 0, 10, 100); | ||
| 197 | QTest::newRow("bottomRight") << QSize(640, 512) << QPoint(0, 0) << QSize(10, 100) << QPoint(639, 511) << QRect(639, 511, 10, 100); | 202 | QTest::newRow("bottomRight") << QSize(640, 512) << QPoint(0, 0) << QSize(10, 100) << QPoint(639, 511) << QRect(639, 511, 10, 100); | ||
| 198 | QTest::newRow("offset") << QSize(640, 512) << QPoint(200, 300) << QSize(100, 10) << QPoint(320, 256) << QRect(520, 556, 100, 10); | 203 | QTest::newRow("offset") << QSize(640, 512) << QPoint(200, 300) << QSize(100, 10) << QPoint(320, 256) << QRect(520, 556, 100, 10); | ||
| 199 | } | 204 | } | ||
| 200 | 205 | | |||
| 201 | void TransientPlacementTest::testDecorationPosition() | 206 | void TransientPlacementTest::testDecorationPosition() | ||
| 202 | { | 207 | { | ||
| 203 | // this test verifies that a transient window is correctly placed if the parent window has a | 208 | // this test verifies that a transient window is correctly placed if the parent window has a | ||
| 204 | // server side decoration | 209 | // server side decoration | ||
| 205 | QFETCH(QSize, parentSize); | 210 | QFETCH(QSize, parentSize); | ||
| 206 | AbstractClient *parent = showWindow(parentSize, true); | 211 | AbstractClient *parent = showWlShellWindow(parentSize, true); | ||
| 207 | QVERIFY(!parent->clientPos().isNull()); | 212 | QVERIFY(!parent->clientPos().isNull()); | ||
| 208 | QVERIFY(parent->isDecorated()); | 213 | QVERIFY(parent->isDecorated()); | ||
| 209 | QFETCH(QPoint, parentPosition); | 214 | QFETCH(QPoint, parentPosition); | ||
| 210 | parent->move(parentPosition); | 215 | parent->move(parentPosition); | ||
| 211 | QFETCH(QSize, transientSize); | 216 | QFETCH(QSize, transientSize); | ||
| 212 | QFETCH(QPoint, transientOffset); | 217 | QFETCH(QPoint, transientOffset); | ||
| 213 | AbstractClient *transient = showWindow(transientSize, false, surfaceForClient(parent), transientOffset); | 218 | AbstractClient *transient = showWlShellWindow(transientSize, false, surfaceForClient(parent), transientOffset); | ||
| 214 | QVERIFY(transient); | 219 | QVERIFY(transient); | ||
| 215 | QVERIFY(!transient->isDecorated()); | 220 | QVERIFY(!transient->isDecorated()); | ||
| 216 | QVERIFY(transient->hasTransientPlacementHint()); | 221 | QVERIFY(transient->hasTransientPlacementHint()); | ||
| 217 | QFETCH(QRect, expectedGeometry); | 222 | QFETCH(QRect, expectedGeometry); | ||
| 218 | expectedGeometry.translate(parent->clientPos()); | 223 | expectedGeometry.translate(parent->clientPos()); | ||
| 219 | QCOMPARE(transient->geometry(), expectedGeometry); | 224 | QCOMPARE(transient->geometry(), expectedGeometry); | ||
| 220 | } | 225 | } | ||
| 221 | 226 | | |||
| 227 | void TransientPlacementTest::testXdgPopup_data() | ||||
| 228 | { | ||||
| 229 | using namespace KWayland::Client; | ||||
| 230 | | ||||
| 231 | QTest::addColumn<QSize>("parentSize"); | ||||
| 232 | QTest::addColumn<QPoint>("parentPosition"); | ||||
| 233 | QTest::addColumn<XdgPositioner>("positioner"); | ||||
| 234 | QTest::addColumn<QRect>("expectedGeometry"); | ||||
| 235 | | ||||
| 236 | // window in the middle, plenty of room either side: Changing anchor | ||||
| 237 | | ||||
| 238 | // parent window is 500,500, starting at 300,300, anchorRect is therefore between 350->750 in both dirs | ||||
| 239 | XdgPositioner positioner(QSize(200,200), QRect(50,50, 400,400)); | ||||
| 240 | positioner.setGravity(Qt::BottomEdge | Qt::RightEdge); | ||||
| 241 | | ||||
| 242 | positioner.setAnchorEdge(Qt::Edges()); | ||||
| 243 | QTest::newRow("anchorCentre") << QSize(500, 500) << QPoint(300,300) << positioner << QRect(550, 550, 200, 200); | ||||
| 244 | positioner.setAnchorEdge(Qt::TopEdge | Qt::LeftEdge); | ||||
| 245 | QTest::newRow("anchorTopLeft") << QSize(500, 500) << QPoint(300,300) << positioner << QRect(350,350, 200, 200); | ||||
| 246 | positioner.setAnchorEdge(Qt::TopEdge); | ||||
| 247 | QTest::newRow("anchorTop") << QSize(500, 500) << QPoint(300,300) << positioner << QRect(550, 350, 200, 200); | ||||
| 248 | positioner.setAnchorEdge(Qt::TopEdge | Qt::RightEdge); | ||||
| 249 | QTest::newRow("anchorTopRight") << QSize(500, 500) << QPoint(300,300) << positioner << QRect(750, 350, 200, 200); | ||||
| 250 | positioner.setAnchorEdge(Qt::RightEdge); | ||||
| 251 | QTest::newRow("anchorRight") << QSize(500, 500) << QPoint(300,300) << positioner << QRect(750, 550, 200, 200); | ||||
| 252 | positioner.setAnchorEdge(Qt::BottomEdge | Qt::RightEdge); | ||||
| 253 | QTest::newRow("anchorBottomRight") << QSize(500,500) << QPoint(300,300) << positioner << QRect(750, 750, 200, 200); | ||||
| 254 | positioner.setAnchorEdge(Qt::BottomEdge); | ||||
| 255 | QTest::newRow("anchorBottom") << QSize(500, 500) << QPoint(300,300) << positioner << QRect(550, 750, 200, 200); | ||||
| 256 | positioner.setAnchorEdge(Qt::BottomEdge | Qt::LeftEdge); | ||||
| 257 | QTest::newRow("anchorBottomLeft") << QSize(500, 500) << QPoint(300,300) << positioner << QRect(350, 750, 200, 200); | ||||
| 258 | positioner.setAnchorEdge(Qt::LeftEdge); | ||||
| 259 | QTest::newRow("anchorLeft") << QSize(500, 500) << QPoint(300,300) << positioner << QRect(350, 550, 200, 200); | ||||
| 260 | | ||||
| 261 | // ---------------------------------------------------------------- | ||||
| 262 | // window in the middle, plenty of room either side: Changing gravity around the bottom right anchor | ||||
| 263 | positioner.setAnchorEdge(Qt::BottomEdge | Qt::RightEdge); | ||||
| 264 | positioner.setGravity(Qt::Edges()); | ||||
| 265 | QTest::newRow("gravityCentre") << QSize(500, 500) << QPoint(300, 300) << positioner << QRect(650, 650, 200, 200); | ||||
| 266 | positioner.setGravity(Qt::TopEdge | Qt::LeftEdge); | ||||
| 267 | QTest::newRow("gravityTopLeft") << QSize(500, 500) << QPoint(300, 300) << positioner << QRect(550, 550, 200, 200); | ||||
| 268 | positioner.setGravity(Qt::TopEdge); | ||||
| 269 | QTest::newRow("gravityTop") << QSize(500, 500) << QPoint(300, 300) << positioner << QRect(650, 550, 200, 200); | ||||
| 270 | positioner.setGravity(Qt::TopEdge | Qt::RightEdge); | ||||
| 271 | QTest::newRow("gravityTopRight") << QSize(500, 500) << QPoint(300, 300) << positioner << QRect(750, 550, 200, 200); | ||||
| 272 | positioner.setGravity(Qt::RightEdge); | ||||
| 273 | QTest::newRow("gravityRight") << QSize(500, 500) << QPoint(300, 300) << positioner << QRect(750, 650, 200, 200); | ||||
| 274 | positioner.setGravity(Qt::BottomEdge | Qt::RightEdge); | ||||
| 275 | QTest::newRow("gravityBottomRight") << QSize(500, 500) << QPoint(300, 300) << positioner << QRect(750, 750, 200, 200); | ||||
| 276 | positioner.setGravity(Qt::BottomEdge); | ||||
| 277 | QTest::newRow("gravityBottom") << QSize(500, 500) << QPoint(300, 300) << positioner << QRect(650, 750, 200, 200); | ||||
| 278 | positioner.setGravity(Qt::BottomEdge | Qt::LeftEdge); | ||||
| 279 | QTest::newRow("gravityBottomLeft") << QSize(500, 500) << QPoint(300, 300) << positioner << QRect(550, 750, 200, 200); | ||||
| 280 | positioner.setGravity(Qt::LeftEdge); | ||||
| 281 | QTest::newRow("gravityLeft") << QSize(500, 500) << QPoint(300, 300) << positioner << QRect(550, 650, 200, 200); | ||||
| 282 | | ||||
| 283 | // ---------------------------------------------------------------- | ||||
| 284 | //constrain and slide | ||||
| 285 | //popup is still 200,200. window moved near edge of screen, popup always comes out towards the screen edge | ||||
| 286 | positioner.setConstraints(XdgPositioner::Constraint::SlideX | XdgPositioner::Constraint::SlideY); | ||||
| 287 | | ||||
| 288 | positioner.setAnchorEdge(Qt::TopEdge); | ||||
| 289 | positioner.setGravity(Qt::TopEdge); | ||||
| 290 | QTest::newRow("constraintSlideTop") << QSize(500, 500) << QPoint(80, 80) << positioner << QRect(80 + 250 - 100, 0, 200, 200); | ||||
| 291 | | ||||
| 292 | positioner.setAnchorEdge(Qt::LeftEdge); | ||||
| 293 | positioner.setGravity(Qt::LeftEdge); | ||||
| 294 | QTest::newRow("constraintSlideLeft") << QSize(500, 500) << QPoint(80, 80) << positioner << QRect(0, 80 + 250 - 100, 200, 200); | ||||
| 295 | | ||||
| 296 | positioner.setAnchorEdge(Qt::RightEdge); | ||||
| 297 | positioner.setGravity(Qt::RightEdge); | ||||
| 298 | QTest::newRow("constraintSlideRight") << QSize(500, 500) << QPoint(700, 80) << positioner << QRect(1280 - 200, 80 + 250 - 100, 200, 200); | ||||
| 299 | | ||||
| 300 | positioner.setAnchorEdge(Qt::BottomEdge); | ||||
| 301 | positioner.setGravity(Qt::BottomEdge); | ||||
| 302 | QTest::newRow("constraintSlideBottom") << QSize(500, 500) << QPoint(80, 500) << positioner << QRect(80 + 250 - 100, 1024 - 200, 200, 200); | ||||
| 303 | | ||||
| 304 | positioner.setAnchorEdge(Qt::BottomEdge | Qt::RightEdge); | ||||
| 305 | positioner.setGravity(Qt::BottomEdge| Qt::RightEdge); | ||||
| 306 | QTest::newRow("constraintSlideBottomRight") << QSize(500, 500) << QPoint(700, 1000) << positioner << QRect(1280 - 200, 1024 - 200, 200, 200); | ||||
| 307 | | ||||
| 308 | | ||||
| 309 | // ---------------------------------------------------------------- | ||||
| 310 | // constrain and flip | ||||
zzag: Typo: contrain. | |||||
| 311 | positioner.setConstraints(XdgPositioner::Constraint::FlipX | XdgPositioner::Constraint::FlipY); | ||||
| 312 | | ||||
| 313 | positioner.setAnchorEdge(Qt::TopEdge); | ||||
| 314 | positioner.setGravity(Qt::TopEdge); | ||||
| 315 | QTest::newRow("constraintFlipTop") << QSize(500, 500) << QPoint(80, 80) << positioner << QRect(230, 80 + 500 - 50, 200, 200); | ||||
| 316 | | ||||
| 317 | positioner.setAnchorEdge(Qt::LeftEdge); | ||||
| 318 | positioner.setGravity(Qt::LeftEdge); | ||||
| 319 | QTest::newRow("constraintFlipLeft") << QSize(500, 500) << QPoint(80, 80) << positioner << QRect(80 + 500 - 50, 230, 200, 200); | ||||
| 320 | | ||||
| 321 | positioner.setAnchorEdge(Qt::RightEdge); | ||||
| 322 | positioner.setGravity(Qt::RightEdge); | ||||
| 323 | QTest::newRow("constraintFlipRight") << QSize(500, 500) << QPoint(700, 80) << positioner << QRect(700 + 50 - 200, 230, 200, 200); | ||||
| 324 | | ||||
| 325 | positioner.setAnchorEdge(Qt::BottomEdge); | ||||
| 326 | positioner.setGravity(Qt::BottomEdge); | ||||
| 327 | QTest::newRow("constraintFlipBottom") << QSize(500, 500) << QPoint(80, 500) << positioner << QRect(230, 500 + 50 - 200, 200, 200); | ||||
| 328 | | ||||
| 329 | positioner.setAnchorEdge(Qt::BottomEdge | Qt::RightEdge); | ||||
| 330 | positioner.setGravity(Qt::BottomEdge| Qt::RightEdge); | ||||
| 331 | QTest::newRow("constraintFlipBottomRight") << QSize(500, 500) << QPoint(700, 500) << positioner << QRect(700 + 50 - 200, 500 + 50 - 200, 200, 200); | ||||
| 332 | | ||||
| 333 | positioner.setAnchorEdge(Qt::TopEdge); | ||||
| 334 | positioner.setGravity(Qt::RightEdge); | ||||
| 335 | //as popup is positioned in the middle of the parent we need a massive popup to be able to overflow | ||||
| 336 | positioner.setInitialSize(QSize(400, 400)); | ||||
| 337 | QTest::newRow("constraintFlipRightNoAnchor") << QSize(500, 500) << QPoint(700, 80) << positioner << QRect(700 + 250 - 400, 330, 400, 400); | ||||
| 338 | | ||||
| 339 | positioner.setAnchorEdge(Qt::RightEdge); | ||||
| 340 | positioner.setGravity(Qt::TopEdge); | ||||
| 341 | positioner.setInitialSize(QSize(300, 200)); | ||||
| 342 | QTest::newRow("constraintFlipRightNoGravity") << QSize(500, 500) << QPoint(700, 80) << positioner << QRect(700 + 50 - 150, 130, 300, 200); | ||||
| 343 | } | ||||
| 344 | | ||||
| 345 | void TransientPlacementTest::testXdgPopup() | ||||
| 346 | { | ||||
| 347 | using namespace KWayland::Client; | ||||
| 348 | | ||||
| 349 | // this test verifies that the position of a transient window is taken from the passed position | ||||
| 350 | // there are no further constraints like window too large to fit screen, cascading transients, etc | ||||
| 351 | // some test cases also verify that the transient fits on the screen | ||||
| 352 | QFETCH(QSize, parentSize); | ||||
| 353 | | ||||
| 354 | //create parent | ||||
| 355 | Surface *surface = Test::createSurface(Test::waylandCompositor()); | ||||
| 356 | QVERIFY(surface); | ||||
| 357 | auto parentShellSurface = Test::createXdgShellStableSurface(surface, Test::waylandCompositor()); | ||||
| 358 | QVERIFY(parentShellSurface); | ||||
| 359 | auto parent = Test::renderAndWaitForShown(surface, parentSize, Qt::blue); | ||||
| 360 | QVERIFY(parent); | ||||
| 361 | | ||||
| 362 | QVERIFY(!parent->isDecorated()); | ||||
| 363 | QFETCH(QPoint, parentPosition); | ||||
| 364 | parent->move(parentPosition); | ||||
| 365 | | ||||
| 366 | //create popup | ||||
| 367 | QFETCH(XdgPositioner, positioner); | ||||
| 368 | | ||||
| 369 | Surface *transientSurface = Test::createSurface(Test::waylandCompositor()); | ||||
| 370 | QVERIFY(transientSurface); | ||||
| 371 | | ||||
| 372 | Test::createXdgShellStablePopup(transientSurface, parentShellSurface, positioner, Test::waylandCompositor()); | ||||
| 373 | auto transient = Test::renderAndWaitForShown(transientSurface, positioner.initialSize(), Qt::red); | ||||
| 374 | QVERIFY(transient); | ||||
| 375 | | ||||
| 376 | QVERIFY(!transient->isDecorated()); | ||||
| 377 | QVERIFY(transient->hasTransientPlacementHint()); | ||||
| 378 | QTEST(transient->geometry(), "expectedGeometry"); | ||||
| 379 | } | ||||
| 380 | | ||||
| 222 | } | 381 | } | ||
| 223 | 382 | | |||
| 224 | WAYLANDTEST_MAIN(KWin::TransientPlacementTest) | 383 | WAYLANDTEST_MAIN(KWin::TransientPlacementTest) | ||
| 225 | #include "transient_placement.moc" | 384 | #include "transient_placement.moc" | ||
Typo: contrain.