diff options
author | João Abecasis <joao.abecasis@nokia.com> | 2012-01-16 17:52:29 +0100 |
---|---|---|
committer | João Abecasis <joao.abecasis@nokia.com> | 2012-01-16 17:53:41 +0100 |
commit | 5b250d497fd798c476765b22a2906e1c0ff1e432 (patch) | |
tree | fd4215ca375cc2402e536bf670c2977cf64ae2ef /tests/auto/testlib | |
parent | 2c52e9a5c1d6ef6cbf4577430e14027375465c96 (diff) | |
parent | 7a0099183a1c107126bda3b59a47651aac612426 (diff) |
Merge remote-tracking branch 'gerrit/master' into containers
Change-Id: I2d358b912f1055ee6021d13de2f66fd459aaa355
Diffstat (limited to 'tests/auto/testlib')
83 files changed, 1003 insertions, 250 deletions
diff --git a/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp b/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp index f8e8553e7c..0499c2e38b 100644 --- a/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp +++ b/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/testlib/selftests/.gitignore b/tests/auto/testlib/selftests/.gitignore index 98a3f49081..56ba17abd7 100644 --- a/tests/auto/testlib/selftests/.gitignore +++ b/tests/auto/testlib/selftests/.gitignore @@ -13,6 +13,7 @@ fetchbogus/tst_fetchbogus globaldata/tst_globaldata maxwarnings/tst_maxwarnings multiexec/tst_multiexec +qexecstringlist/tst_qexecstringlist singleskip/tst_singleskip skip/tst_skip skipglobal/tst_skipglobal diff --git a/tests/auto/testlib/selftests/alive/qtestalive.cpp b/tests/auto/testlib/selftests/alive/qtestalive.cpp index dd3d411ce5..5220142456 100644 --- a/tests/auto/testlib/selftests/alive/qtestalive.cpp +++ b/tests/auto/testlib/selftests/alive/qtestalive.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/testlib/selftests/alive/tst_alive.cpp b/tests/auto/testlib/selftests/alive/tst_alive.cpp index f29aebb176..112ef493b7 100644 --- a/tests/auto/testlib/selftests/alive/tst_alive.cpp +++ b/tests/auto/testlib/selftests/alive/tst_alive.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -52,8 +52,6 @@ class tst_Alive: public QObject private slots: void alive(); void addMouseDClick() const; - void compareQStringLists() const; - void compareQStringLists_data() const; }; void tst_Alive::alive() @@ -95,80 +93,5 @@ void tst_Alive::addMouseDClick() const QVERIFY(listener.isTested); } -void tst_Alive::compareQStringLists() const -{ - QFETCH(QStringList, opA); - QFETCH(QStringList, opB); - - QCOMPARE(opA, opB); -} - -void tst_Alive::compareQStringLists_data() const -{ - 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; - } -} - QTEST_MAIN(tst_Alive) #include "tst_alive.moc" diff --git a/tests/auto/testlib/selftests/assert/tst_assert.cpp b/tests/auto/testlib/selftests/assert/tst_assert.cpp index bd44162971..c2ec453317 100644 --- a/tests/auto/testlib/selftests/assert/tst_assert.cpp +++ b/tests/auto/testlib/selftests/assert/tst_assert.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -44,7 +44,7 @@ # undef QT_NO_DEBUG #endif -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> class tst_Assert: public QObject diff --git a/tests/auto/testlib/selftests/badxml/badxml.pro b/tests/auto/testlib/selftests/badxml/badxml.pro index 561c7e01db..5eaa1c3216 100644 --- a/tests/auto/testlib/selftests/badxml/badxml.pro +++ b/tests/auto/testlib/selftests/badxml/badxml.pro @@ -5,4 +5,3 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = badxml - diff --git a/tests/auto/testlib/selftests/badxml/tst_badxml.cpp b/tests/auto/testlib/selftests/badxml/tst_badxml.cpp index 2d0b007df9..0d10504020 100644 --- a/tests/auto/testlib/selftests/badxml/tst_badxml.cpp +++ b/tests/auto/testlib/selftests/badxml/tst_badxml.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> /* diff --git a/tests/auto/testlib/selftests/benchlibcallgrind/benchlibcallgrind.pro b/tests/auto/testlib/selftests/benchlibcallgrind/benchlibcallgrind.pro index baa996c8d3..6cbefe518c 100644 --- a/tests/auto/testlib/selftests/benchlibcallgrind/benchlibcallgrind.pro +++ b/tests/auto/testlib/selftests/benchlibcallgrind/benchlibcallgrind.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = benchlibcallgrind diff --git a/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp b/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp index 1199462c99..7a7a190e7d 100644 --- a/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp +++ b/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> /* This test must be explicitly enabled since there are no compile tests for valgrind.h */ diff --git a/tests/auto/testlib/selftests/benchlibeventcounter/benchlibeventcounter.pro b/tests/auto/testlib/selftests/benchlibeventcounter/benchlibeventcounter.pro index d1fe909fa1..5e2b963491 100644 --- a/tests/auto/testlib/selftests/benchlibeventcounter/benchlibeventcounter.pro +++ b/tests/auto/testlib/selftests/benchlibeventcounter/benchlibeventcounter.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = benchlibeventcounter diff --git a/tests/auto/testlib/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp b/tests/auto/testlib/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp index ccb69ddb6a..8a9a7e3f3a 100644 --- a/tests/auto/testlib/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp +++ b/tests/auto/testlib/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> /* Custom event dispatcher to ensure we don't receive any spontaneous events */ @@ -57,8 +57,7 @@ public: void interrupt() {} bool processEvents(QEventLoop::ProcessEventsFlags) { return false; } void registerSocketNotifier(QSocketNotifier*) {} - int registerTimer(int,QObject*) { return -1; } - void registerTimer(int,int,QObject*) {} + void registerTimer(int,int,Qt::TimerType,QObject*) {} QList<TimerInfo> registeredTimers(QObject*) const { return QList<TimerInfo>(); } void unregisterSocketNotifier(QSocketNotifier*) {} bool unregisterTimer(int) { return false; } diff --git a/tests/auto/testlib/selftests/benchliboptions/benchliboptions.pro b/tests/auto/testlib/selftests/benchliboptions/benchliboptions.pro index 73173b0a08..f4bcc92129 100644 --- a/tests/auto/testlib/selftests/benchliboptions/benchliboptions.pro +++ b/tests/auto/testlib/selftests/benchliboptions/benchliboptions.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = benchliboptions diff --git a/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp b/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp index cbe5af5ce8..2431a1df78 100644 --- a/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp +++ b/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> /* Custom event dispatcher to ensure we don't receive any spontaneous events */ @@ -57,8 +57,7 @@ public: void interrupt() {} bool processEvents(QEventLoop::ProcessEventsFlags) { return false; } void registerSocketNotifier(QSocketNotifier*) {} - int registerTimer(int,QObject*) { return -1; } - void registerTimer(int,int,QObject*) {} + void registerTimer(int,int,Qt::TimerType,QObject*) {} QList<TimerInfo> registeredTimers(QObject*) const { return QList<TimerInfo>(); } void unregisterSocketNotifier(QSocketNotifier*) {} bool unregisterTimer(int) { return false; } diff --git a/tests/auto/testlib/selftests/benchlibtickcounter/tst_benchlibtickcounter.cpp b/tests/auto/testlib/selftests/benchlibtickcounter/tst_benchlibtickcounter.cpp index 9e274edea5..38a7029262 100644 --- a/tests/auto/testlib/selftests/benchlibtickcounter/tst_benchlibtickcounter.cpp +++ b/tests/auto/testlib/selftests/benchlibtickcounter/tst_benchlibtickcounter.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> #include <private/cycle_p.h> diff --git a/tests/auto/testlib/selftests/benchlibwalltime/tst_benchlibwalltime.cpp b/tests/auto/testlib/selftests/benchlibwalltime/tst_benchlibwalltime.cpp index 9042c27936..c079983e6c 100644 --- a/tests/auto/testlib/selftests/benchlibwalltime/tst_benchlibwalltime.cpp +++ b/tests/auto/testlib/selftests/benchlibwalltime/tst_benchlibwalltime.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> class tst_BenchlibWalltime: public QObject diff --git a/tests/auto/testlib/selftests/cmptest/cmptest.pro b/tests/auto/testlib/selftests/cmptest/cmptest.pro index ac392b0234..a793c203dd 100644 --- a/tests/auto/testlib/selftests/cmptest/cmptest.pro +++ b/tests/auto/testlib/selftests/cmptest/cmptest.pro @@ -1,8 +1,7 @@ SOURCES += tst_cmptest.cpp -QT = core testlib +QT = core gui testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = cmptest diff --git a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp index 70396a75b3..72d3ac9665 100644 --- a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp +++ b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,8 +40,90 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> +#include <QtGui/QImage> +#include <QtGui/QPixmap> + +/* XPM test data for QPixmap, QImage tests (use drag cursors as example) */ + +static const char * const xpmPixmapData1[] = { +"11 20 3 1", +". c None", +"a c #FFFFFF", +"X c #000000", // X11 cursor is traditionally black +"aa.........", +"aXa........", +"aXXa.......", +"aXXXa......", +"aXXXXa.....", +"aXXXXXa....", +"aXXXXXXa...", +"aXXXXXXXa..", +"aXXXXXXXXa.", +"aXXXXXXXXXa", +"aXXXXXXaaaa", +"aXXXaXXa...", +"aXXaaXXa...", +"aXa..aXXa..", +"aa...aXXa..", +"a.....aXXa.", +"......aXXa.", +".......aXXa", +".......aXXa", +"........aa."}; + +static const char * const xpmPixmapData2[] = { +"11 20 4 1", +". c None", +"a c #FFFFFF", +"b c #0000FF", +"X c #000000", +"aab........", +"aXab.......", +"aXXab......", +"aXXXab.....", +"aXXXXab....", +"aXXXXXab...", +"aXXXXXXab..", +"aXXXXXXXa..", +"aXXXXXXXXa.", +"aXXXXXXXXXa", +"aXXXXXXaaaa", +"aXXXaXXa...", +"aXXaaXXa...", +"aXa..aXXa..", +"aa...aXXa..", +"a.....aXXa.", +"......aXXa.", +".......aXXa", +".......aXXa", +"........aa."}; + +static const char * const xpmPixmapData3[] = { +"20 20 2 1", +" c #000000", +". c #C32D2D", +" ..........", +" ........", +" .......", +" ......", +" ....", +" ..", +" .", +" ", +" ", +". ", +"... ", +"..... ", +"...... ", +"....... ", +"......... ", +"........... ", +"........... ", +"............ ", +"............ ", +"............. "}; class tst_Cmptest: public QObject { @@ -52,6 +134,12 @@ private slots: void compare_pointerfuncs(); void compare_tostring(); void compare_tostring_data(); + void compareQStringLists(); + void compareQStringLists_data(); + void compareQPixmaps(); + void compareQPixmaps_data(); + void compareQImages(); + void compareQImages_data(); }; static bool boolfunc() { return true; } @@ -126,6 +214,151 @@ 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; + QStringList opB(opA); + + QTest::newRow("empty lists") << opA << opB; + } + + { + QStringList opA; + opA.append(QLatin1String("string1")); + opA.append(QLatin1String("string2")); + opA.append(QLatin1String("string3")); + opA.append(QLatin1String("string4")); + + QStringList opB(opA); + + QTest::newRow("equal lists") << opA << opB; + } + + { + QStringList opA; + opA.append(QLatin1String("string1")); + opA.append(QLatin1String("string2")); + + QStringList opB(opA); + opA.append(QLatin1String("string3")); + opB.append(QLatin1String("DIFFERS")); + QTest::newRow("last item different") << 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("second-last item different") << opA << opB; + } + + { + QStringList opA; + opA.append(QLatin1String("string1")); + opA.append(QLatin1String("string2")); + + QStringList opB; + opB.append(QLatin1String("string1")); + + QTest::newRow("prefix") << 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("short list second") << opA << opB; + + QTest::newRow("short list first") << opB << opA; + } +} + +void tst_Cmptest::compareQStringLists() +{ + QFETCH(QStringList, opA); + QFETCH(QStringList, opB); + + QCOMPARE(opA, opB); +} + +void tst_Cmptest::compareQPixmaps_data() +{ + QTest::addColumn<QPixmap>("opA"); + QTest::addColumn<QPixmap>("opB"); + + const QPixmap pixmap1(xpmPixmapData1); + const QPixmap pixmap2(xpmPixmapData2); + const QPixmap pixmap3(xpmPixmapData3); + + QTest::newRow("both null") << QPixmap() << QPixmap(); + QTest::newRow("one null") << QPixmap() << pixmap1; + QTest::newRow("other null") << pixmap1 << QPixmap(); + QTest::newRow("equal") << pixmap1 << pixmap1; + QTest::newRow("different size") << pixmap1 << pixmap3; + QTest::newRow("different pixels") << pixmap1 << pixmap2; +} + +void tst_Cmptest::compareQPixmaps() +{ + QFETCH(QPixmap, opA); + QFETCH(QPixmap, opB); + + QCOMPARE(opA, opB); +} + +void tst_Cmptest::compareQImages_data() +{ + QTest::addColumn<QImage>("opA"); + QTest::addColumn<QImage>("opB"); + + const QImage image1(QPixmap(xpmPixmapData1).toImage()); + const QImage image2(QPixmap(xpmPixmapData2).toImage()); + const QImage image1Indexed = image1.convertToFormat(QImage::Format_Indexed8); + const QImage image3(QPixmap(xpmPixmapData3).toImage()); + + QTest::newRow("both null") << QImage() << QImage(); + QTest::newRow("one null") << QImage() << image1; + QTest::newRow("other null") << image1 << QImage(); + QTest::newRow("equal") << image1 << image1; + QTest::newRow("different size") << image1 << image3; + QTest::newRow("different format") << image1 << image1Indexed; + QTest::newRow("different pixels") << image1 << image2; +} + +void tst_Cmptest::compareQImages() +{ + QFETCH(QImage, opA); + QFETCH(QImage, opB); + + QCOMPARE(opA, opB); +} + +QTEST_MAIN(tst_Cmptest) #include "tst_cmptest.moc" diff --git a/tests/auto/testlib/selftests/commandlinedata/commandlinedata.pro b/tests/auto/testlib/selftests/commandlinedata/commandlinedata.pro index 9dd1212eba..056388333a 100644 --- a/tests/auto/testlib/selftests/commandlinedata/commandlinedata.pro +++ b/tests/auto/testlib/selftests/commandlinedata/commandlinedata.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = commandlinedata diff --git a/tests/auto/testlib/selftests/commandlinedata/tst_commandlinedata.cpp b/tests/auto/testlib/selftests/commandlinedata/tst_commandlinedata.cpp index 5f2dd3fffc..d6d3db886b 100644 --- a/tests/auto/testlib/selftests/commandlinedata/tst_commandlinedata.cpp +++ b/tests/auto/testlib/selftests/commandlinedata/tst_commandlinedata.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> /*! diff --git a/tests/auto/testlib/selftests/crashes/crashes.pro b/tests/auto/testlib/selftests/crashes/crashes.pro index e9f0f3e5b7..25e24243d1 100644 --- a/tests/auto/testlib/selftests/crashes/crashes.pro +++ b/tests/auto/testlib/selftests/crashes/crashes.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = crashes diff --git a/tests/auto/testlib/selftests/crashes/tst_crashes.cpp b/tests/auto/testlib/selftests/crashes/tst_crashes.cpp index d707414f5b..35a55a367a 100644 --- a/tests/auto/testlib/selftests/crashes/tst_crashes.cpp +++ b/tests/auto/testlib/selftests/crashes/tst_crashes.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> #ifdef Q_OS_WIN diff --git a/tests/auto/testlib/selftests/datatable/datatable.pro b/tests/auto/testlib/selftests/datatable/datatable.pro index 7c36d4a911..72fa851ae6 100644 --- a/tests/auto/testlib/selftests/datatable/datatable.pro +++ b/tests/auto/testlib/selftests/datatable/datatable.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = datatable diff --git a/tests/auto/testlib/selftests/datatable/tst_datatable.cpp b/tests/auto/testlib/selftests/datatable/tst_datatable.cpp index a55e9cbae2..de2495ce65 100644 --- a/tests/auto/testlib/selftests/datatable/tst_datatable.cpp +++ b/tests/auto/testlib/selftests/datatable/tst_datatable.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> /*! diff --git a/tests/auto/testlib/selftests/datetime/datetime.pro b/tests/auto/testlib/selftests/datetime/datetime.pro index f73a763d6b..d65c59354f 100644 --- a/tests/auto/testlib/selftests/datetime/datetime.pro +++ b/tests/auto/testlib/selftests/datetime/datetime.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = datetime diff --git a/tests/auto/testlib/selftests/datetime/tst_datetime.cpp b/tests/auto/testlib/selftests/datetime/tst_datetime.cpp index 64126644db..ee6baacd5b 100644 --- a/tests/auto/testlib/selftests/datetime/tst_datetime.cpp +++ b/tests/auto/testlib/selftests/datetime/tst_datetime.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,11 +40,10 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> +#include <QtCore/QDateTime> #include <QtTest/QtTest> -#include <QDateTime> - /*! \internal */ diff --git a/tests/auto/testlib/selftests/differentexec/differentexec.pro b/tests/auto/testlib/selftests/differentexec/differentexec.pro index 60000d12ea..7f148ba996 100644 --- a/tests/auto/testlib/selftests/differentexec/differentexec.pro +++ b/tests/auto/testlib/selftests/differentexec/differentexec.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = differentexec diff --git a/tests/auto/testlib/selftests/differentexec/tst_differentexec.cpp b/tests/auto/testlib/selftests/differentexec/tst_differentexec.cpp index 5061369776..3a9e0eddf4 100644 --- a/tests/auto/testlib/selftests/differentexec/tst_differentexec.cpp +++ b/tests/auto/testlib/selftests/differentexec/tst_differentexec.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/testlib/selftests/exceptionthrow/exceptionthrow.pro b/tests/auto/testlib/selftests/exceptionthrow/exceptionthrow.pro index 4a72181a07..6b8c821e6e 100644 --- a/tests/auto/testlib/selftests/exceptionthrow/exceptionthrow.pro +++ b/tests/auto/testlib/selftests/exceptionthrow/exceptionthrow.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = exceptionthrow diff --git a/tests/auto/testlib/selftests/exceptionthrow/tst_exceptionthrow.cpp b/tests/auto/testlib/selftests/exceptionthrow/tst_exceptionthrow.cpp index 23cc89ca61..34dae53d0f 100644 --- a/tests/auto/testlib/selftests/exceptionthrow/tst_exceptionthrow.cpp +++ b/tests/auto/testlib/selftests/exceptionthrow/tst_exceptionthrow.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/testlib/selftests/expected_alive.txt b/tests/auto/testlib/selftests/expected_alive.txt index 74d93c5a21..352c878575 100644 --- a/tests/auto/testlib/selftests/expected_alive.txt +++ b/tests/auto/testlib/selftests/expected_alive.txt @@ -8,26 +8,6 @@ QWARN : tst_Alive::alive() TEST LAGS 3 PINGS behind! QWARN : tst_Alive::alive() TEST LAGS 4 PINGS behind! PASS : tst_Alive::alive() PASS : tst_Alive::addMouseDClick() -FAIL! : tst_Alive::compareQStringLists() Compared QStringLists differ at index 2. - Actual (opA) : 'string3' - Expected (opB) : 'DIFFERS' - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/alive/tst_alive.cpp(68)] -FAIL! : tst_Alive::compareQStringLists() Compared QStringLists differ at index 2. - Actual (opA) : 'string3' - Expected (opB) : 'DIFFERS' - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/alive/tst_alive.cpp(68)] -FAIL! : tst_Alive::compareQStringLists() Compared QStringLists have different sizes. - Actual (opA) size : '2' - Expected (opB) size: '1' - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/alive/tst_alive.cpp(68)] -FAIL! : tst_Alive::compareQStringLists() Compared QStringLists have different sizes. - Actual (opA) size : '12' - Expected (opB) size: '1' - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/alive/tst_alive.cpp(68)] -FAIL! : tst_Alive::compareQStringLists() Compared QStringLists have different sizes. - Actual (opA) size : '1' - Expected (opB) size: '12' - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/alive/tst_alive.cpp(68)] PASS : tst_Alive::cleanupTestCase() -Totals: 4 passed, 5 failed, 0 skipped +Totals: 4 passed, 0 failed, 0 skipped ********* Finished testing of tst_Alive ********* diff --git a/tests/auto/testlib/selftests/expected_cmptest.lightxml b/tests/auto/testlib/selftests/expected_cmptest.lightxml index 97b0621f9c..17f3e6ec3a 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.lightxml +++ b/tests/auto/testlib/selftests/expected_cmptest.lightxml @@ -12,31 +12,117 @@ <Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="compare_tostring"> -<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="122"> +<Incident type="fail" file="tst_cmptest.cpp" line="214"> <DataTag><![CDATA[int, string]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual): QVariant(int,123) Expected (expected): QVariant(QString,hi)]]></Description> </Incident> -<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="122"> +<Incident type="fail" file="tst_cmptest.cpp" line="214"> <DataTag><![CDATA[null hash, invalid]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual): QVariant(QVariantHash) Expected (expected): QVariant()]]></Description> </Incident> -<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="122"> +<Incident type="fail" file="tst_cmptest.cpp" line="214"> <DataTag><![CDATA[string, null user type]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual): QVariant(QString,A simple string) Expected (expected): QVariant(PhonyClass)]]></Description> </Incident> -<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="122"> +<Incident type="fail" file="tst_cmptest.cpp" line="214"> <DataTag><![CDATA[both non-null user type]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual): QVariant(PhonyClass,<value not representable as string>) Expected (expected): QVariant(PhonyClass,<value not representable as string>)]]></Description> </Incident> </TestFunction> +<TestFunction name="compareQStringLists"> +<Incident type="fail" file="tst_cmptest.cpp" line="308"> + <DataTag><![CDATA[last item different]]></DataTag> + <Description><![CDATA[Compared QStringLists differ at index 2. + Actual (opA) : 'string3' + Expected (opB) : 'DIFFERS']]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="308"> + <DataTag><![CDATA[second-last item different]]></DataTag> + <Description><![CDATA[Compared QStringLists differ at index 2. + Actual (opA) : 'string3' + Expected (opB) : 'DIFFERS']]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="308"> + <DataTag><![CDATA[prefix]]></DataTag> + <Description><![CDATA[Compared QStringLists have different sizes. + Actual (opA) size : '2' + Expected (opB) size: '1']]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="308"> + <DataTag><![CDATA[short list second]]></DataTag> + <Description><![CDATA[Compared QStringLists have different sizes. + Actual (opA) size : '12' + Expected (opB) size: '1']]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="308"> + <DataTag><![CDATA[short list first]]></DataTag> + <Description><![CDATA[Compared QStringLists have different sizes. + Actual (opA) size : '1' + Expected (opB) size: '12']]></Description> +</Incident> +</TestFunction> +<TestFunction name="compareQPixmaps"> +<Incident type="fail" file="tst_cmptest.cpp" line="333"> + <DataTag><![CDATA[one null]]></DataTag> + <Description><![CDATA[Compared QPixmaps differ. + Actual (opA).isNull() : 1 + Expected (opB).isNull(): 0]]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="333"> + <DataTag><![CDATA[other null]]></DataTag> + <Description><![CDATA[Compared QPixmaps differ. + Actual (opA).isNull() : 0 + Expected (opB).isNull(): 1]]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="333"> + <DataTag><![CDATA[different size]]></DataTag> + <Description><![CDATA[Compared QPixmaps differ in size. + Actual (opA) : 11x20 + Expected (opB): 20x20]]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="333"> + <DataTag><![CDATA[different pixels]]></DataTag> + <Description><![CDATA[Compared values are not the same]]></Description> +</Incident> +</TestFunction> +<TestFunction name="compareQImages"> +<Incident type="fail" file="tst_cmptest.cpp" line="360"> + <DataTag><![CDATA[one null]]></DataTag> + <Description><![CDATA[Compared QImages differ. + Actual (opA).isNull() : 1 + Expected (opB).isNull(): 0]]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="360"> + <DataTag><![CDATA[other null]]></DataTag> + <Description><![CDATA[Compared QImages differ. + Actual (opA).isNull() : 0 + Expected (opB).isNull(): 1]]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="360"> + <DataTag><![CDATA[different size]]></DataTag> + <Description><![CDATA[Compared QImages differ in size. + Actual (opA) : 11x20 + Expected (opB): 20x20]]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="360"> + <DataTag><![CDATA[different format]]></DataTag> + <Description><![CDATA[Compared QImages differ in format. + Actual (opA) : 6 + Expected (opB): 3]]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="360"> + <DataTag><![CDATA[different pixels]]></DataTag> + <Description><![CDATA[Compared values are not the same]]></Description> +</Incident> +</TestFunction> <TestFunction name="cleanupTestCase"> <Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_cmptest.txt b/tests/auto/testlib/selftests/expected_cmptest.txt index 30cc201ef1..36a4995d91 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.txt +++ b/tests/auto/testlib/selftests/expected_cmptest.txt @@ -6,19 +6,71 @@ PASS : tst_Cmptest::compare_pointerfuncs() FAIL! : tst_Cmptest::compare_tostring(int, string) Compared values are not the same Actual (actual): QVariant(int,123) Expected (expected): QVariant(QString,hi) - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(122)] + Loc: [tst_cmptest.cpp(214)] FAIL! : tst_Cmptest::compare_tostring(null hash, invalid) Compared values are not the same Actual (actual): QVariant(QVariantHash) Expected (expected): QVariant() - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(122)] + Loc: [tst_cmptest.cpp(214)] FAIL! : tst_Cmptest::compare_tostring(string, null user type) Compared values are not the same Actual (actual): QVariant(QString,A simple string) Expected (expected): QVariant(PhonyClass) - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(122)] + Loc: [tst_cmptest.cpp(214)] FAIL! : tst_Cmptest::compare_tostring(both non-null user type) Compared values are not the same Actual (actual): QVariant(PhonyClass,<value not representable as string>) Expected (expected): QVariant(PhonyClass,<value not representable as string>) - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(122)] + Loc: [tst_cmptest.cpp(214)] +FAIL! : tst_Cmptest::compareQStringLists(last item different) Compared QStringLists differ at index 2. + Actual (opA) : 'string3' + Expected (opB) : 'DIFFERS' + Loc: [tst_cmptest.cpp(308)] +FAIL! : tst_Cmptest::compareQStringLists(second-last item different) Compared QStringLists differ at index 2. + Actual (opA) : 'string3' + Expected (opB) : 'DIFFERS' + Loc: [tst_cmptest.cpp(308)] +FAIL! : tst_Cmptest::compareQStringLists(prefix) Compared QStringLists have different sizes. + Actual (opA) size : '2' + Expected (opB) size: '1' + Loc: [tst_cmptest.cpp(308)] +FAIL! : tst_Cmptest::compareQStringLists(short list second) Compared QStringLists have different sizes. + Actual (opA) size : '12' + Expected (opB) size: '1' + Loc: [tst_cmptest.cpp(308)] +FAIL! : tst_Cmptest::compareQStringLists(short list first) Compared QStringLists have different sizes. + Actual (opA) size : '1' + Expected (opB) size: '12' + Loc: [tst_cmptest.cpp(308)] +FAIL! : tst_Cmptest::compareQPixmaps(one null) Compared QPixmaps differ. + Actual (opA).isNull() : 1 + Expected (opB).isNull(): 0 + Loc: [tst_cmptest.cpp(333)] +FAIL! : tst_Cmptest::compareQPixmaps(other null) Compared QPixmaps differ. + Actual (opA).isNull() : 0 + Expected (opB).isNull(): 1 + Loc: [tst_cmptest.cpp(333)] +FAIL! : tst_Cmptest::compareQPixmaps(different size) Compared QPixmaps differ in size. + Actual (opA) : 11x20 + Expected (opB): 20x20 + Loc: [tst_cmptest.cpp(333)] +FAIL! : tst_Cmptest::compareQPixmaps(different pixels) Compared values are not the same + Loc: [tst_cmptest.cpp(333)] +FAIL! : tst_Cmptest::compareQImages(one null) Compared QImages differ. + Actual (opA).isNull() : 1 + Expected (opB).isNull(): 0 + Loc: [tst_cmptest.cpp(360)] +FAIL! : tst_Cmptest::compareQImages(other null) Compared QImages differ. + Actual (opA).isNull() : 0 + Expected (opB).isNull(): 1 + Loc: [tst_cmptest.cpp(360)] +FAIL! : tst_Cmptest::compareQImages(different size) Compared QImages differ in size. + Actual (opA) : 11x20 + Expected (opB): 20x20 + Loc: [tst_cmptest.cpp(360)] +FAIL! : tst_Cmptest::compareQImages(different format) Compared QImages differ in format. + Actual (opA) : 6 + Expected (opB): 3 + Loc: [tst_cmptest.cpp(360)] +FAIL! : tst_Cmptest::compareQImages(different pixels) Compared values are not the same + Loc: [tst_cmptest.cpp(360)] PASS : tst_Cmptest::cleanupTestCase() -Totals: 4 passed, 4 failed, 0 skipped +Totals: 4 passed, 18 failed, 0 skipped ********* Finished testing of tst_Cmptest ********* diff --git a/tests/auto/testlib/selftests/expected_cmptest.xml b/tests/auto/testlib/selftests/expected_cmptest.xml index ea05c725fd..aba1ce5edd 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.xml +++ b/tests/auto/testlib/selftests/expected_cmptest.xml @@ -14,31 +14,117 @@ <Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="compare_tostring"> -<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="122"> +<Incident type="fail" file="tst_cmptest.cpp" line="214"> <DataTag><![CDATA[int, string]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual): QVariant(int,123) Expected (expected): QVariant(QString,hi)]]></Description> </Incident> -<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="122"> +<Incident type="fail" file="tst_cmptest.cpp" line="214"> <DataTag><![CDATA[null hash, invalid]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual): QVariant(QVariantHash) Expected (expected): QVariant()]]></Description> </Incident> -<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="122"> +<Incident type="fail" file="tst_cmptest.cpp" line="214"> <DataTag><![CDATA[string, null user type]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual): QVariant(QString,A simple string) Expected (expected): QVariant(PhonyClass)]]></Description> </Incident> -<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="122"> +<Incident type="fail" file="tst_cmptest.cpp" line="214"> <DataTag><![CDATA[both non-null user type]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual): QVariant(PhonyClass,<value not representable as string>) Expected (expected): QVariant(PhonyClass,<value not representable as string>)]]></Description> </Incident> </TestFunction> +<TestFunction name="compareQStringLists"> +<Incident type="fail" file="tst_cmptest.cpp" line="308"> + <DataTag><![CDATA[last item different]]></DataTag> + <Description><![CDATA[Compared QStringLists differ at index 2. + Actual (opA) : 'string3' + Expected (opB) : 'DIFFERS']]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="308"> + <DataTag><![CDATA[second-last item different]]></DataTag> + <Description><![CDATA[Compared QStringLists differ at index 2. + Actual (opA) : 'string3' + Expected (opB) : 'DIFFERS']]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="308"> + <DataTag><![CDATA[prefix]]></DataTag> + <Description><![CDATA[Compared QStringLists have different sizes. + Actual (opA) size : '2' + Expected (opB) size: '1']]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="308"> + <DataTag><![CDATA[short list second]]></DataTag> + <Description><![CDATA[Compared QStringLists have different sizes. + Actual (opA) size : '12' + Expected (opB) size: '1']]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="308"> + <DataTag><![CDATA[short list first]]></DataTag> + <Description><![CDATA[Compared QStringLists have different sizes. + Actual (opA) size : '1' + Expected (opB) size: '12']]></Description> +</Incident> +</TestFunction> +<TestFunction name="compareQPixmaps"> +<Incident type="fail" file="tst_cmptest.cpp" line="333"> + <DataTag><![CDATA[one null]]></DataTag> + <Description><![CDATA[Compared QPixmaps differ. + Actual (opA).isNull() : 1 + Expected (opB).isNull(): 0]]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="333"> + <DataTag><![CDATA[other null]]></DataTag> + <Description><![CDATA[Compared QPixmaps differ. + Actual (opA).isNull() : 0 + Expected (opB).isNull(): 1]]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="333"> + <DataTag><![CDATA[different size]]></DataTag> + <Description><![CDATA[Compared QPixmaps differ in size. + Actual (opA) : 11x20 + Expected (opB): 20x20]]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="333"> + <DataTag><![CDATA[different pixels]]></DataTag> + <Description><![CDATA[Compared values are not the same]]></Description> +</Incident> +</TestFunction> +<TestFunction name="compareQImages"> +<Incident type="fail" file="tst_cmptest.cpp" line="360"> + <DataTag><![CDATA[one null]]></DataTag> + <Description><![CDATA[Compared QImages differ. + Actual (opA).isNull() : 1 + Expected (opB).isNull(): 0]]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="360"> + <DataTag><![CDATA[other null]]></DataTag> + <Description><![CDATA[Compared QImages differ. + Actual (opA).isNull() : 0 + Expected (opB).isNull(): 1]]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="360"> + <DataTag><![CDATA[different size]]></DataTag> + <Description><![CDATA[Compared QImages differ in size. + Actual (opA) : 11x20 + Expected (opB): 20x20]]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="360"> + <DataTag><![CDATA[different format]]></DataTag> + <Description><![CDATA[Compared QImages differ in format. + Actual (opA) : 6 + Expected (opB): 3]]></Description> +</Incident> +<Incident type="fail" file="tst_cmptest.cpp" line="360"> + <DataTag><![CDATA[different pixels]]></DataTag> + <Description><![CDATA[Compared values are not the same]]></Description> +</Incident> +</TestFunction> <TestFunction name="cleanupTestCase"> <Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_cmptest.xunitxml b/tests/auto/testlib/selftests/expected_cmptest.xunitxml index 01bfda8d01..00f5f7f480 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.xunitxml +++ b/tests/auto/testlib/selftests/expected_cmptest.xunitxml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<testsuite errors="0" failures="4" tests="5" name="tst_Cmptest"> +<testsuite errors="0" failures="18" tests="8" name="tst_Cmptest"> <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> @@ -21,6 +21,50 @@ Actual (actual): QVariant(PhonyClass,<value not representable as string>) Expected (expected): QVariant(PhonyClass,<value not representable as string>)" result="fail"/> </testcase> + <testcase result="fail" name="compareQStringLists"> + <failure tag="last item different" message="Compared QStringLists differ at index 2. + Actual (opA) : 'string3' + Expected (opB) : 'DIFFERS'" result="fail"/> + <failure tag="second-last item different" message="Compared QStringLists differ at index 2. + Actual (opA) : 'string3' + Expected (opB) : 'DIFFERS'" result="fail"/> + <failure tag="prefix" message="Compared QStringLists have different sizes. + Actual (opA) size : '2' + Expected (opB) size: '1'" result="fail"/> + <failure tag="short list second" message="Compared QStringLists have different sizes. + Actual (opA) size : '12' + Expected (opB) size: '1'" result="fail"/> + <failure tag="short list first" message="Compared QStringLists have different sizes. + Actual (opA) size : '1' + Expected (opB) size: '12'" result="fail"/> + </testcase> + <testcase result="fail" name="compareQPixmaps"> + <failure tag="one null" message="Compared QPixmaps differ. + Actual (opA).isNull() : 1 + Expected (opB).isNull(): 0" result="fail"/> + <failure tag="other null" message="Compared QPixmaps differ. + Actual (opA).isNull() : 0 + Expected (opB).isNull(): 1" result="fail"/> + <failure tag="different size" message="Compared QPixmaps differ in size. + Actual (opA) : 11x20 + Expected (opB): 20x20" result="fail"/> + <failure tag="different pixels" message="Compared values are not the same" result="fail"/> + </testcase> + <testcase result="fail" name="compareQImages"> + <failure tag="one null" message="Compared QImages differ. + Actual (opA).isNull() : 1 + Expected (opB).isNull(): 0" result="fail"/> + <failure tag="other null" message="Compared QImages differ. + Actual (opA).isNull() : 0 + Expected (opB).isNull(): 1" result="fail"/> + <failure tag="different size" message="Compared QImages differ in size. + Actual (opA) : 11x20 + Expected (opB): 20x20" result="fail"/> + <failure tag="different format" message="Compared QImages differ in format. + Actual (opA) : 6 + Expected (opB): 3" result="fail"/> + <failure tag="different pixels" message="Compared values are not the same" result="fail"/> + </testcase> <testcase result="pass" name="cleanupTestCase"/> <system-err/> </testsuite> diff --git a/tests/auto/testlib/selftests/expected_expectfail.lightxml b/tests/auto/testlib/selftests/expected_expectfail.lightxml index f983a870d3..79e5827caa 100644 --- a/tests/auto/testlib/selftests/expected_expectfail.lightxml +++ b/tests/auto/testlib/selftests/expected_expectfail.lightxml @@ -9,7 +9,7 @@ <Message type="qdebug" file="" line="0"> <Description><![CDATA[begin]]></Description> </Message> -<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="60"> +<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="70"> <Description><![CDATA[This should xfail]]></Description> </Incident> <Message type="qdebug" file="" line="0"> @@ -21,20 +21,55 @@ <Message type="qdebug" file="" line="0"> <Description><![CDATA[begin]]></Description> </Message> -<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="68"> +<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="78"> <Description><![CDATA[This should xfail]]></Description> </Incident> <Incident type="pass" file="" line="0" /> </TestFunction> +<TestFunction name="expectTwice"> +<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="87"> + <Description><![CDATA[Already expecting a fail]]></Description> +</Incident> +</TestFunction> <TestFunction name="xfailWithQString"> -<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="75"> +<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="97"> <Description><![CDATA[A string]]></Description> </Incident> -<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="80"> +<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="102"> <Description><![CDATA[Bug 5 (The message)]]></Description> </Incident> <Incident type="pass" file="" line="0" /> </TestFunction> +<TestFunction name="xpass"> +<Incident type="xpass" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="108"> + <Description><![CDATA['true' returned FALSE. ()]]></Description> +</Incident> +</TestFunction> +<TestFunction name="dataDrivenTest"> +<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="141"> + <DataTag><![CDATA[Abort]]></DataTag> + <Description><![CDATA[This test should xfail]]></Description> +</Incident> +<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="141"> + <DataTag><![CDATA[Continue]]></DataTag> + <Description><![CDATA[This test should xfail]]></Description> +</Incident> +<Incident type="pass" file="" line="0" /> +</TestFunction> +<TestFunction name="expectOnWrongRow"> +<Incident type="pass" file="" line="0" /> +</TestFunction> +<TestFunction name="expectOnAnyRow"> +<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="176"> + <DataTag><![CDATA[first row]]></DataTag> + <Description><![CDATA[This test should xfail]]></Description> +</Incident> +<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="176"> + <DataTag><![CDATA[second row]]></DataTag> + <Description><![CDATA[This test should xfail]]></Description> +</Incident> +<Incident type="pass" file="" line="0" /> +</TestFunction> <TestFunction name="cleanupTestCase"> <Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_expectfail.txt b/tests/auto/testlib/selftests/expected_expectfail.txt index 77b01dfd86..b31245151d 100644 --- a/tests/auto/testlib/selftests/expected_expectfail.txt +++ b/tests/auto/testlib/selftests/expected_expectfail.txt @@ -3,18 +3,33 @@ Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE PASS : tst_ExpectFail::initTestCase() QDEBUG : tst_ExpectFail::expectAndContinue() begin XFAIL : tst_ExpectFail::expectAndContinue() This should xfail - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(27)] + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(70)] QDEBUG : tst_ExpectFail::expectAndContinue() after PASS : tst_ExpectFail::expectAndContinue() QDEBUG : tst_ExpectFail::expectAndAbort() begin XFAIL : tst_ExpectFail::expectAndAbort() This should xfail - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(35)] + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(78)] PASS : tst_ExpectFail::expectAndAbort() +FAIL! : tst_ExpectFail::expectTwice() Already expecting a fail + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(87)] XFAIL : tst_ExpectFail::xfailWithQString() A string - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(42)] + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(97)] XFAIL : tst_ExpectFail::xfailWithQString() Bug 5 (The message) - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(47)] + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(102)] PASS : tst_ExpectFail::xfailWithQString() +XPASS : tst_ExpectFail::xpass() 'true' returned FALSE. () + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(108)] +XFAIL : tst_ExpectFail::dataDrivenTest(Abort) This test should xfail + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(141)] +XFAIL : tst_ExpectFail::dataDrivenTest(Continue) This test should xfail + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(141)] +PASS : tst_ExpectFail::dataDrivenTest() +PASS : tst_ExpectFail::expectOnWrongRow() +XFAIL : tst_ExpectFail::expectOnAnyRow(first row) This test should xfail + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(176)] +XFAIL : tst_ExpectFail::expectOnAnyRow(second row) This test should xfail + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(176)] +PASS : tst_ExpectFail::expectOnAnyRow() PASS : tst_ExpectFail::cleanupTestCase() -Totals: 5 passed, 0 failed, 0 skipped +Totals: 8 passed, 2 failed, 0 skipped ********* Finished testing of tst_ExpectFail ********* diff --git a/tests/auto/testlib/selftests/expected_expectfail.xml b/tests/auto/testlib/selftests/expected_expectfail.xml index 12a1d5cdbf..676a030b3f 100644 --- a/tests/auto/testlib/selftests/expected_expectfail.xml +++ b/tests/auto/testlib/selftests/expected_expectfail.xml @@ -11,7 +11,7 @@ <Message type="qdebug" file="" line="0"> <Description><![CDATA[begin]]></Description> </Message> -<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="60"> +<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="70"> <Description><![CDATA[This should xfail]]></Description> </Incident> <Message type="qdebug" file="" line="0"> @@ -23,20 +23,55 @@ <Message type="qdebug" file="" line="0"> <Description><![CDATA[begin]]></Description> </Message> -<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="68"> +<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="78"> <Description><![CDATA[This should xfail]]></Description> </Incident> <Incident type="pass" file="" line="0" /> </TestFunction> +<TestFunction name="expectTwice"> +<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="87"> + <Description><![CDATA[Already expecting a fail]]></Description> +</Incident> +</TestFunction> <TestFunction name="xfailWithQString"> -<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="75"> +<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="97"> <Description><![CDATA[A string]]></Description> </Incident> -<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="80"> +<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="102"> <Description><![CDATA[Bug 5 (The message)]]></Description> </Incident> <Incident type="pass" file="" line="0" /> </TestFunction> +<TestFunction name="xpass"> +<Incident type="xpass" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="108"> + <Description><![CDATA['true' returned FALSE. ()]]></Description> +</Incident> +</TestFunction> +<TestFunction name="dataDrivenTest"> +<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="141"> + <DataTag><![CDATA[Abort]]></DataTag> + <Description><![CDATA[This test should xfail]]></Description> +</Incident> +<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="141"> + <DataTag><![CDATA[Continue]]></DataTag> + <Description><![CDATA[This test should xfail]]></Description> +</Incident> +<Incident type="pass" file="" line="0" /> +</TestFunction> +<TestFunction name="expectOnWrongRow"> +<Incident type="pass" file="" line="0" /> +</TestFunction> +<TestFunction name="expectOnAnyRow"> +<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="176"> + <DataTag><![CDATA[first row]]></DataTag> + <Description><![CDATA[This test should xfail]]></Description> +</Incident> +<Incident type="xfail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="176"> + <DataTag><![CDATA[second row]]></DataTag> + <Description><![CDATA[This test should xfail]]></Description> +</Incident> +<Incident type="pass" file="" line="0" /> +</TestFunction> <TestFunction name="cleanupTestCase"> <Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_expectfail.xunitxml b/tests/auto/testlib/selftests/expected_expectfail.xunitxml index 32a5cfca81..328bb6433b 100644 --- a/tests/auto/testlib/selftests/expected_expectfail.xunitxml +++ b/tests/auto/testlib/selftests/expected_expectfail.xunitxml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<testsuite errors="7" failures="0" tests="5" name="tst_ExpectFail"> +<testsuite errors="11" failures="2" tests="10" name="tst_ExpectFail"> <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> @@ -14,10 +14,25 @@ <!-- message="begin" type="qdebug" --> <!-- message="This should xfail" type="info" --> </testcase> + <testcase result="fail" name="expectTwice"> + <failure message="Already expecting a fail" result="fail"/> + </testcase> <testcase result="xfail" name="xfailWithQString"> <!-- message="A string" type="info" --> <!-- message="Bug 5 (The message)" type="info" --> </testcase> + <testcase result="xpass" name="xpass"> + <failure message="'true' returned FALSE. ()" result="xpass"/> + </testcase> + <testcase result="xfail" name="dataDrivenTest"> + <!-- tag="Abort" message="This test should xfail" type="info" --> + <!-- tag="Continue" message="This test should xfail" type="info" --> + </testcase> + <testcase result="pass" name="expectOnWrongRow"/> + <testcase result="xfail" name="expectOnAnyRow"> + <!-- tag="first row" message="This test should xfail" type="info" --> + <!-- tag="second row" message="This test should xfail" type="info" --> + </testcase> <testcase result="pass" name="cleanupTestCase"/> <system-err> <![CDATA[begin]]> @@ -27,5 +42,9 @@ <![CDATA[This should xfail]]> <![CDATA[A string]]> <![CDATA[Bug 5 (The message)]]> +<![CDATA[This test should xfail]]> +<![CDATA[This test should xfail]]> +<![CDATA[This test should xfail]]> +<![CDATA[This test should xfail]]> </system-err> </testsuite> diff --git a/tests/auto/testlib/selftests/expectfail/expectfail.pro b/tests/auto/testlib/selftests/expectfail/expectfail.pro index a2916b2830..c1849990f2 100644 --- a/tests/auto/testlib/selftests/expectfail/expectfail.pro +++ b/tests/auto/testlib/selftests/expectfail/expectfail.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = expectfail diff --git a/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp b/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp index 04aef02cc7..79325a3bfc 100644 --- a/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp +++ b/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,9 +40,11 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> +Q_DECLARE_METATYPE(QTest::TestFailMode) + class tst_ExpectFail: public QObject { Q_OBJECT @@ -50,7 +52,15 @@ class tst_ExpectFail: public QObject private slots: void expectAndContinue() const; void expectAndAbort() const; + void expectTwice() const; void xfailWithQString() const; + void xpass() const; + void dataDrivenTest_data() const; + void dataDrivenTest() const; + void expectOnWrongRow_data() const; + void expectOnWrongRow() const; + void expectOnAnyRow_data() const; + void expectOnAnyRow() const; }; void tst_ExpectFail::expectAndContinue() const @@ -66,7 +76,19 @@ void tst_ExpectFail::expectAndAbort() const qDebug("begin"); QEXPECT_FAIL("", "This should xfail", Abort); QVERIFY(false); - qDebug("this should not be reached"); + + // If we get here the test did not correctly abort on the previous QVERIFY. + QVERIFY2(false, "This should not be reached"); +} + +void tst_ExpectFail::expectTwice() const +{ + QEXPECT_FAIL("", "Calling QEXPECT_FAIL once is fine", Abort); + QEXPECT_FAIL("", "Calling QEXPECT_FAIL when already expecting a failure is " + "an error and should abort this test function", Abort); + + // If we get here the test did not correctly abort on the double call to QEXPECT_FAIL. + QVERIFY2(false, "This should not be reached"); } void tst_ExpectFail::xfailWithQString() const @@ -80,6 +102,79 @@ void tst_ExpectFail::xfailWithQString() const QVERIFY(false); } -QTEST_MAIN(tst_ExpectFail) +void tst_ExpectFail::xpass() const +{ + QEXPECT_FAIL("", "This test should xpass", Abort); + QVERIFY(true); + + // If we get here the test did not correctly abort on the previous + // unexpected pass. + QVERIFY2(false, "This should not be reached"); +} + +void tst_ExpectFail::dataDrivenTest_data() const +{ + QTest::addColumn<bool>("shouldPass"); + QTest::addColumn<QTest::TestFailMode>("failMode"); + + QTest::newRow("Pass 1") << true << QTest::Abort; + QTest::newRow("Pass 2") << true << QTest::Continue; + QTest::newRow("Abort") << false << QTest::Abort; + QTest::newRow("Continue") << false << QTest::Continue; +} + +void tst_ExpectFail::dataDrivenTest() const +{ + QFETCH(bool, shouldPass); + QFETCH(QTest::TestFailMode, failMode); + + // You can't pass a variable as the last parameter of QEXPECT_FAIL, + // because the macro adds "QTest::" in front of the last parameter. + // That is why the following code appears to be a little strange. + if (!shouldPass) { + if (failMode == QTest::Abort) + QEXPECT_FAIL(QTest::currentDataTag(), "This test should xfail", Abort); + else + QEXPECT_FAIL(QTest::currentDataTag(), "This test should xfail", Continue); + } + + QVERIFY(shouldPass); + // If we get here, we either expected to pass or we expected to + // fail and the failure mode was Continue. + if (!shouldPass) + QCOMPARE(failMode, QTest::Continue); +} + +void tst_ExpectFail::expectOnWrongRow_data() const +{ + QTest::addColumn<int>("dummy"); + + QTest::newRow("right row") << 0; +} + +void tst_ExpectFail::expectOnWrongRow() const +{ + // QEXPECT_FAIL for a row that is not the current row should be ignored. + QEXPECT_FAIL("wrong row", "This xfail should be ignored", Abort); + QVERIFY(true); +} + +void tst_ExpectFail::expectOnAnyRow_data() const +{ + QTest::addColumn<int>("dummy"); + + QTest::newRow("first row") << 0; + QTest::newRow("second row") << 1; +} + +void tst_ExpectFail::expectOnAnyRow() const +{ + // In a data-driven test, passing an empty first parameter to QEXPECT_FAIL + // should mean that the failure is expected for all data rows. + QEXPECT_FAIL("", "This test should xfail", Abort); + QVERIFY(false); +} + +QTEST_MAIN(tst_ExpectFail) #include "tst_expectfail.moc" diff --git a/tests/auto/testlib/selftests/failinit/failinit.pro b/tests/auto/testlib/selftests/failinit/failinit.pro index 9a781840c6..6a30a5af68 100644 --- a/tests/auto/testlib/selftests/failinit/failinit.pro +++ b/tests/auto/testlib/selftests/failinit/failinit.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = failinit diff --git a/tests/auto/testlib/selftests/failinit/tst_failinit.cpp b/tests/auto/testlib/selftests/failinit/tst_failinit.cpp index 0bf448f428..8f217f1d0a 100644 --- a/tests/auto/testlib/selftests/failinit/tst_failinit.cpp +++ b/tests/auto/testlib/selftests/failinit/tst_failinit.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/testlib/selftests/failinitdata/failinitdata.pro b/tests/auto/testlib/selftests/failinitdata/failinitdata.pro index 7b0b15a59b..b608c67dbb 100644 --- a/tests/auto/testlib/selftests/failinitdata/failinitdata.pro +++ b/tests/auto/testlib/selftests/failinitdata/failinitdata.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = failinitdata diff --git a/tests/auto/testlib/selftests/failinitdata/tst_failinitdata.cpp b/tests/auto/testlib/selftests/failinitdata/tst_failinitdata.cpp index 00e4d12256..b14242f129 100644 --- a/tests/auto/testlib/selftests/failinitdata/tst_failinitdata.cpp +++ b/tests/auto/testlib/selftests/failinitdata/tst_failinitdata.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/testlib/selftests/fetchbogus/fetchbogus.pro b/tests/auto/testlib/selftests/fetchbogus/fetchbogus.pro index 1f8652d533..33b306ca75 100644 --- a/tests/auto/testlib/selftests/fetchbogus/fetchbogus.pro +++ b/tests/auto/testlib/selftests/fetchbogus/fetchbogus.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = fetchbogus diff --git a/tests/auto/testlib/selftests/fetchbogus/tst_fetchbogus.cpp b/tests/auto/testlib/selftests/fetchbogus/tst_fetchbogus.cpp index 65d10c180c..f6f4f0de99 100644 --- a/tests/auto/testlib/selftests/fetchbogus/tst_fetchbogus.cpp +++ b/tests/auto/testlib/selftests/fetchbogus/tst_fetchbogus.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> class tst_FetchBogus: public QObject diff --git a/tests/auto/testlib/selftests/findtestdata/findtestdata.cpp b/tests/auto/testlib/selftests/findtestdata/findtestdata.cpp index 473ba19798..09b8634334 100644 --- a/tests/auto/testlib/selftests/findtestdata/findtestdata.cpp +++ b/tests/auto/testlib/selftests/findtestdata/findtestdata.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore/QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> #define TESTFILE "testfile" @@ -62,7 +62,11 @@ void FindTestData::initTestCase() { // verify that our qt.conf is working as expected. QString app_path = QCoreApplication::applicationDirPath(); - QString install_path = app_path + "/tests"; + QString install_path = app_path +#ifdef Q_OS_MAC + + "/Contents" +#endif + + "/tests"; QVERIFY(QDir("/").mkpath(install_path)); QVERIFY(QDir("/").mkpath(install_path + "/findtestdata")); QCOMPARE(QLibraryInfo::location(QLibraryInfo::TestsPath), install_path); @@ -107,7 +111,11 @@ void FindTestData::paths() QVERIFY(touch(testfile_path1)); // 2. at the test install path (faked via qt.conf) - QString testfile_path2 = app_path + "/tests/findtestdata/" TESTFILE; + QString testfile_path2 = app_path +#ifdef Q_OS_MAC + + "/Contents" +#endif + + "/tests/findtestdata/" TESTFILE; QVERIFY(touch(testfile_path2)); // 3. at the source path (which we will fake later on) diff --git a/tests/auto/testlib/selftests/float/tst_float.cpp b/tests/auto/testlib/selftests/float/tst_float.cpp index 65bd3188cb..47fb253cd0 100644 --- a/tests/auto/testlib/selftests/float/tst_float.cpp +++ b/tests/auto/testlib/selftests/float/tst_float.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> #include <QDebug> diff --git a/tests/auto/testlib/selftests/globaldata/globaldata.pro b/tests/auto/testlib/selftests/globaldata/globaldata.pro index 3d49d3515b..c0b1554c0f 100644 --- a/tests/auto/testlib/selftests/globaldata/globaldata.pro +++ b/tests/auto/testlib/selftests/globaldata/globaldata.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = globaldata diff --git a/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp b/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp index 898cccf435..5a7ffd328f 100644 --- a/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp +++ b/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> #include <QDebug> diff --git a/tests/auto/testlib/selftests/longstring/longstring.pro b/tests/auto/testlib/selftests/longstring/longstring.pro index 9b393e9cc7..d16ba85095 100644 --- a/tests/auto/testlib/selftests/longstring/longstring.pro +++ b/tests/auto/testlib/selftests/longstring/longstring.pro @@ -4,6 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = longstring - diff --git a/tests/auto/testlib/selftests/longstring/tst_longstring.cpp b/tests/auto/testlib/selftests/longstring/tst_longstring.cpp index 99dac95ba1..d42e760483 100644 --- a/tests/auto/testlib/selftests/longstring/tst_longstring.cpp +++ b/tests/auto/testlib/selftests/longstring/tst_longstring.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> char const lipsum[] = diff --git a/tests/auto/testlib/selftests/maxwarnings/maxwarnings.cpp b/tests/auto/testlib/selftests/maxwarnings/maxwarnings.cpp index 398d0d8e4a..fdfe00fc42 100644 --- a/tests/auto/testlib/selftests/maxwarnings/maxwarnings.cpp +++ b/tests/auto/testlib/selftests/maxwarnings/maxwarnings.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore/QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> class MaxWarnings: public QObject diff --git a/tests/auto/testlib/selftests/maxwarnings/maxwarnings.pro b/tests/auto/testlib/selftests/maxwarnings/maxwarnings.pro index 9ebdde5015..79451af1ec 100644 --- a/tests/auto/testlib/selftests/maxwarnings/maxwarnings.pro +++ b/tests/auto/testlib/selftests/maxwarnings/maxwarnings.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = maxwarnings diff --git a/tests/auto/testlib/selftests/multiexec/multiexec.pro b/tests/auto/testlib/selftests/multiexec/multiexec.pro index 79ae010bcb..2038acbd31 100644 --- a/tests/auto/testlib/selftests/multiexec/multiexec.pro +++ b/tests/auto/testlib/selftests/multiexec/multiexec.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = multiexec diff --git a/tests/auto/testlib/selftests/multiexec/tst_multiexec.cpp b/tests/auto/testlib/selftests/multiexec/tst_multiexec.cpp index 0480714c77..d6a5e32f05 100644 --- a/tests/auto/testlib/selftests/multiexec/tst_multiexec.cpp +++ b/tests/auto/testlib/selftests/multiexec/tst_multiexec.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/testlib/selftests/printdatatags/tst_printdatatags.cpp b/tests/auto/testlib/selftests/printdatatags/tst_printdatatags.cpp index f0882316b8..4fdd33268a 100644 --- a/tests/auto/testlib/selftests/printdatatags/tst_printdatatags.cpp +++ b/tests/auto/testlib/selftests/printdatatags/tst_printdatatags.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp b/tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp index 53454fc1ac..23dbfa1ee4 100644 --- a/tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp +++ b/tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/testlib/selftests/qexecstringlist/qexecstringlist.pro b/tests/auto/testlib/selftests/qexecstringlist/qexecstringlist.pro new file mode 100644 index 0000000000..bd967f32e6 --- /dev/null +++ b/tests/auto/testlib/selftests/qexecstringlist/qexecstringlist.pro @@ -0,0 +1,7 @@ +SOURCES += tst_qexecstringlist.cpp +QT = core testlib + +mac:CONFIG -= app_bundle +CONFIG -= debug_and_release_target + +TARGET = qexecstringlist diff --git a/tests/auto/testlib/selftests/qexecstringlist/tst_qexecstringlist.cpp b/tests/auto/testlib/selftests/qexecstringlist/tst_qexecstringlist.cpp new file mode 100644 index 0000000000..5df7e1e1d5 --- /dev/null +++ b/tests/auto/testlib/selftests/qexecstringlist/tst_qexecstringlist.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include <QtCore/QCoreApplication> +#include <QtTest/QtTest> + +class tst_QExecStringList: public QObject +{ + Q_OBJECT + +private slots: + void testA() const; + void testB() const; + void testB_data() const; + void testC() const; +}; + +void tst_QExecStringList::testA() const +{ +} + +void tst_QExecStringList::testB() const +{ + QFETCH(bool, dummy); + Q_UNUSED(dummy); +} + +void tst_QExecStringList::testB_data() const +{ + QTest::addColumn<bool>("dummy"); + + QTest::newRow("Data1") << false; + QTest::newRow("Data2") << false; + QTest::newRow("Data3") << false; +} + +void tst_QExecStringList::testC() const +{ +} + +int main(int argc,char *argv[]) +{ + QCoreApplication app(argc, argv); + + tst_QExecStringList test; + + QTest::qExec(&test, app.arguments()); + QTest::qExec(&test, QStringList("appName")); + QTest::qExec(&test, QStringList("appName") << "testA"); + QTest::qExec(&test, QStringList("appName") << "testB"); + QTest::qExec(&test, QStringList("appName") << "testB:Data2"); + QTest::qExec(&test, QStringList("appName") << "testC"); + + return 0; +} + +#include "tst_qexecstringlist.moc" diff --git a/tests/auto/testlib/selftests/selftests.pri b/tests/auto/testlib/selftests/selftests.pri new file mode 100644 index 0000000000..f506c8c08c --- /dev/null +++ b/tests/auto/testlib/selftests/selftests.pri @@ -0,0 +1,7 @@ +SUBPROGRAMS = subtest warnings maxwarnings cmptest globaldata skip \ + strcmp expectfail sleep fetchbogus crashes multiexec failinit failinitdata \ + skipinit skipinitdata datetime singleskip assert differentexec \ + exceptionthrow qexecstringlist datatable commandlinedata\ + benchlibwalltime benchlibcallgrind benchlibeventcounter benchlibtickcounter \ + benchliboptions xunit badxml longstring float printdatatags \ + printdatatagswithglobaltags findtestdata diff --git a/tests/auto/testlib/selftests/selftests.pro b/tests/auto/testlib/selftests/selftests.pro index b4c4255dfc..1d39e6a899 100644 --- a/tests/auto/testlib/selftests/selftests.pro +++ b/tests/auto/testlib/selftests/selftests.pro @@ -1,12 +1,8 @@ TEMPLATE = subdirs -SUBDIRS = subtest test warnings maxwarnings cmptest globaldata skip \ - strcmp expectfail sleep fetchbogus crashes multiexec failinit failinitdata \ - skipinit skipinitdata datetime singleskip assert differentexec \ - exceptionthrow datatable commandlinedata \ - benchlibwalltime benchlibcallgrind benchlibeventcounter benchlibtickcounter \ - benchliboptions xunit badxml longstring float printdatatags \ - printdatatagswithglobaltags findtestdata +include(selftests.pri) + +SUBDIRS = $$SUBPROGRAMS test INSTALLS = diff --git a/tests/auto/testlib/selftests/selftests.qrc b/tests/auto/testlib/selftests/selftests.qrc index 5090fa7378..fb303af2b5 100644 --- a/tests/auto/testlib/selftests/selftests.qrc +++ b/tests/auto/testlib/selftests/selftests.qrc @@ -95,6 +95,7 @@ <file>expected_multiexec.xunitxml</file> <file>expected_printdatatags.txt</file> <file>expected_printdatatagswithglobaltags.txt</file> + <file>expected_qexecstringlist.txt</file> <file>expected_singleskip.lightxml</file> <file>expected_singleskip.txt</file> <file>expected_singleskip.xml</file> diff --git a/tests/auto/testlib/selftests/singleskip/singleskip.pro b/tests/auto/testlib/selftests/singleskip/singleskip.pro index f4bde92d62..9f63e62747 100644 --- a/tests/auto/testlib/selftests/singleskip/singleskip.pro +++ b/tests/auto/testlib/selftests/singleskip/singleskip.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = singleskip diff --git a/tests/auto/testlib/selftests/singleskip/tst_singleskip.cpp b/tests/auto/testlib/selftests/singleskip/tst_singleskip.cpp index 7701eb81a0..d36b9b52f9 100644 --- a/tests/auto/testlib/selftests/singleskip/tst_singleskip.cpp +++ b/tests/auto/testlib/selftests/singleskip/tst_singleskip.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> class tst_SingleSkip: public QObject diff --git a/tests/auto/testlib/selftests/skip/skip.pro b/tests/auto/testlib/selftests/skip/skip.pro index 82576212ad..8780d295cf 100644 --- a/tests/auto/testlib/selftests/skip/skip.pro +++ b/tests/auto/testlib/selftests/skip/skip.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = skip diff --git a/tests/auto/testlib/selftests/skip/tst_skip.cpp b/tests/auto/testlib/selftests/skip/tst_skip.cpp index 905fe2dde4..76e9059f87 100644 --- a/tests/auto/testlib/selftests/skip/tst_skip.cpp +++ b/tests/auto/testlib/selftests/skip/tst_skip.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> class tst_Skip: public QObject diff --git a/tests/auto/testlib/selftests/skipinit/skipinit.pro b/tests/auto/testlib/selftests/skipinit/skipinit.pro index 848252eabd..7defce9a52 100644 --- a/tests/auto/testlib/selftests/skipinit/skipinit.pro +++ b/tests/auto/testlib/selftests/skipinit/skipinit.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = skipinit diff --git a/tests/auto/testlib/selftests/skipinit/tst_skipinit.cpp b/tests/auto/testlib/selftests/skipinit/tst_skipinit.cpp index 1a9fc1eeec..052dabb343 100644 --- a/tests/auto/testlib/selftests/skipinit/tst_skipinit.cpp +++ b/tests/auto/testlib/selftests/skipinit/tst_skipinit.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/testlib/selftests/skipinitdata/skipinitdata.pro b/tests/auto/testlib/selftests/skipinitdata/skipinitdata.pro index 762543a60b..cd806c2a43 100644 --- a/tests/auto/testlib/selftests/skipinitdata/skipinitdata.pro +++ b/tests/auto/testlib/selftests/skipinitdata/skipinitdata.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = skipinitdata diff --git a/tests/auto/testlib/selftests/skipinitdata/tst_skipinitdata.cpp b/tests/auto/testlib/selftests/skipinitdata/tst_skipinitdata.cpp index b09e99b32f..96c9eb6aff 100644 --- a/tests/auto/testlib/selftests/skipinitdata/tst_skipinitdata.cpp +++ b/tests/auto/testlib/selftests/skipinitdata/tst_skipinitdata.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/testlib/selftests/sleep/sleep.pro b/tests/auto/testlib/selftests/sleep/sleep.pro index e0ae72f54a..affcba22ee 100644 --- a/tests/auto/testlib/selftests/sleep/sleep.pro +++ b/tests/auto/testlib/selftests/sleep/sleep.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = sleep diff --git a/tests/auto/testlib/selftests/sleep/tst_sleep.cpp b/tests/auto/testlib/selftests/sleep/tst_sleep.cpp index e509954b5d..349ecb1d1c 100644 --- a/tests/auto/testlib/selftests/sleep/tst_sleep.cpp +++ b/tests/auto/testlib/selftests/sleep/tst_sleep.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> class tst_Sleep: public QObject diff --git a/tests/auto/testlib/selftests/strcmp/strcmp.pro b/tests/auto/testlib/selftests/strcmp/strcmp.pro index ac1f1e840e..f5f6eecc88 100644 --- a/tests/auto/testlib/selftests/strcmp/strcmp.pro +++ b/tests/auto/testlib/selftests/strcmp/strcmp.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = strcmp diff --git a/tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp b/tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp index 89689bb3bc..2cd69a5873 100644 --- a/tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp +++ b/tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> class tst_StrCmp: public QObject diff --git a/tests/auto/testlib/selftests/subtest/subtest.pro b/tests/auto/testlib/selftests/subtest/subtest.pro index 3066f20247..09dee1b1b9 100644 --- a/tests/auto/testlib/selftests/subtest/subtest.pro +++ b/tests/auto/testlib/selftests/subtest/subtest.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = subtest diff --git a/tests/auto/testlib/selftests/subtest/tst_subtest.cpp b/tests/auto/testlib/selftests/subtest/tst_subtest.cpp index 7ccfc507d7..385d43ab8d 100644 --- a/tests/auto/testlib/selftests/subtest/tst_subtest.cpp +++ b/tests/auto/testlib/selftests/subtest/tst_subtest.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,9 +40,9 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> +#include <QtCore/QDebug> #include <QtTest/QtTest> -#include <QDebug> class tst_Subtest: public QObject { diff --git a/tests/auto/testlib/selftests/test/test.pro b/tests/auto/testlib/selftests/test/test.pro index 29d2cc5f36..a395ecea47 100644 --- a/tests/auto/testlib/selftests/test/test.pro +++ b/tests/auto/testlib/selftests/test/test.pro @@ -13,3 +13,8 @@ win32 { } RESOURCES += ../selftests.qrc + +include(../selftests.pri) +load(testcase) # for target.path and installTestHelperApp() +for(file, SUBPROGRAMS): installTestHelperApp("../$${file}/$${file}",$${file},$${file}) + diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index f7a485b857..04696a1387 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -39,15 +39,19 @@ ** ****************************************************************************/ -#include <QtCore> -#include <QtTest/QtTest> +#include <QtCore/QCoreApplication> #include <QtCore/QXmlStreamReader> +#include <QtCore/QFileInfo> +#include <QtCore/QDir> +#include <QtTest/QtTest> + #include <private/cycle_p.h> class tst_Selftests: public QObject { Q_OBJECT private slots: + void initTestCase(); void runSubTest_data(); void runSubTest(); void cleanup(); @@ -285,6 +289,22 @@ static QList<LoggerSet> allLoggerSets() ; } +void tst_Selftests::initTestCase() +{ + //Detect the location of the sub programs + QString subProgram = QLatin1String("float/float"); +#if defined(Q_OS_WIN) + subProgram = QLatin1String("float/float.exe"); +#endif + QString testdataDir = QFINDTESTDATA(subProgram); + if (testdataDir.lastIndexOf(subProgram) > 0) + testdataDir = testdataDir.left(testdataDir.lastIndexOf(subProgram)); + else + testdataDir = QCoreApplication::applicationDirPath(); + // chdir to our testdata path and execute helper apps relative to that. + QVERIFY2(QDir::setCurrent(testdataDir), qPrintable("Could not chdir to " + testdataDir)); +} + void tst_Selftests::runSubTest_data() { QTest::addColumn<QString>("subdir"); @@ -311,7 +331,7 @@ void tst_Selftests::runSubTest_data() << "datatable" << "datetime" << "differentexec" -#if !defined(QT_NO_EXCEPTIONS) && (!defined(Q_CC_INTEL) || !defined(Q_OS_WIN)) +#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_CC_INTEL) && !defined(Q_OS_WIN) // Disable this test on Windows and for intel compiler, as the run-times // will popup dialogs with warnings that uncaught exceptions were thrown << "exceptionthrow" @@ -319,7 +339,10 @@ void tst_Selftests::runSubTest_data() << "expectfail" << "failinit" << "failinitdata" +#if !defined(Q_OS_WIN) + // Disable this test on Windows, as the run-time will popup dialogs with warnings << "fetchbogus" +#endif << "float" << "globaldata" << "longstring" @@ -327,6 +350,7 @@ void tst_Selftests::runSubTest_data() << "multiexec" << "printdatatags" << "printdatatagswithglobaltags" + << "qexecstringlist" << "singleskip" << "skip" << "skipinit" @@ -391,6 +415,9 @@ void tst_Selftests::runSubTest_data() if (subtest == "multiexec") { continue; } + if (subtest == "qexecstringlist") { + continue; + } if (subtest == "benchliboptions") { continue; } @@ -430,16 +457,41 @@ static inline QProcessEnvironment processEnvironment() { QProcessEnvironment result; const QString path = QStringLiteral("PATH"); - result.insert(path, QProcessEnvironment::systemEnvironment().value(path)); + const QProcessEnvironment systemEnvironment = QProcessEnvironment::systemEnvironment(); + result.insert(path, systemEnvironment.value(path)); + // Preserve DISPLAY for X11 as some tests use QtGui. +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) + const QString display = QStringLiteral("DISPLAY"); + const QString displayValue = systemEnvironment.value(display); + if (!displayValue.isEmpty()) + result.insert(display, displayValue); +#endif + const QString platform = QStringLiteral("QT_QPA_PLATFORM"); + const QString platformValue = systemEnvironment.value(platform); + if (!platformValue.isEmpty()) + result.insert(platform, platformValue); return result; } void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& loggers, QStringList const& arguments) { +#if defined(__GNUC__) && defined(__i386) && defined(Q_OS_LINUX) + if (arguments.contains("-callgrind")) { + QProcess checkProcess; + QStringList args; + args << QLatin1String("--version"); + checkProcess.start(QLatin1String("valgrind"), args); + if (!checkProcess.waitForFinished(-1)) + QSKIP(QString("Valgrind broken or not available. Not running %1 test!").arg(subdir).toLocal8Bit()); + } +#endif + QProcess proc; static const QProcessEnvironment environment = processEnvironment(); proc.setProcessEnvironment(environment); - proc.start(subdir + QLatin1Char('/') + subdir, arguments); + const QString path = subdir + QLatin1Char('/') + subdir; + proc.start(path, arguments); + QVERIFY2(proc.waitForStarted(), qPrintable(QString::fromLatin1("Cannot start '%1': %2").arg(path, proc.errorString()))); QVERIFY2(proc.waitForFinished(), qPrintable(proc.errorString())); QList<QByteArray> actualOutputs; @@ -469,6 +521,7 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge // newer than the valgrind version, such that valgrind can't understand the // debug information on the binary. if (subdir != QLatin1String("exceptionthrow") + && subdir != QLatin1String("cmptest") // QImage comparison requires QGuiApplication && subdir != QLatin1String("fetchbogus") && subdir != QLatin1String("xunit") && subdir != QLatin1String("benchlibcallgrind")) @@ -507,7 +560,9 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge } } } else { - QCOMPARE(res.count(), exp.count()); + QVERIFY2(res.count() == exp.count(), + qPrintable(QString::fromLatin1("Mismatch in line count: %1 != %2 (%3).") + .arg(res.count()).arg(exp.count()).arg(loggers.at(n)))); } // For xml output formats, verify that the log is valid XML. @@ -568,7 +623,9 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge QCOMPARE(actualResult, expectedResult); } else { - QCOMPARE(output, expected); + QVERIFY2(output == expected, + qPrintable(QString::fromLatin1("Mismatch at line %1 (%2): '%3' != '%4'") + .arg(i).arg(loggers.at(n), output, expected))); } benchmark = line.startsWith("RESULT : "); @@ -741,9 +798,12 @@ void tst_Selftests::cleanup() // Remove the test output files for (int i = 0; i < loggers.count(); ++i) { - QString logFile = logName(loggers[i]); - if (!logFile.isEmpty()) - QVERIFY(QFile::remove(logFile)); + QString logFileName = logName(loggers[i]); + if (!logFileName.isEmpty()) { + QFile logFile(logFileName); + if (logFile.exists()) + QVERIFY2(logFile.remove(), qPrintable(QString::fromLatin1("Cannot remove file '%1': %2: ").arg(logFileName, logFile.errorString()))); + } } } diff --git a/tests/auto/testlib/selftests/warnings/tst_warnings.cpp b/tests/auto/testlib/selftests/warnings/tst_warnings.cpp index e14f9c3d98..30fe15d354 100644 --- a/tests/auto/testlib/selftests/warnings/tst_warnings.cpp +++ b/tests/auto/testlib/selftests/warnings/tst_warnings.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtCore> +#include <QtCore/QCoreApplication> #include <QtTest/QtTest> class tst_Warnings: public QObject diff --git a/tests/auto/testlib/selftests/warnings/warnings.pro b/tests/auto/testlib/selftests/warnings/warnings.pro index 0c6ca01588..0c6cddcefb 100644 --- a/tests/auto/testlib/selftests/warnings/warnings.pro +++ b/tests/auto/testlib/selftests/warnings/warnings.pro @@ -4,5 +4,4 @@ QT = core testlib mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target - TARGET = warnings diff --git a/tests/auto/testlib/selftests/xunit/tst_xunit.cpp b/tests/auto/testlib/selftests/xunit/tst_xunit.cpp index 05acc8cfe7..4193387bc1 100644 --- a/tests/auto/testlib/selftests/xunit/tst_xunit.cpp +++ b/tests/auto/testlib/selftests/xunit/tst_xunit.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/testlib/selftests/xunit/xunit.pro b/tests/auto/testlib/selftests/xunit/xunit.pro index d3ae402e6f..b8c606e828 100644 --- a/tests/auto/testlib/selftests/xunit/xunit.pro +++ b/tests/auto/testlib/selftests/xunit/xunit.pro @@ -1,8 +1,8 @@ QT = core testlib -SOURCES += tst_xunit.cpp +SOURCES += tst_xunit.cpp + mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = xunit - |