Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/internal_window.cpp
Show First 20 Lines • Show All 217 Lines • ▼ Show 20 Line(s) | 217 | { | |||
---|---|---|---|---|---|
218 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 218 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||
219 | QVERIFY(clientAddedSpy.isValid()); | 219 | QVERIFY(clientAddedSpy.isValid()); | ||
220 | HelperWindow win; | 220 | HelperWindow win; | ||
221 | QVERIFY(!workspace()->findToplevel(nullptr)); | 221 | QVERIFY(!workspace()->findToplevel(nullptr)); | ||
222 | QVERIFY(!workspace()->findToplevel(&win)); | 222 | QVERIFY(!workspace()->findToplevel(&win)); | ||
223 | win.setGeometry(0, 0, 100, 100); | 223 | win.setGeometry(0, 0, 100, 100); | ||
224 | win.show(); | 224 | win.show(); | ||
225 | 225 | | |||
226 | QVERIFY(clientAddedSpy.wait()); | 226 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
227 | QCOMPARE(clientAddedSpy.count(), 1); | | |||
zzag: Change it to QTRY_COMPARE, so we will wait if no events have been dispatched. That's not… | |||||
228 | QVERIFY(!workspace()->activeClient()); | 227 | QVERIFY(!workspace()->activeClient()); | ||
229 | ShellClient *c = clientAddedSpy.first().first().value<ShellClient*>(); | 228 | ShellClient *c = clientAddedSpy.first().first().value<ShellClient*>(); | ||
230 | QVERIFY(c->isInternal()); | 229 | QVERIFY(c->isInternal()); | ||
231 | QVERIFY(qobject_cast<InternalClient*>(c)); | 230 | QVERIFY(qobject_cast<InternalClient*>(c)); | ||
232 | QCOMPARE(c->icon().name(), QStringLiteral("wayland")); | 231 | QCOMPARE(c->icon().name(), QStringLiteral("wayland")); | ||
233 | QVERIFY(!c->isDecorated()); | 232 | QVERIFY(!c->isDecorated()); | ||
234 | QCOMPARE(workspace()->findToplevel(&win), c); | 233 | QCOMPARE(workspace()->findToplevel(&win), c); | ||
235 | QCOMPARE(c->geometry(), QRect(0, 0, 100, 100)); | 234 | QCOMPARE(c->geometry(), QRect(0, 0, 100, 100)); | ||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 278 | { | |||
282 | HelperWindow win; | 281 | HelperWindow win; | ||
283 | win.setGeometry(0, 0, 100, 100); | 282 | win.setGeometry(0, 0, 100, 100); | ||
284 | win.show(); | 283 | win.show(); | ||
285 | QSignalSpy pressSpy(&win, &HelperWindow::mousePressed); | 284 | QSignalSpy pressSpy(&win, &HelperWindow::mousePressed); | ||
286 | QVERIFY(pressSpy.isValid()); | 285 | QVERIFY(pressSpy.isValid()); | ||
287 | QSignalSpy releaseSpy(&win, &HelperWindow::mouseReleased); | 286 | QSignalSpy releaseSpy(&win, &HelperWindow::mouseReleased); | ||
288 | QVERIFY(releaseSpy.isValid()); | 287 | QVERIFY(releaseSpy.isValid()); | ||
289 | 288 | | |||
290 | QVERIFY(clientAddedSpy.wait()); | 289 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
291 | QCOMPARE(clientAddedSpy.count(), 1); | | |||
292 | 290 | | |||
293 | quint32 timestamp = 1; | 291 | quint32 timestamp = 1; | ||
294 | kwinApp()->platform()->pointerMotion(QPoint(50, 50), timestamp++); | 292 | kwinApp()->platform()->pointerMotion(QPoint(50, 50), timestamp++); | ||
295 | 293 | | |||
296 | kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); | 294 | kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); | ||
297 | QTRY_COMPARE(pressSpy.count(), 1); | 295 | QTRY_COMPARE(pressSpy.count(), 1); | ||
298 | kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); | 296 | kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); | ||
299 | QTRY_COMPARE(releaseSpy.count(), 1); | 297 | QTRY_COMPARE(releaseSpy.count(), 1); | ||
300 | } | 298 | } | ||
301 | 299 | | |||
302 | void InternalWindowTest::testPointerAxis() | 300 | void InternalWindowTest::testPointerAxis() | ||
303 | { | 301 | { | ||
304 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 302 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||
305 | QVERIFY(clientAddedSpy.isValid()); | 303 | QVERIFY(clientAddedSpy.isValid()); | ||
306 | HelperWindow win; | 304 | HelperWindow win; | ||
307 | win.setGeometry(0, 0, 100, 100); | 305 | win.setGeometry(0, 0, 100, 100); | ||
308 | win.show(); | 306 | win.show(); | ||
309 | QSignalSpy wheelSpy(&win, &HelperWindow::wheel); | 307 | QSignalSpy wheelSpy(&win, &HelperWindow::wheel); | ||
310 | QVERIFY(wheelSpy.isValid()); | 308 | QVERIFY(wheelSpy.isValid()); | ||
311 | QVERIFY(clientAddedSpy.wait()); | 309 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
312 | QCOMPARE(clientAddedSpy.count(), 1); | | |||
313 | 310 | | |||
314 | quint32 timestamp = 1; | 311 | quint32 timestamp = 1; | ||
315 | kwinApp()->platform()->pointerMotion(QPoint(50, 50), timestamp++); | 312 | kwinApp()->platform()->pointerMotion(QPoint(50, 50), timestamp++); | ||
316 | 313 | | |||
317 | kwinApp()->platform()->pointerAxisVertical(5.0, timestamp++); | 314 | kwinApp()->platform()->pointerAxisVertical(5.0, timestamp++); | ||
318 | QTRY_COMPARE(wheelSpy.count(), 1); | 315 | QTRY_COMPARE(wheelSpy.count(), 1); | ||
319 | kwinApp()->platform()->pointerAxisHorizontal(5.0, timestamp++); | 316 | kwinApp()->platform()->pointerAxisHorizontal(5.0, timestamp++); | ||
320 | QTRY_COMPARE(wheelSpy.count(), 2); | 317 | QTRY_COMPARE(wheelSpy.count(), 2); | ||
Show All 13 Lines | 329 | { | |||
334 | QVERIFY(clientAddedSpy.isValid()); | 331 | QVERIFY(clientAddedSpy.isValid()); | ||
335 | HelperWindow win; | 332 | HelperWindow win; | ||
336 | win.setGeometry(0, 0, 100, 100); | 333 | win.setGeometry(0, 0, 100, 100); | ||
337 | win.show(); | 334 | win.show(); | ||
338 | QSignalSpy pressSpy(&win, &HelperWindow::keyPressed); | 335 | QSignalSpy pressSpy(&win, &HelperWindow::keyPressed); | ||
339 | QVERIFY(pressSpy.isValid()); | 336 | QVERIFY(pressSpy.isValid()); | ||
340 | QSignalSpy releaseSpy(&win, &HelperWindow::keyReleased); | 337 | QSignalSpy releaseSpy(&win, &HelperWindow::keyReleased); | ||
341 | QVERIFY(releaseSpy.isValid()); | 338 | QVERIFY(releaseSpy.isValid()); | ||
342 | QVERIFY(clientAddedSpy.wait()); | 339 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
343 | QCOMPARE(clientAddedSpy.count(), 1); | | |||
344 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 340 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | ||
345 | QVERIFY(internalClient); | 341 | QVERIFY(internalClient); | ||
346 | QVERIFY(internalClient->isInternal()); | 342 | QVERIFY(internalClient->isInternal()); | ||
347 | QVERIFY(internalClient->readyForPainting()); | 343 | QVERIFY(internalClient->readyForPainting()); | ||
348 | 344 | | |||
349 | quint32 timestamp = 1; | 345 | quint32 timestamp = 1; | ||
350 | QFETCH(QPoint, cursorPos); | 346 | QFETCH(QPoint, cursorPos); | ||
351 | kwinApp()->platform()->pointerMotion(cursorPos, timestamp++); | 347 | kwinApp()->platform()->pointerMotion(cursorPos, timestamp++); | ||
Show All 13 Lines | 358 | { | |||
365 | HelperWindow win; | 361 | HelperWindow win; | ||
366 | win.setProperty("_q_showWithoutActivating", true); | 362 | win.setProperty("_q_showWithoutActivating", true); | ||
367 | win.setGeometry(0, 0, 100, 100); | 363 | win.setGeometry(0, 0, 100, 100); | ||
368 | win.show(); | 364 | win.show(); | ||
369 | QSignalSpy pressSpy(&win, &HelperWindow::keyPressed); | 365 | QSignalSpy pressSpy(&win, &HelperWindow::keyPressed); | ||
370 | QVERIFY(pressSpy.isValid()); | 366 | QVERIFY(pressSpy.isValid()); | ||
371 | QSignalSpy releaseSpy(&win, &HelperWindow::keyReleased); | 367 | QSignalSpy releaseSpy(&win, &HelperWindow::keyReleased); | ||
372 | QVERIFY(releaseSpy.isValid()); | 368 | QVERIFY(releaseSpy.isValid()); | ||
373 | QVERIFY(clientAddedSpy.wait()); | 369 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
374 | QCOMPARE(clientAddedSpy.count(), 1); | | |||
375 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 370 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | ||
376 | QVERIFY(internalClient); | 371 | QVERIFY(internalClient); | ||
377 | QVERIFY(internalClient->isInternal()); | 372 | QVERIFY(internalClient->isInternal()); | ||
378 | QVERIFY(internalClient->readyForPainting()); | 373 | QVERIFY(internalClient->readyForPainting()); | ||
379 | 374 | | |||
380 | quint32 timestamp = 1; | 375 | quint32 timestamp = 1; | ||
381 | const QPoint cursorPos = QPoint(50, 50); | 376 | const QPoint cursorPos = QPoint(50, 50); | ||
382 | kwinApp()->platform()->pointerMotion(cursorPos, timestamp++); | 377 | kwinApp()->platform()->pointerMotion(cursorPos, timestamp++); | ||
Show All 38 Lines | 390 | { | |||
421 | QVERIFY(clientAddedSpy.isValid()); | 416 | QVERIFY(clientAddedSpy.isValid()); | ||
422 | HelperWindow win; | 417 | HelperWindow win; | ||
423 | win.setGeometry(0, 0, 100, 100); | 418 | win.setGeometry(0, 0, 100, 100); | ||
424 | win.show(); | 419 | win.show(); | ||
425 | QSignalSpy pressSpy(&win, &HelperWindow::keyPressed); | 420 | QSignalSpy pressSpy(&win, &HelperWindow::keyPressed); | ||
426 | QVERIFY(pressSpy.isValid()); | 421 | QVERIFY(pressSpy.isValid()); | ||
427 | QSignalSpy releaseSpy(&win, &HelperWindow::keyReleased); | 422 | QSignalSpy releaseSpy(&win, &HelperWindow::keyReleased); | ||
428 | QVERIFY(releaseSpy.isValid()); | 423 | QVERIFY(releaseSpy.isValid()); | ||
429 | QVERIFY(clientAddedSpy.wait()); | 424 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
430 | QCOMPARE(clientAddedSpy.count(), 1); | | |||
431 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 425 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | ||
432 | QVERIFY(internalClient); | 426 | QVERIFY(internalClient); | ||
433 | QVERIFY(internalClient->isInternal()); | 427 | QVERIFY(internalClient->isInternal()); | ||
434 | QVERIFY(internalClient->readyForPainting()); | 428 | QVERIFY(internalClient->readyForPainting()); | ||
435 | 429 | | |||
436 | QVERIFY(leftSpy.isEmpty()); | 430 | QVERIFY(leftSpy.isEmpty()); | ||
437 | QVERIFY(!leftSpy.wait(100)); | 431 | QVERIFY(!leftSpy.wait(100)); | ||
438 | 432 | | |||
Show All 16 Lines | |||||
455 | void InternalWindowTest::testTouch() | 449 | void InternalWindowTest::testTouch() | ||
456 | { | 450 | { | ||
457 | // touch events for internal windows are emulated through mouse events | 451 | // touch events for internal windows are emulated through mouse events | ||
458 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 452 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||
459 | QVERIFY(clientAddedSpy.isValid()); | 453 | QVERIFY(clientAddedSpy.isValid()); | ||
460 | HelperWindow win; | 454 | HelperWindow win; | ||
461 | win.setGeometry(0, 0, 100, 100); | 455 | win.setGeometry(0, 0, 100, 100); | ||
462 | win.show(); | 456 | win.show(); | ||
463 | QVERIFY(clientAddedSpy.wait()); | 457 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
464 | QCOMPARE(clientAddedSpy.count(), 1); | | |||
465 | 458 | | |||
466 | QSignalSpy pressSpy(&win, &HelperWindow::mousePressed); | 459 | QSignalSpy pressSpy(&win, &HelperWindow::mousePressed); | ||
467 | QVERIFY(pressSpy.isValid()); | 460 | QVERIFY(pressSpy.isValid()); | ||
468 | QSignalSpy releaseSpy(&win, &HelperWindow::mouseReleased); | 461 | QSignalSpy releaseSpy(&win, &HelperWindow::mouseReleased); | ||
469 | QVERIFY(releaseSpy.isValid()); | 462 | QVERIFY(releaseSpy.isValid()); | ||
470 | QSignalSpy moveSpy(&win, &HelperWindow::mouseMoved); | 463 | QSignalSpy moveSpy(&win, &HelperWindow::mouseMoved); | ||
471 | QVERIFY(moveSpy.isValid()); | 464 | QVERIFY(moveSpy.isValid()); | ||
472 | 465 | | |||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | |||||
522 | { | 515 | { | ||
523 | // this test verifies that opacity is properly synced from QWindow to ShellClient | 516 | // this test verifies that opacity is properly synced from QWindow to ShellClient | ||
524 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 517 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||
525 | QVERIFY(clientAddedSpy.isValid()); | 518 | QVERIFY(clientAddedSpy.isValid()); | ||
526 | HelperWindow win; | 519 | HelperWindow win; | ||
527 | win.setOpacity(0.5); | 520 | win.setOpacity(0.5); | ||
528 | win.setGeometry(0, 0, 100, 100); | 521 | win.setGeometry(0, 0, 100, 100); | ||
529 | win.show(); | 522 | win.show(); | ||
530 | QVERIFY(clientAddedSpy.wait()); | 523 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
531 | QCOMPARE(clientAddedSpy.count(), 1); | | |||
532 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 524 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | ||
533 | QVERIFY(internalClient); | 525 | QVERIFY(internalClient); | ||
534 | QVERIFY(internalClient->isInternal()); | 526 | QVERIFY(internalClient->isInternal()); | ||
535 | QCOMPARE(internalClient->opacity(), 0.5); | 527 | QCOMPARE(internalClient->opacity(), 0.5); | ||
536 | 528 | | |||
537 | QSignalSpy opacityChangedSpy(internalClient, &ShellClient::opacityChanged); | 529 | QSignalSpy opacityChangedSpy(internalClient, &ShellClient::opacityChanged); | ||
538 | QVERIFY(opacityChangedSpy.isValid()); | 530 | QVERIFY(opacityChangedSpy.isValid()); | ||
539 | win.setOpacity(0.75); | 531 | win.setOpacity(0.75); | ||
540 | QCOMPARE(opacityChangedSpy.count(), 1); | 532 | QCOMPARE(opacityChangedSpy.count(), 1); | ||
541 | QCOMPARE(internalClient->opacity(), 0.75); | 533 | QCOMPARE(internalClient->opacity(), 0.75); | ||
542 | } | 534 | } | ||
543 | 535 | | |||
544 | void InternalWindowTest::testMove() | 536 | void InternalWindowTest::testMove() | ||
545 | { | 537 | { | ||
546 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 538 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||
547 | QVERIFY(clientAddedSpy.isValid()); | 539 | QVERIFY(clientAddedSpy.isValid()); | ||
548 | HelperWindow win; | 540 | HelperWindow win; | ||
549 | win.setOpacity(0.5); | 541 | win.setOpacity(0.5); | ||
550 | win.setGeometry(0, 0, 100, 100); | 542 | win.setGeometry(0, 0, 100, 100); | ||
551 | win.show(); | 543 | win.show(); | ||
552 | QVERIFY(clientAddedSpy.wait()); | 544 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
553 | QCOMPARE(clientAddedSpy.count(), 1); | | |||
554 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 545 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | ||
555 | QVERIFY(internalClient); | 546 | QVERIFY(internalClient); | ||
556 | QCOMPARE(internalClient->geometry(), QRect(0, 0, 100, 100)); | 547 | QCOMPARE(internalClient->geometry(), QRect(0, 0, 100, 100)); | ||
557 | 548 | | |||
558 | // normal move should be synced | 549 | // normal move should be synced | ||
559 | internalClient->move(5, 10); | 550 | internalClient->move(5, 10); | ||
560 | QCOMPARE(internalClient->geometry(), QRect(5, 10, 100, 100)); | 551 | QCOMPARE(internalClient->geometry(), QRect(5, 10, 100, 100)); | ||
561 | QTRY_COMPARE(win.geometry(), QRect(5, 10, 100, 100)); | 552 | QTRY_COMPARE(win.geometry(), QRect(5, 10, 100, 100)); | ||
Show All 26 Lines | 578 | { | |||
588 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 579 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||
589 | QVERIFY(clientAddedSpy.isValid()); | 580 | QVERIFY(clientAddedSpy.isValid()); | ||
590 | HelperWindow win; | 581 | HelperWindow win; | ||
591 | win.setOpacity(0.5); | 582 | win.setOpacity(0.5); | ||
592 | win.setGeometry(0, 0, 100, 100); | 583 | win.setGeometry(0, 0, 100, 100); | ||
593 | QFETCH(bool, initial); | 584 | QFETCH(bool, initial); | ||
594 | win.setProperty("KWIN_SKIP_CLOSE_ANIMATION", initial); | 585 | win.setProperty("KWIN_SKIP_CLOSE_ANIMATION", initial); | ||
595 | win.show(); | 586 | win.show(); | ||
596 | QVERIFY(clientAddedSpy.wait()); | 587 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
597 | QCOMPARE(clientAddedSpy.count(), 1); | | |||
598 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 588 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | ||
599 | QVERIFY(internalClient); | 589 | QVERIFY(internalClient); | ||
600 | QCOMPARE(internalClient->skipsCloseAnimation(), initial); | 590 | QCOMPARE(internalClient->skipsCloseAnimation(), initial); | ||
601 | QSignalSpy skipCloseChangedSpy(internalClient, &Toplevel::skipCloseAnimationChanged); | 591 | QSignalSpy skipCloseChangedSpy(internalClient, &Toplevel::skipCloseAnimationChanged); | ||
602 | QVERIFY(skipCloseChangedSpy.isValid()); | 592 | QVERIFY(skipCloseChangedSpy.isValid()); | ||
603 | win.setProperty("KWIN_SKIP_CLOSE_ANIMATION", !initial); | 593 | win.setProperty("KWIN_SKIP_CLOSE_ANIMATION", !initial); | ||
604 | QCOMPARE(skipCloseChangedSpy.count(), 1); | 594 | QCOMPARE(skipCloseChangedSpy.count(), 1); | ||
605 | QCOMPARE(internalClient->skipsCloseAnimation(), !initial); | 595 | QCOMPARE(internalClient->skipsCloseAnimation(), !initial); | ||
606 | win.setProperty("KWIN_SKIP_CLOSE_ANIMATION", initial); | 596 | win.setProperty("KWIN_SKIP_CLOSE_ANIMATION", initial); | ||
607 | QCOMPARE(skipCloseChangedSpy.count(), 2); | 597 | QCOMPARE(skipCloseChangedSpy.count(), 2); | ||
608 | QCOMPARE(internalClient->skipsCloseAnimation(), initial); | 598 | QCOMPARE(internalClient->skipsCloseAnimation(), initial); | ||
609 | } | 599 | } | ||
610 | 600 | | |||
611 | void InternalWindowTest::testModifierClickUnrestrictedMove() | 601 | void InternalWindowTest::testModifierClickUnrestrictedMove() | ||
612 | { | 602 | { | ||
613 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 603 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||
614 | QVERIFY(clientAddedSpy.isValid()); | 604 | QVERIFY(clientAddedSpy.isValid()); | ||
615 | HelperWindow win; | 605 | HelperWindow win; | ||
616 | win.setGeometry(0, 0, 100, 100); | 606 | win.setGeometry(0, 0, 100, 100); | ||
617 | win.setFlags(win.flags() & ~Qt::FramelessWindowHint); | 607 | win.setFlags(win.flags() & ~Qt::FramelessWindowHint); | ||
618 | win.show(); | 608 | win.show(); | ||
619 | QVERIFY(clientAddedSpy.wait()); | 609 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
620 | QCOMPARE(clientAddedSpy.count(), 1); | | |||
621 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 610 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | ||
622 | QVERIFY(internalClient); | 611 | QVERIFY(internalClient); | ||
623 | QVERIFY(internalClient->isDecorated()); | 612 | QVERIFY(internalClient->isDecorated()); | ||
624 | 613 | | |||
625 | KConfigGroup group = kwinApp()->config()->group("MouseBindings"); | 614 | KConfigGroup group = kwinApp()->config()->group("MouseBindings"); | ||
626 | group.writeEntry("CommandAllKey", "Alt"); | 615 | group.writeEntry("CommandAllKey", "Alt"); | ||
627 | group.writeEntry("CommandAll1", "Move"); | 616 | group.writeEntry("CommandAll1", "Move"); | ||
628 | group.writeEntry("CommandAll2", "Move"); | 617 | group.writeEntry("CommandAll2", "Move"); | ||
Show All 25 Lines | |||||
654 | void InternalWindowTest::testModifierScroll() | 643 | void InternalWindowTest::testModifierScroll() | ||
655 | { | 644 | { | ||
656 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 645 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||
657 | QVERIFY(clientAddedSpy.isValid()); | 646 | QVERIFY(clientAddedSpy.isValid()); | ||
658 | HelperWindow win; | 647 | HelperWindow win; | ||
659 | win.setGeometry(0, 0, 100, 100); | 648 | win.setGeometry(0, 0, 100, 100); | ||
660 | win.setFlags(win.flags() & ~Qt::FramelessWindowHint); | 649 | win.setFlags(win.flags() & ~Qt::FramelessWindowHint); | ||
661 | win.show(); | 650 | win.show(); | ||
662 | QVERIFY(clientAddedSpy.wait()); | 651 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
663 | QCOMPARE(clientAddedSpy.count(), 1); | | |||
664 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 652 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | ||
665 | QVERIFY(internalClient); | 653 | QVERIFY(internalClient); | ||
666 | QVERIFY(internalClient->isDecorated()); | 654 | QVERIFY(internalClient->isDecorated()); | ||
667 | 655 | | |||
668 | KConfigGroup group = kwinApp()->config()->group("MouseBindings"); | 656 | KConfigGroup group = kwinApp()->config()->group("MouseBindings"); | ||
669 | group.writeEntry("CommandAllKey", "Alt"); | 657 | group.writeEntry("CommandAllKey", "Alt"); | ||
670 | group.writeEntry("CommandAllWheel", "change opacity"); | 658 | group.writeEntry("CommandAllWheel", "change opacity"); | ||
671 | group.sync(); | 659 | group.sync(); | ||
Show All 17 Lines | |||||
689 | void InternalWindowTest::testPopup() | 677 | void InternalWindowTest::testPopup() | ||
690 | { | 678 | { | ||
691 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 679 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||
692 | QVERIFY(clientAddedSpy.isValid()); | 680 | QVERIFY(clientAddedSpy.isValid()); | ||
693 | HelperWindow win; | 681 | HelperWindow win; | ||
694 | win.setGeometry(0, 0, 100, 100); | 682 | win.setGeometry(0, 0, 100, 100); | ||
695 | win.setFlags(win.flags() | Qt::Popup); | 683 | win.setFlags(win.flags() | Qt::Popup); | ||
696 | win.show(); | 684 | win.show(); | ||
697 | QVERIFY(clientAddedSpy.wait()); | 685 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
698 | QCOMPARE(clientAddedSpy.count(), 1); | | |||
699 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 686 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | ||
700 | QVERIFY(internalClient); | 687 | QVERIFY(internalClient); | ||
701 | QCOMPARE(internalClient->isPopupWindow(), true); | 688 | QCOMPARE(internalClient->isPopupWindow(), true); | ||
702 | } | 689 | } | ||
703 | 690 | | |||
704 | void InternalWindowTest::testScale() | 691 | void InternalWindowTest::testScale() | ||
705 | { | 692 | { | ||
706 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, | 693 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, | ||
707 | Q_ARG(int, 2), | 694 | Q_ARG(int, 2), | ||
708 | Q_ARG(QVector<QRect>, QVector<QRect>({QRect(0,0,1280, 1024), QRect(1280/2, 0, 1280, 1024)})), | 695 | Q_ARG(QVector<QRect>, QVector<QRect>({QRect(0,0,1280, 1024), QRect(1280/2, 0, 1280, 1024)})), | ||
709 | Q_ARG(QVector<int>, QVector<int>({2,2}))); | 696 | Q_ARG(QVector<int>, QVector<int>({2,2}))); | ||
710 | 697 | | |||
711 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 698 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||
712 | QVERIFY(clientAddedSpy.isValid()); | 699 | QVERIFY(clientAddedSpy.isValid()); | ||
713 | HelperWindow win; | 700 | HelperWindow win; | ||
714 | win.setGeometry(0, 0, 100, 100); | 701 | win.setGeometry(0, 0, 100, 100); | ||
715 | win.setFlags(win.flags() | Qt::Popup); | 702 | win.setFlags(win.flags() | Qt::Popup); | ||
716 | win.show(); | 703 | win.show(); | ||
717 | QCOMPARE(win.devicePixelRatio(), 2.0); | 704 | QCOMPARE(win.devicePixelRatio(), 2.0); | ||
718 | QVERIFY(clientAddedSpy.wait()); | 705 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
719 | QCOMPARE(clientAddedSpy.count(), 1); | | |||
720 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 706 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | ||
721 | QCOMPARE(internalClient->surface()->scale(), 2); | 707 | QCOMPARE(internalClient->surface()->scale(), 2); | ||
722 | 708 | | |||
723 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | 709 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | ||
724 | } | 710 | } | ||
725 | 711 | | |||
726 | void InternalWindowTest::testWindowType_data() | 712 | void InternalWindowTest::testWindowType_data() | ||
727 | { | 713 | { | ||
Show All 20 Lines | |||||
748 | { | 734 | { | ||
749 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 735 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||
750 | QVERIFY(clientAddedSpy.isValid()); | 736 | QVERIFY(clientAddedSpy.isValid()); | ||
751 | HelperWindow win; | 737 | HelperWindow win; | ||
752 | win.setGeometry(0, 0, 100, 100); | 738 | win.setGeometry(0, 0, 100, 100); | ||
753 | QFETCH(NET::WindowType, windowType); | 739 | QFETCH(NET::WindowType, windowType); | ||
754 | KWindowSystem::setType(win.winId(), windowType); | 740 | KWindowSystem::setType(win.winId(), windowType); | ||
755 | win.show(); | 741 | win.show(); | ||
756 | QVERIFY(clientAddedSpy.wait()); | | |||
757 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 742 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
758 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 743 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | ||
759 | QVERIFY(internalClient); | 744 | QVERIFY(internalClient); | ||
760 | QCOMPARE(internalClient->windowType(), windowType); | 745 | QCOMPARE(internalClient->windowType(), windowType); | ||
761 | } | 746 | } | ||
762 | 747 | | |||
763 | void InternalWindowTest::testChangeWindowType_data() | 748 | void InternalWindowTest::testChangeWindowType_data() | ||
764 | { | 749 | { | ||
Show All 17 Lines | |||||
782 | 767 | | |||
783 | void InternalWindowTest::testChangeWindowType() | 768 | void InternalWindowTest::testChangeWindowType() | ||
784 | { | 769 | { | ||
785 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 770 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||
786 | QVERIFY(clientAddedSpy.isValid()); | 771 | QVERIFY(clientAddedSpy.isValid()); | ||
787 | HelperWindow win; | 772 | HelperWindow win; | ||
788 | win.setGeometry(0, 0, 100, 100); | 773 | win.setGeometry(0, 0, 100, 100); | ||
789 | win.show(); | 774 | win.show(); | ||
790 | QVERIFY(clientAddedSpy.wait()); | | |||
791 | QTRY_COMPARE(clientAddedSpy.count(), 1); | 775 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
792 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 776 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | ||
793 | QVERIFY(internalClient); | 777 | QVERIFY(internalClient); | ||
794 | QCOMPARE(internalClient->windowType(), NET::Normal); | 778 | QCOMPARE(internalClient->windowType(), NET::Normal); | ||
795 | 779 | | |||
796 | QFETCH(NET::WindowType, windowType); | 780 | QFETCH(NET::WindowType, windowType); | ||
797 | KWindowSystem::setType(win.winId(), windowType); | 781 | KWindowSystem::setType(win.winId(), windowType); | ||
798 | QTRY_COMPARE(internalClient->windowType(), windowType); | 782 | QTRY_COMPARE(internalClient->windowType(), windowType); | ||
799 | 783 | | |||
800 | KWindowSystem::setType(win.winId(), NET::Normal); | 784 | KWindowSystem::setType(win.winId(), NET::Normal); | ||
801 | QTRY_COMPARE(internalClient->windowType(), NET::Normal); | 785 | QTRY_COMPARE(internalClient->windowType(), NET::Normal); | ||
802 | } | 786 | } | ||
803 | 787 | | |||
804 | void InternalWindowTest::testEffectWindow() | 788 | void InternalWindowTest::testEffectWindow() | ||
805 | { | 789 | { | ||
806 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 790 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||
807 | QVERIFY(clientAddedSpy.isValid()); | 791 | QVERIFY(clientAddedSpy.isValid()); | ||
808 | HelperWindow win; | 792 | HelperWindow win; | ||
809 | win.setGeometry(0, 0, 100, 100); | 793 | win.setGeometry(0, 0, 100, 100); | ||
810 | win.show(); | 794 | win.show(); | ||
811 | QVERIFY(clientAddedSpy.wait()); | 795 | QTRY_COMPARE(clientAddedSpy.count(), 1); | ||
812 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | 796 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | ||
813 | QVERIFY(internalClient); | 797 | QVERIFY(internalClient); | ||
814 | QVERIFY(internalClient->effectWindow()); | 798 | QVERIFY(internalClient->effectWindow()); | ||
815 | QCOMPARE(internalClient->effectWindow()->internalWindow(), &win); | 799 | QCOMPARE(internalClient->effectWindow()->internalWindow(), &win); | ||
816 | 800 | | |||
817 | QCOMPARE(effects->findWindow(&win), internalClient->effectWindow()); | 801 | QCOMPARE(effects->findWindow(&win), internalClient->effectWindow()); | ||
818 | QCOMPARE(effects->findWindow(&win)->internalWindow(), &win); | 802 | QCOMPARE(effects->findWindow(&win)->internalWindow(), &win); | ||
819 | } | 803 | } | ||
820 | 804 | | |||
821 | } | 805 | } | ||
822 | 806 | | |||
823 | WAYLANDTEST_MAIN(KWin::InternalWindowTest) | 807 | WAYLANDTEST_MAIN(KWin::InternalWindowTest) | ||
824 | #include "internal_window.moc" | 808 | #include "internal_window.moc" |
Change it to QTRY_COMPARE, so we will wait if no events have been dispatched. That's not accurate, but at least something...
Please leave a comment because this part is very weird. :/