Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/pointer_input.cpp
Show First 20 Lines • Show All 842 Lines • ▼ Show 20 Line(s) | 812 | { | |||
---|---|---|---|---|---|
843 | QVERIFY(p->cursorImage().isNull()); | 843 | QVERIFY(p->cursorImage().isNull()); | ||
844 | QVERIFY(enteredSpy.wait()); | 844 | QVERIFY(enteredSpy.wait()); | ||
845 | 845 | | |||
846 | // create a cursor on the pointer | 846 | // create a cursor on the pointer | ||
847 | Surface *cursorSurface = Test::createSurface(m_compositor); | 847 | Surface *cursorSurface = Test::createSurface(m_compositor); | ||
848 | QVERIFY(cursorSurface); | 848 | QVERIFY(cursorSurface); | ||
849 | QSignalSpy cursorRenderedSpy(cursorSurface, &Surface::frameRendered); | 849 | QSignalSpy cursorRenderedSpy(cursorSurface, &Surface::frameRendered); | ||
850 | QVERIFY(cursorRenderedSpy.isValid()); | 850 | QVERIFY(cursorRenderedSpy.isValid()); | ||
851 | QImage red = QImage(QSize(10, 10), QImage::Format_ARGB32); | 851 | QImage red = QImage(QSize(10, 10), QImage::Format_ARGB32_Premultiplied); | ||
852 | red.fill(Qt::red); | 852 | red.fill(Qt::red); | ||
853 | cursorSurface->attachBuffer(Test::waylandShmPool()->createBuffer(red)); | 853 | cursorSurface->attachBuffer(Test::waylandShmPool()->createBuffer(red)); | ||
854 | cursorSurface->damage(QRect(0, 0, 10, 10)); | 854 | cursorSurface->damage(QRect(0, 0, 10, 10)); | ||
855 | cursorSurface->commit(); | 855 | cursorSurface->commit(); | ||
856 | pointer->setCursor(cursorSurface, QPoint(5, 5)); | 856 | pointer->setCursor(cursorSurface, QPoint(5, 5)); | ||
857 | QVERIFY(cursorRenderedSpy.wait()); | 857 | QVERIFY(cursorRenderedSpy.wait()); | ||
858 | QCOMPARE(p->cursorImage(), red); | 858 | QCOMPARE(p->cursorImage(), red); | ||
859 | QCOMPARE(p->cursorHotSpot(), QPoint(5, 5)); | 859 | QCOMPARE(p->cursorHotSpot(), QPoint(5, 5)); | ||
860 | // change hotspot | 860 | // change hotspot | ||
861 | pointer->setCursor(cursorSurface, QPoint(6, 6)); | 861 | pointer->setCursor(cursorSurface, QPoint(6, 6)); | ||
862 | Test::flushWaylandConnection(); | 862 | Test::flushWaylandConnection(); | ||
863 | QTRY_COMPARE(p->cursorHotSpot(), QPoint(6, 6)); | 863 | QTRY_COMPARE(p->cursorHotSpot(), QPoint(6, 6)); | ||
864 | QCOMPARE(p->cursorImage(), red); | 864 | QCOMPARE(p->cursorImage(), red); | ||
865 | 865 | | |||
866 | // change the buffer | 866 | // change the buffer | ||
867 | QImage blue = QImage(QSize(10, 10), QImage::Format_ARGB32); | 867 | QImage blue = QImage(QSize(10, 10), QImage::Format_ARGB32_Premultiplied); | ||
868 | blue.fill(Qt::blue); | 868 | blue.fill(Qt::blue); | ||
869 | auto b = Test::waylandShmPool()->createBuffer(blue); | 869 | auto b = Test::waylandShmPool()->createBuffer(blue); | ||
870 | cursorSurface->attachBuffer(b); | 870 | cursorSurface->attachBuffer(b); | ||
871 | cursorSurface->damage(QRect(0, 0, 10, 10)); | 871 | cursorSurface->damage(QRect(0, 0, 10, 10)); | ||
872 | cursorSurface->commit(); | 872 | cursorSurface->commit(); | ||
873 | QVERIFY(cursorRenderedSpy.wait()); | 873 | QVERIFY(cursorRenderedSpy.wait()); | ||
874 | QTRY_COMPARE(p->cursorImage(), blue); | 874 | QTRY_COMPARE(p->cursorImage(), blue); | ||
875 | QCOMPARE(p->cursorHotSpot(), QPoint(6, 6)); | 875 | QCOMPARE(p->cursorHotSpot(), QPoint(6, 6)); | ||
▲ Show 20 Lines • Show All 314 Lines • Show Last 20 Lines |