diff options
author | David Faure <david.faure@kdab.com> | 2013-01-19 11:52:03 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-22 13:29:33 +0100 |
commit | e01b1634048ebf5858b77f2a6541a960babe232c (patch) | |
tree | 92b974e06ba2b4c510c8f814d4a3e888a56aa216 /tests/auto/testlib/selftests/cmptest | |
parent | c73dc44606bee960b734c2bc5db22c5400dadb3c (diff) |
QTestLib: improve output when comparing lists fails.
Only QStringList was handled before, now any QList is handled.
A specialization for QStringList is still needed though, due to the way
template matching works.
Example with QList<int>. Before:
FAIL! : tst_QTextCodec::threadSafety() Compared values are not the same
Loc: [../tst_qtextcodec.cpp(2057)]
After:
FAIL! : tst_QTextCodec::threadSafety() Compared lists differ at index 0.
Actual (res2.toList()): '0'
Expected (mibList): '3'
Loc: [../tst_qtextcodec.cpp(2057)]
Change-Id: If0fdec3236ddb78a679ee549aba569ef5571c395
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'tests/auto/testlib/selftests/cmptest')
-rw-r--r-- | tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp index 572388df6c..7213d9a82d 100644 --- a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp +++ b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp @@ -136,6 +136,8 @@ private slots: void compare_tostring_data(); void compareQStringLists(); void compareQStringLists_data(); + void compareQListInt(); + void compareQListDouble(); void compareQPixmaps(); void compareQPixmaps_data(); void compareQImages(); @@ -307,6 +309,20 @@ void tst_Cmptest::compareQStringLists() QCOMPARE(opA, opB); } +void tst_Cmptest::compareQListInt() +{ + QList<int> int1; int1 << 1 << 2 << 3; + QList<int> int2; int2 << 1 << 2 << 4; + QCOMPARE(int1, int2); +} + +void tst_Cmptest::compareQListDouble() +{ + QList<double> double1; double1 << 1.5 << 2 << 3; + QList<double> double2; double2 << 1 << 2 << 4; + QCOMPARE(double1, double2); +} + void tst_Cmptest::compareQPixmaps_data() { QTest::addColumn<QPixmap>("opA"); |