summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-09-20 13:13:34 +1000
committerQt by Nokia <qt-info@nokia.com>2011-09-20 08:46:27 +0200
commit57368c7037c6d2a6c8cc18d9d41399bf740abe5c (patch)
treefe985dfedc02e690487c7efe7671859e571384af /tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp
parent01ece201ab08804c4ab226a39f1e1885aeaae0bd (diff)
Improve globaldata testlib selftest.
Make the test use qDebug instead of printf, so that the reference test output is the same regardless of whether the log goes to the console or a file. Also rename the test class, as it was evidently cut-n-pasted from the subtest selftest without being renamed. Change-Id: I8df1f0989f2e8c33c1f829ba8110fd740ff70f63 Reviewed-on: http://codereview.qt-project.org/5184 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp')
-rw-r--r--tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp59
1 files changed, 30 insertions, 29 deletions
diff --git a/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp b/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp
index 296f4d674a..18b91ccfe5 100644
--- a/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp
+++ b/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp
@@ -42,8 +42,9 @@
#include <QtCore>
#include <QtTest/QtTest>
+#include <QDebug>
-class tst_Subtest: public QObject
+class tst_globaldata: public QObject
{
Q_OBJECT
public slots:
@@ -69,57 +70,57 @@ private slots:
};
-void tst_Subtest::initTestCase()
+void tst_globaldata::initTestCase()
{
- printf("initTestCase %s %s\n",
- QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)",
- QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
+ qDebug() << "initTestCase"
+ << (QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)")
+ << (QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
}
-void tst_Subtest::initTestCase_data()
+void tst_globaldata::initTestCase_data()
{
QTest::addColumn<bool>("booli");
QTest::newRow("1") << false;
QTest::newRow("2") << true;
}
-void tst_Subtest::cleanupTestCase()
+void tst_globaldata::cleanupTestCase()
{
- printf("cleanupTestCase %s %s\n",
- QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)",
- QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
+ qDebug() << "cleanupTestCase"
+ << (QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)")
+ << (QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
}
-void tst_Subtest::init()
+void tst_globaldata::init()
{
- printf("init %s %s\n",
- QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)",
- QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
+ qDebug() << "init"
+ << (QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)")
+ << (QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
}
-void tst_Subtest::cleanup()
+void tst_globaldata::cleanup()
{
- printf("cleanup %s %s\n",
- QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)",
- QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
+ qDebug() << "cleanup"
+ << (QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)")
+ << (QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
}
-void tst_Subtest::testGlobal_data()
+void tst_globaldata::testGlobal_data()
{
QTest::addColumn<bool>("booll");
QTest::newRow("local 1") << false;
QTest::newRow("local 2") << true;
}
-void tst_Subtest::testGlobal()
+void tst_globaldata::testGlobal()
{
QFETCH_GLOBAL(bool, booli);
- printf("global: %d\n", booli);
+ qDebug() << "global:" << booli;
QFETCH(bool, booll);
- printf("local: %d\n", booll);
+ qDebug() << "local:" << booll;
}
-void tst_Subtest::skip_data()
+void tst_globaldata::skip_data()
{
QTest::addColumn<bool>("booll");
QTest::newRow("local 1") << false;
@@ -128,26 +129,26 @@ void tst_Subtest::skip_data()
QSKIP("skipping", SkipAll);
}
-void tst_Subtest::skip()
+void tst_globaldata::skip()
{
- printf("this line should never be reached\n");
+ qDebug() << "this line should never be reached";
}
-void tst_Subtest::skipSingle()
+void tst_globaldata::skipSingle()
{
QFETCH_GLOBAL(bool, booli);
QFETCH(bool, booll);
if (booli && !booll)
QSKIP("skipping", SkipSingle);
- printf("global: %d, local %d\n", booli, booll);
+ qDebug() << "global:" << booli << "local:" << booll;
}
-void tst_Subtest::skipLocal()
+void tst_globaldata::skipLocal()
{
QSKIP("skipping", SkipAll);
}
-QTEST_MAIN(tst_Subtest)
+QTEST_MAIN(tst_globaldata)
#include "tst_globaldata.moc"