tests: fix tst_seatv4 to use 24 as default cursor size

Also set default cursor size to 24 for client, which is correct
both on KDE and GNOME at least.

Fixes: QTBUG-104259
Pick-to: 6.4 6.2 5.15
Change-Id: Ie4ba27695974025b093a86d8c96fb23d25ad23f7
Reviewed-by: Inho Lee <inho.lee@qt.io>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Liang Qi 2022-11-02 13:15:27 +01:00
parent e0c53e4f6d
commit f733811432
2 changed files with 10 additions and 3 deletions

View File

@ -237,7 +237,7 @@ QString QWaylandInputDevice::Pointer::cursorThemeName() const
int QWaylandInputDevice::Pointer::cursorSize() const
{
constexpr int defaultCursorSize = 32;
constexpr int defaultCursorSize = 24;
static const int xCursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE");
return xCursorSize > 0 ? xCursorSize : defaultCursorSize;
}

View File

@ -38,6 +38,7 @@ class tst_seatv4 : public QObject, private SeatV4Compositor
{
Q_OBJECT
private slots:
void init();
void cleanup();
void bindsToSeat();
void keyboardKeyPress();
@ -60,6 +61,12 @@ private slots:
#endif
};
void tst_seatv4::init()
{
// Remove the extra outputs to clean up for the next test
exec([&] { while (auto *o = output(1)) remove(o); });
}
void tst_seatv4::cleanup()
{
QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage()));
@ -110,7 +117,7 @@ void tst_seatv4::setsCursorOnEnter()
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); });
exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {24, 24}); });
QCOMPOSITOR_TRY_VERIFY(cursorSurface());
}
@ -335,7 +342,7 @@ static bool supportsCursorSizes(const QList<uint> &sizes)
static uint defaultCursorSize() {
const int xCursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE");
return xCursorSize > 0 ? uint(xCursorSize) : 32;
return xCursorSize > 0 ? uint(xCursorSize) : 24;
}
void tst_seatv4::scaledCursor()