diff options
Diffstat (limited to 'tests/auto/utils/stringutils/tst_stringutils.cpp')
-rw-r--r-- | tests/auto/utils/stringutils/tst_stringutils.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/utils/stringutils/tst_stringutils.cpp b/tests/auto/utils/stringutils/tst_stringutils.cpp index d9d47e1845..96a950bb43 100644 --- a/tests/auto/utils/stringutils/tst_stringutils.cpp +++ b/tests/auto/utils/stringutils/tst_stringutils.cpp @@ -80,6 +80,8 @@ private slots: void testWithTildeHomePath(); void testMacroExpander_data(); void testMacroExpander(); + void testStripAccelerator(); + void testStripAccelerator_data(); private: TestMacroExpander mx; @@ -176,6 +178,30 @@ void tst_StringUtils::testMacroExpander() QCOMPARE(in, out); } +void tst_StringUtils::testStripAccelerator() +{ + QFETCH(QString, expected); + + QCOMPARE(Utils::stripAccelerator(QTest::currentDataTag()), expected); +} + +void tst_StringUtils::testStripAccelerator_data() +{ + QTest::addColumn<QString>("expected"); + + QTest::newRow("Test") << "Test"; + QTest::newRow("&Test") << "Test"; + QTest::newRow("&&Test") << "&Test"; + QTest::newRow("T&est") << "Test"; + QTest::newRow("&Te&&st") << "Te&st"; + QTest::newRow("T&e&st") << "Test"; + QTest::newRow("T&&est") << "T&est"; + QTest::newRow("T&&e&st") << "T&est"; + QTest::newRow("T&&&est") << "T&est"; + QTest::newRow("Tes&t") << "Test"; + QTest::newRow("Test&") << "Test"; +} + QTEST_MAIN(tst_StringUtils) #include "tst_stringutils.moc" |