QTestLib: handle all Qt::Key values in keyToAscii

Since the function is implemented to return 0 for many non-alpha-numeric
keys already, make that the default implementation and remove the
Q_ASSERT(false). Instead, emit a warning.

Amends 1a820560000c7669812de9e2283a539118b24e51, after which the
QQuickShortCut test in Qt Quick trips the assert.

Change-Id: I6c6ac0a80043c1bbb7683bc47c1092a12b9cf230
Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
Reviewed-by: Jules Bertholet <julesbertholet@quoi.xyz>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Volker Hilsheimer 2025-01-13 10:36:56 +01:00
parent 95abc38ba6
commit 20a401cd9f

View File

@ -467,7 +467,9 @@ char QTest::keyToAscii(Qt::Key key)
case Qt::Key_Yes : return 0; // = 0x01010001
case Qt::Key_No : return 0; // = 0x01010002
default: QTEST_ASSERT(false); return 0;
default:
qWarning() << __FUNCTION__ << "Unhandled key code" << key;
return 0;
}
}