summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests/cmptest
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-12-13 17:26:36 +1000
committerQt by Nokia <qt-info@nokia.com>2011-12-14 02:40:17 +0100
commit9bc546e4920af554011adab10e15624f9a012bf8 (patch)
tree1f6265350fc9680ab35169be10a82b09a41a53cb /tests/auto/testlib/selftests/cmptest
parenta9ad8886fe25276ea6e81e191392d4c90d207759 (diff)
Add testlib selftest for QStringList comparison.
The (disabled) alive selftest contained a test for the QStringList specialization of the QTest::qCompare template. This test is unrelated to the rest of the alive selftest, so move it to the cmptest selftest, where QCOMPARE is tested. Change-Id: Ic6f0e491dd3b3ce8b4ca1d49666a099815575eaa Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/testlib/selftests/cmptest')
-rw-r--r--tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp78
1 files changed, 77 insertions, 1 deletions
diff --git a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
index 70396a75b3..924b734e51 100644
--- a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
+++ b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
@@ -52,6 +52,8 @@ private slots:
void compare_pointerfuncs();
void compare_tostring();
void compare_tostring_data();
+ void compareQStringLists();
+ void compareQStringLists_data();
};
static bool boolfunc() { return true; }
@@ -126,6 +128,80 @@ void tst_Cmptest::compare_tostring()
QCOMPARE(actual, expected);
}
-QTEST_MAIN(tst_Cmptest)
+void tst_Cmptest::compareQStringLists_data()
+{
+ QTest::addColumn<QStringList>("opA");
+ QTest::addColumn<QStringList>("opB");
+
+ {
+ QStringList opA;
+ opA.append(QLatin1String("string1"));
+ opA.append(QLatin1String("string2"));
+
+ QStringList opB(opA);
+ opA.append(QLatin1String("string3"));
+ opB.append(QLatin1String("DIFFERS"));
+
+ QTest::newRow("") << opA << opB;
+ }
+
+ {
+ QStringList opA;
+ opA.append(QLatin1String("string1"));
+ opA.append(QLatin1String("string2"));
+
+ QStringList opB(opA);
+ opA.append(QLatin1String("string3"));
+ opA.append(QLatin1String("string4"));
+
+ opB.append(QLatin1String("DIFFERS"));
+ opB.append(QLatin1String("string4"));
+
+ QTest::newRow("") << opA << opB;
+ }
+
+ {
+ QStringList opA;
+ opA.append(QLatin1String("string1"));
+ opA.append(QLatin1String("string2"));
+
+ QStringList opB;
+ opB.append(QLatin1String("string1"));
+
+ QTest::newRow("") << opA << opB;
+ }
+
+ {
+ QStringList opA;
+ opA.append(QLatin1String("openInNewWindow"));
+ opA.append(QLatin1String("openInNewTab"));
+ opA.append(QLatin1String("separator"));
+ opA.append(QLatin1String("bookmark_add"));
+ opA.append(QLatin1String("savelinkas"));
+ opA.append(QLatin1String("copylinklocation"));
+ opA.append(QLatin1String("separator"));
+ opA.append(QLatin1String("openWith_submenu"));
+ opA.append(QLatin1String("preview1"));
+ opA.append(QLatin1String("actions_submenu"));
+ opA.append(QLatin1String("separator"));
+ opA.append(QLatin1String("viewDocumentSource"));
+
+ QStringList opB;
+ opB.append(QLatin1String("viewDocumentSource"));
+
+ QTest::newRow("") << opA << opB;
+
+ QTest::newRow("") << opB << opA;
+ }
+}
+
+void tst_Cmptest::compareQStringLists()
+{
+ QFETCH(QStringList, opA);
+ QFETCH(QStringList, opB);
+
+ QCOMPARE(opA, opB);
+}
+QTEST_MAIN(tst_Cmptest)
#include "tst_cmptest.moc"