Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/internal_window.cpp
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 48 | private Q_SLOTS: | |||
---|---|---|---|---|---|
52 | void testEnterLeave(); | 52 | void testEnterLeave(); | ||
53 | void testPointerPressRelease(); | 53 | void testPointerPressRelease(); | ||
54 | void testPointerAxis(); | 54 | void testPointerAxis(); | ||
55 | void testKeyboard_data(); | 55 | void testKeyboard_data(); | ||
56 | void testKeyboard(); | 56 | void testKeyboard(); | ||
57 | void testKeyboardShowWithoutActivating(); | 57 | void testKeyboardShowWithoutActivating(); | ||
58 | void testKeyboardTriggersLeave(); | 58 | void testKeyboardTriggersLeave(); | ||
59 | void testTouch(); | 59 | void testTouch(); | ||
60 | void testOpacity(); | ||||
60 | }; | 61 | }; | ||
61 | 62 | | |||
62 | class HelperWindow : public QRasterWindow | 63 | class HelperWindow : public QRasterWindow | ||
63 | { | 64 | { | ||
64 | Q_OBJECT | 65 | Q_OBJECT | ||
65 | public: | 66 | public: | ||
66 | HelperWindow(); | 67 | HelperWindow(); | ||
67 | ~HelperWindow(); | 68 | ~HelperWindow(); | ||
▲ Show 20 Lines • Show All 421 Lines • ▼ Show 20 Line(s) | 433 | { | |||
489 | // and up the additional point | 490 | // and up the additional point | ||
490 | kwinApp()->platform()->touchUp(1, timestamp++); | 491 | kwinApp()->platform()->touchUp(1, timestamp++); | ||
491 | QCOMPARE(releaseSpy.count(), 1); | 492 | QCOMPARE(releaseSpy.count(), 1); | ||
492 | QCOMPARE(moveSpy.count(), 1); | 493 | QCOMPARE(moveSpy.count(), 1); | ||
493 | QCOMPARE(win.latestGlobalMousePos(), QPoint(80, 90)); | 494 | QCOMPARE(win.latestGlobalMousePos(), QPoint(80, 90)); | ||
494 | QCOMPARE(win.pressedButtons(), Qt::MouseButtons()); | 495 | QCOMPARE(win.pressedButtons(), Qt::MouseButtons()); | ||
495 | } | 496 | } | ||
496 | 497 | | |||
498 | void InternalWindowTest::testOpacity() | ||||
499 | { | ||||
500 | // this test verifies that opacity is properly synced from QWindow to ShellClient | ||||
501 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||||
502 | QVERIFY(clientAddedSpy.isValid()); | ||||
503 | HelperWindow win; | ||||
504 | win.setOpacity(0.5); | ||||
505 | win.setGeometry(0, 0, 100, 100); | ||||
506 | win.show(); | ||||
507 | QVERIFY(clientAddedSpy.wait()); | ||||
508 | QCOMPARE(clientAddedSpy.count(), 1); | ||||
509 | auto internalClient = clientAddedSpy.first().first().value<ShellClient*>(); | ||||
510 | QVERIFY(internalClient); | ||||
511 | QVERIFY(internalClient->isInternal()); | ||||
512 | QCOMPARE(internalClient->opacity(), 0.5); | ||||
513 | | ||||
514 | QSignalSpy opacityChangedSpy(internalClient, &ShellClient::opacityChanged); | ||||
515 | QVERIFY(opacityChangedSpy.isValid()); | ||||
516 | win.setOpacity(0.75); | ||||
517 | QCOMPARE(opacityChangedSpy.count(), 1); | ||||
518 | QCOMPARE(internalClient->opacity(), 0.75); | ||||
519 | } | ||||
520 | | ||||
497 | } | 521 | } | ||
498 | 522 | | |||
499 | WAYLANDTEST_MAIN(KWin::InternalWindowTest) | 523 | WAYLANDTEST_MAIN(KWin::InternalWindowTest) | ||
500 | #include "internal_window.moc" | 524 | #include "internal_window.moc" |