diff options
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp index 9845b388b4..f8eae2067e 100644 --- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp @@ -122,6 +122,8 @@ private slots: void mnemonic(); void toString_data(); void toString(); + void toStringFromKeycode_data(); + void toStringFromKeycode(); void streamOperators_data(); void streamOperators(); void parseString_data(); @@ -476,6 +478,24 @@ void tst_QKeySequence::toString() } +void tst_QKeySequence::toStringFromKeycode_data() +{ + QTest::addColumn<QKeySequence>("keycode"); + QTest::addColumn<QString>("expectedString"); + + QTest::newRow("A") << QKeySequence(Qt::Key_A) << "A"; + QTest::newRow("-1") << QKeySequence(-1) << ""; + QTest::newRow("Unknown") << QKeySequence(Qt::Key_unknown) << ""; +} + +void tst_QKeySequence::toStringFromKeycode() +{ + QFETCH(QKeySequence, keycode); + QFETCH(QString, expectedString); + + QCOMPARE(QKeySequence(keycode).toString(), expectedString); +} + void tst_QKeySequence::streamOperators_data() { operatorQString_data(); |