From 20a401cd9ff3d083d60fd7cea4416b8a54ee5753 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 13 Jan 2025 10:36:56 +0100 Subject: [PATCH] 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 Reviewed-by: Jules Bertholet Reviewed-by: Shawn Rutledge --- src/testlib/qasciikey.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/testlib/qasciikey.cpp b/src/testlib/qasciikey.cpp index 114b757dc4b..b9e68602958 100644 --- a/src/testlib/qasciikey.cpp +++ b/src/testlib/qasciikey.cpp @@ -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; } }