diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2017-07-07 14:05:06 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2017-07-07 12:17:40 +0000 |
commit | c841dc551cc3e847c92fed3dc6709f39f10c9f95 (patch) | |
tree | a2138886cb55097994bfdf2770add7d10077cddf /tests/auto/utils/stringutils/tst_stringutils.cpp | |
parent | 510a00ea35acd540e568071f15aa91d58a91f232 (diff) | |
download | qt-creator-c841dc551cc3e847c92fed3dc6709f39f10c9f95.tar.gz |
Introduce and use Utils::stripAccelerator
Change-Id: I8c37728ca5de20e2b68e6d0ac7fc120baa696040
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
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" |