mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
kdeui: adjust expected data in KShortcut test
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
af814079c0
commit
25f723c03c
1 changed files with 5 additions and 24 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Reference in a new issue