From c841dc551cc3e847c92fed3dc6709f39f10c9f95 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Fri, 7 Jul 2017 14:05:06 +0300 Subject: Introduce and use Utils::stripAccelerator Change-Id: I8c37728ca5de20e2b68e6d0ac7fc120baa696040 Reviewed-by: Eike Ziller --- tests/auto/utils/stringutils/tst_stringutils.cpp | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests/auto/utils/stringutils/tst_stringutils.cpp') 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("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" -- cgit v1.2.1