From 25f723c03cdcac196d739645eb235c7014dfc01e Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Mon, 9 Aug 2021 19:47:38 +0300 Subject: [PATCH] kdeui: adjust expected data in KShortcut test Signed-off-by: Ivailo Monev --- kdeui/tests/kshortcuttest.cpp | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/kdeui/tests/kshortcuttest.cpp b/kdeui/tests/kshortcuttest.cpp index 9532dd76..0662462c 100644 --- a/kdeui/tests/kshortcuttest.cpp +++ b/kdeui/tests/kshortcuttest.cpp @@ -50,46 +50,27 @@ private Q_SLOTS: { // Check that the valid keycode Qt::Key_unknown is handled gracefully // - // Qt::Key_unknown is a valid Qt Key. But toString makes unicode gibberish - // from it. '???'. - // Reported with patch - mjansen QKeySequence unknown_key(Qt::Key_unknown); - // The keycode falls into the unicode handling - QString p = QString(QChar::highSurrogate(Qt::Key_unknown)) + QString(QChar::lowSurrogate(Qt::Key_unknown)); - - QCOMPARE(unknown_key.toString(), p); // What happens - QEXPECT_FAIL("", "Qt::Key_unknown not handled", Continue); QCOMPARE(unknown_key.toString(), QString()); // What i would expect // Check that the keycode -1 is handled gracefully. // // -1 happens for some keys when listening to keyPressEvent in QWidget::event() - // It means the key is not supported by Qt. It probably should be - // Qt::Key_unknown instead. Unsupported keys: (Alt+Print for example). - // Reported with patch - mjansen + // It means the key is not supported by Katie. It probably should be + // Qt::Key_unknown instead. QKeySequence invalid_key(-1); - // The keycode falls into the unicode handling too - int k = int(-1) & ~(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier); - QString p1 = QString(QChar::highSurrogate(k)) + QString(QChar::lowSurrogate(k)); - - QCOMPARE(invalid_key.toString(), QString("Meta+Ctrl+Alt+Shift+"+p1)); // What happens - QEXPECT_FAIL("", "-1 not handled", Continue); QCOMPARE(invalid_key.toString(), QString()); // What i would expect // The famous "KDE4 eats my E key" bug: Win+E isn't parsed anymore. QKeySequence seq("Win+E"); - QEXPECT_FAIL("", "Qt Bug 205255/134941 - QKeySequence silently discards unknown key modifiers", Continue); QVERIFY(seq.isEmpty()); - // And what really happens - QCOMPARE(seq.toString(), QLatin1String("E")); + QCOMPARE(seq.toString(), QString()); // KDE3 -> KDE4 migration. KDE3 used xKeycodeToKeysym or something and // stored the result QKeySequence seq2("Meta+Alt+Period"); - QEXPECT_FAIL("", "Qt Bug 205255/134941 - QKeySequence silently discards unknown key modifiers", Continue); QVERIFY(seq2.isEmpty()); - // And what really happens - QCOMPARE(seq2.toString(), QLatin1String("Meta+Alt+")); + QCOMPARE(seq2.toString(), QString()); } void parsing() @@ -101,8 +82,8 @@ private Q_SLOTS: cut = KShortcut("Win+E"); //QTest::ignoreMessage(QtWarningMsg, "QKeySequence::fromString: Unknown modifier 'win+'"); - QEXPECT_FAIL("", "Qt Bug 205255 - QKeySequence silently discards unknown key modifiers", Continue); QVERIFY(cut.isEmpty()); + QCOMPARE(cut.toString(), QString()); cut = KShortcut("Meta+E"); QVERIFY(cut.primary()[0] == (Qt::META | Qt::Key_E));