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>
This commit is contained in:
Jason McDonald 2011-09-20 13:13:34 +10:00 committed by Qt by Nokia
parent 01ece201ab
commit 57368c7037
5 changed files with 394 additions and 84 deletions

View File

@ -3,30 +3,152 @@
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment> </Environment>
<TestFunction name="initTestCase"> <TestFunction name="initTestCase">
<Message type="qdebug" file="" line="0">
<Description><![CDATA[initTestCase initTestCase (null) ]]></Description>
</Message>
<Incident type="pass" file="" line="0" /> <Incident type="pass" file="" line="0" />
</TestFunction> </TestFunction>
<TestFunction name="testGlobal"> <TestFunction name="testGlobal">
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[init testGlobal local 1 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[global: false ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[local: false ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[cleanup testGlobal local 1 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 2]]></DataTag>
<Description><![CDATA[init testGlobal local 2 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 2]]></DataTag>
<Description><![CDATA[global: false ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 2]]></DataTag>
<Description><![CDATA[local: true ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 2]]></DataTag>
<Description><![CDATA[cleanup testGlobal local 2 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 1]]></DataTag>
<Description><![CDATA[init testGlobal local 1 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 1]]></DataTag>
<Description><![CDATA[global: true ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 1]]></DataTag>
<Description><![CDATA[local: false ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 1]]></DataTag>
<Description><![CDATA[cleanup testGlobal local 1 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 2]]></DataTag>
<Description><![CDATA[init testGlobal local 2 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 2]]></DataTag>
<Description><![CDATA[global: true ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 2]]></DataTag>
<Description><![CDATA[local: true ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 2]]></DataTag>
<Description><![CDATA[cleanup testGlobal local 2 ]]></Description>
</Message>
<Incident type="pass" file="" line="0" /> <Incident type="pass" file="" line="0" />
</TestFunction> </TestFunction>
<TestFunction name="skip"> <TestFunction name="skip">
<Message type="skip" file="/local/user_builds/qt/4.6/tests/auto/selftests/globaldata/tst_globaldata.cpp" line="128"> <Message type="skip" file="/home/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="129">
<DataTag><![CDATA[1]]></DataTag> <DataTag><![CDATA[1]]></DataTag>
<Description><![CDATA[skipping]]></Description> <Description><![CDATA[skipping]]></Description>
</Message> </Message>
</TestFunction> </TestFunction>
<TestFunction name="skipLocal"> <TestFunction name="skipLocal">
<Message type="skip" file="/local/user_builds/qt/4.6/tests/auto/selftests/globaldata/tst_globaldata.cpp" line="148"> <Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[init skipLocal local 1 ]]></Description>
</Message>
<Message type="skip" file="/home/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="149">
<DataTag><![CDATA[1:local 1]]></DataTag> <DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[skipping]]></Description> <Description><![CDATA[skipping]]></Description>
</Message> </Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[cleanup skipLocal local 1 ]]></Description>
</Message>
</TestFunction> </TestFunction>
<TestFunction name="skipSingle"> <TestFunction name="skipSingle">
<Message type="skip" file="/local/user_builds/qt/4.6/tests/auto/selftests/globaldata/tst_globaldata.cpp" line="142"> <Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[init skipSingle local 1 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[global: false local: false ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[cleanup skipSingle local 1 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 2]]></DataTag>
<Description><![CDATA[init skipSingle local 2 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 2]]></DataTag>
<Description><![CDATA[global: false local: true ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 2]]></DataTag>
<Description><![CDATA[cleanup skipSingle local 2 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 1]]></DataTag>
<Description><![CDATA[init skipSingle local 1 ]]></Description>
</Message>
<Message type="skip" file="/home/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="143">
<DataTag><![CDATA[2:local 1]]></DataTag> <DataTag><![CDATA[2:local 1]]></DataTag>
<Description><![CDATA[skipping]]></Description> <Description><![CDATA[skipping]]></Description>
</Message> </Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 1]]></DataTag>
<Description><![CDATA[cleanup skipSingle local 1 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 2]]></DataTag>
<Description><![CDATA[init skipSingle local 2 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 2]]></DataTag>
<Description><![CDATA[global: true local: true ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 2]]></DataTag>
<Description><![CDATA[cleanup skipSingle local 2 ]]></Description>
</Message>
<Incident type="pass" file="" line="0" /> <Incident type="pass" file="" line="0" />
</TestFunction> </TestFunction>
<TestFunction name="cleanupTestCase"> <TestFunction name="cleanupTestCase">
<Message type="qdebug" file="" line="0">
<Description><![CDATA[cleanupTestCase cleanupTestCase (null) ]]></Description>
</Message>
<Incident type="pass" file="" line="0" /> <Incident type="pass" file="" line="0" />
</TestFunction> </TestFunction>

View File

@ -1,45 +1,45 @@
********* Start testing of tst_Subtest ********* ********* Start testing of tst_globaldata *********
Config: Using QTest library 4.3.0, Qt 4.3.0 Config: Using QTest library 5.0.0, Qt 5.0.0
initTestCase initTestCase (null) QDEBUG : tst_globaldata::initTestCase() initTestCase initTestCase (null)
PASS : tst_Subtest::initTestCase() PASS : tst_globaldata::initTestCase()
init testGlobal local 1 QDEBUG : tst_globaldata::testGlobal(1:local 1) init testGlobal local 1
global: 0 QDEBUG : tst_globaldata::testGlobal(1:local 1) global: false
local: 0 QDEBUG : tst_globaldata::testGlobal(1:local 1) local: false
cleanup testGlobal local 1 QDEBUG : tst_globaldata::testGlobal(1:local 1) cleanup testGlobal local 1
init testGlobal local 2 QDEBUG : tst_globaldata::testGlobal(1:local 2) init testGlobal local 2
global: 0 QDEBUG : tst_globaldata::testGlobal(1:local 2) global: false
local: 1 QDEBUG : tst_globaldata::testGlobal(1:local 2) local: true
cleanup testGlobal local 2 QDEBUG : tst_globaldata::testGlobal(1:local 2) cleanup testGlobal local 2
init testGlobal local 1 QDEBUG : tst_globaldata::testGlobal(2:local 1) init testGlobal local 1
global: 1 QDEBUG : tst_globaldata::testGlobal(2:local 1) global: true
local: 0 QDEBUG : tst_globaldata::testGlobal(2:local 1) local: false
cleanup testGlobal local 1 QDEBUG : tst_globaldata::testGlobal(2:local 1) cleanup testGlobal local 1
init testGlobal local 2 QDEBUG : tst_globaldata::testGlobal(2:local 2) init testGlobal local 2
global: 1 QDEBUG : tst_globaldata::testGlobal(2:local 2) global: true
local: 1 QDEBUG : tst_globaldata::testGlobal(2:local 2) local: true
cleanup testGlobal local 2 QDEBUG : tst_globaldata::testGlobal(2:local 2) cleanup testGlobal local 2
PASS : tst_Subtest::testGlobal() PASS : tst_globaldata::testGlobal()
SKIP : tst_Subtest::skip(1) skipping SKIP : tst_globaldata::skip(1) skipping
Loc: [/home/fenglich/dev/qt-4.3/tests/auto/selftests/globaldata/tst_globaldata.cpp(95)] Loc: [/home/dev/qt5/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(129)]
init skipLocal local 1 QDEBUG : tst_globaldata::skipLocal(1:local 1) init skipLocal local 1
SKIP : tst_Subtest::skipLocal(1:local 1) skipping SKIP : tst_globaldata::skipLocal(1:local 1) skipping
Loc: [/home/fenglich/dev/qt-4.3/tests/auto/selftests/globaldata/tst_globaldata.cpp(115)] Loc: [/home/dev/qt5/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(149)]
cleanup skipLocal local 1 QDEBUG : tst_globaldata::skipLocal(1:local 1) cleanup skipLocal local 1
init skipSingle local 1 QDEBUG : tst_globaldata::skipSingle(1:local 1) init skipSingle local 1
global: 0, local 0 QDEBUG : tst_globaldata::skipSingle(1:local 1) global: false local: false
cleanup skipSingle local 1 QDEBUG : tst_globaldata::skipSingle(1:local 1) cleanup skipSingle local 1
init skipSingle local 2 QDEBUG : tst_globaldata::skipSingle(1:local 2) init skipSingle local 2
global: 0, local 1 QDEBUG : tst_globaldata::skipSingle(1:local 2) global: false local: true
cleanup skipSingle local 2 QDEBUG : tst_globaldata::skipSingle(1:local 2) cleanup skipSingle local 2
init skipSingle local 1 QDEBUG : tst_globaldata::skipSingle(2:local 1) init skipSingle local 1
SKIP : tst_Subtest::skipSingle(2:local 1) skipping SKIP : tst_globaldata::skipSingle(2:local 1) skipping
Loc: [/home/fenglich/dev/qt-4.3/tests/auto/selftests/globaldata/tst_globaldata.cpp(109)] Loc: [/home/dev/qt5/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(143)]
cleanup skipSingle local 1 QDEBUG : tst_globaldata::skipSingle(2:local 1) cleanup skipSingle local 1
init skipSingle local 2 QDEBUG : tst_globaldata::skipSingle(2:local 2) init skipSingle local 2
global: 1, local 1 QDEBUG : tst_globaldata::skipSingle(2:local 2) global: true local: true
cleanup skipSingle local 2 QDEBUG : tst_globaldata::skipSingle(2:local 2) cleanup skipSingle local 2
PASS : tst_Subtest::skipSingle() PASS : tst_globaldata::skipSingle()
cleanupTestCase cleanupTestCase (null) QDEBUG : tst_globaldata::cleanupTestCase() cleanupTestCase cleanupTestCase (null)
PASS : tst_Subtest::cleanupTestCase() PASS : tst_globaldata::cleanupTestCase()
Totals: 4 passed, 0 failed, 3 skipped Totals: 4 passed, 0 failed, 3 skipped
********* Finished testing of tst_Subtest ********* ********* Finished testing of tst_globaldata *********

View File

@ -1,35 +1,157 @@
<?xml version="1.0" encoding="ISO-8859-1"?> <?xml version="1.0" encoding="ISO-8859-1"?>
<TestCase name="tst_Subtest"> <TestCase name="tst_globaldata">
<Environment> <Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment> </Environment>
<TestFunction name="initTestCase"> <TestFunction name="initTestCase">
<Message type="qdebug" file="" line="0">
<Description><![CDATA[initTestCase initTestCase (null) ]]></Description>
</Message>
<Incident type="pass" file="" line="0" /> <Incident type="pass" file="" line="0" />
</TestFunction> </TestFunction>
<TestFunction name="testGlobal"> <TestFunction name="testGlobal">
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[init testGlobal local 1 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[global: false ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[local: false ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[cleanup testGlobal local 1 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 2]]></DataTag>
<Description><![CDATA[init testGlobal local 2 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 2]]></DataTag>
<Description><![CDATA[global: false ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 2]]></DataTag>
<Description><![CDATA[local: true ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 2]]></DataTag>
<Description><![CDATA[cleanup testGlobal local 2 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 1]]></DataTag>
<Description><![CDATA[init testGlobal local 1 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 1]]></DataTag>
<Description><![CDATA[global: true ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 1]]></DataTag>
<Description><![CDATA[local: false ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 1]]></DataTag>
<Description><![CDATA[cleanup testGlobal local 1 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 2]]></DataTag>
<Description><![CDATA[init testGlobal local 2 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 2]]></DataTag>
<Description><![CDATA[global: true ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 2]]></DataTag>
<Description><![CDATA[local: true ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 2]]></DataTag>
<Description><![CDATA[cleanup testGlobal local 2 ]]></Description>
</Message>
<Incident type="pass" file="" line="0" /> <Incident type="pass" file="" line="0" />
</TestFunction> </TestFunction>
<TestFunction name="skip"> <TestFunction name="skip">
<Message type="skip" file="/local/user_builds/qt/4.6/tests/auto/selftests/globaldata/tst_globaldata.cpp" line="128"> <Message type="skip" file="/home/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="129">
<DataTag><![CDATA[1]]></DataTag> <DataTag><![CDATA[1]]></DataTag>
<Description><![CDATA[skipping]]></Description> <Description><![CDATA[skipping]]></Description>
</Message> </Message>
</TestFunction> </TestFunction>
<TestFunction name="skipLocal"> <TestFunction name="skipLocal">
<Message type="skip" file="/local/user_builds/qt/4.6/tests/auto/selftests/globaldata/tst_globaldata.cpp" line="148"> <Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[init skipLocal local 1 ]]></Description>
</Message>
<Message type="skip" file="/home/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="149">
<DataTag><![CDATA[1:local 1]]></DataTag> <DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[skipping]]></Description> <Description><![CDATA[skipping]]></Description>
</Message> </Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[cleanup skipLocal local 1 ]]></Description>
</Message>
</TestFunction> </TestFunction>
<TestFunction name="skipSingle"> <TestFunction name="skipSingle">
<Message type="skip" file="/local/user_builds/qt/4.6/tests/auto/selftests/globaldata/tst_globaldata.cpp" line="142"> <Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[init skipSingle local 1 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[global: false local: false ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 1]]></DataTag>
<Description><![CDATA[cleanup skipSingle local 1 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 2]]></DataTag>
<Description><![CDATA[init skipSingle local 2 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 2]]></DataTag>
<Description><![CDATA[global: false local: true ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[1:local 2]]></DataTag>
<Description><![CDATA[cleanup skipSingle local 2 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 1]]></DataTag>
<Description><![CDATA[init skipSingle local 1 ]]></Description>
</Message>
<Message type="skip" file="/home/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="143">
<DataTag><![CDATA[2:local 1]]></DataTag> <DataTag><![CDATA[2:local 1]]></DataTag>
<Description><![CDATA[skipping]]></Description> <Description><![CDATA[skipping]]></Description>
</Message> </Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 1]]></DataTag>
<Description><![CDATA[cleanup skipSingle local 1 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 2]]></DataTag>
<Description><![CDATA[init skipSingle local 2 ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 2]]></DataTag>
<Description><![CDATA[global: true local: true ]]></Description>
</Message>
<Message type="qdebug" file="" line="0">
<DataTag><![CDATA[2:local 2]]></DataTag>
<Description><![CDATA[cleanup skipSingle local 2 ]]></Description>
</Message>
<Incident type="pass" file="" line="0" /> <Incident type="pass" file="" line="0" />
</TestFunction> </TestFunction>
<TestFunction name="cleanupTestCase"> <TestFunction name="cleanupTestCase">
<Message type="qdebug" file="" line="0">
<Description><![CDATA[cleanupTestCase cleanupTestCase (null) ]]></Description>
</Message>
<Incident type="pass" file="" line="0" /> <Incident type="pass" file="" line="0" />
</TestFunction> </TestFunction>
</TestCase> </TestCase>

View File

@ -1,24 +1,89 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="3" failures="0" tests="6" name="tst_Subtest"> <testsuite errors="34" failures="0" tests="6" name="tst_globaldata">
<properties> <properties>
<property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
<property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
</properties> </properties>
<testcase result="pass" name="initTestCase"/> <testcase result="pass" name="initTestCase">
<testcase result="pass" name="testGlobal"/> <!-- message="initTestCase initTestCase (null) " type="qdebug" -->
</testcase>
<testcase result="pass" name="testGlobal">
<!-- tag="1:local 1" message="init testGlobal local 1 " type="qdebug" -->
<!-- tag="1:local 1" message="global: false " type="qdebug" -->
<!-- tag="1:local 1" message="local: false " type="qdebug" -->
<!-- tag="1:local 1" message="cleanup testGlobal local 1 " type="qdebug" -->
<!-- tag="1:local 2" message="init testGlobal local 2 " type="qdebug" -->
<!-- tag="1:local 2" message="global: false " type="qdebug" -->
<!-- tag="1:local 2" message="local: true " type="qdebug" -->
<!-- tag="1:local 2" message="cleanup testGlobal local 2 " type="qdebug" -->
<!-- tag="2:local 1" message="init testGlobal local 1 " type="qdebug" -->
<!-- tag="2:local 1" message="global: true " type="qdebug" -->
<!-- tag="2:local 1" message="local: false " type="qdebug" -->
<!-- tag="2:local 1" message="cleanup testGlobal local 1 " type="qdebug" -->
<!-- tag="2:local 2" message="init testGlobal local 2 " type="qdebug" -->
<!-- tag="2:local 2" message="global: true " type="qdebug" -->
<!-- tag="2:local 2" message="local: true " type="qdebug" -->
<!-- tag="2:local 2" message="cleanup testGlobal local 2 " type="qdebug" -->
</testcase>
<testcase name="skip"> <testcase name="skip">
<!-- tag="1" message="skipping" type="skip" --> <!-- tag="1" message="skipping" type="skip" -->
</testcase> </testcase>
<testcase name="skipLocal"> <testcase name="skipLocal">
<!-- tag="1:local 1" message="init skipLocal local 1 " type="qdebug" -->
<!-- tag="1:local 1" message="skipping" type="skip" --> <!-- tag="1:local 1" message="skipping" type="skip" -->
<!-- tag="1:local 1" message="cleanup skipLocal local 1 " type="qdebug" -->
</testcase> </testcase>
<testcase result="pass" name="skipSingle"> <testcase result="pass" name="skipSingle">
<!-- tag="1:local 1" message="init skipSingle local 1 " type="qdebug" -->
<!-- tag="1:local 1" message="global: false local: false " type="qdebug" -->
<!-- tag="1:local 1" message="cleanup skipSingle local 1 " type="qdebug" -->
<!-- tag="1:local 2" message="init skipSingle local 2 " type="qdebug" -->
<!-- tag="1:local 2" message="global: false local: true " type="qdebug" -->
<!-- tag="1:local 2" message="cleanup skipSingle local 2 " type="qdebug" -->
<!-- tag="2:local 1" message="init skipSingle local 1 " type="qdebug" -->
<!-- tag="2:local 1" message="skipping" type="skip" --> <!-- tag="2:local 1" message="skipping" type="skip" -->
<!-- tag="2:local 1" message="cleanup skipSingle local 1 " type="qdebug" -->
<!-- tag="2:local 2" message="init skipSingle local 2 " type="qdebug" -->
<!-- tag="2:local 2" message="global: true local: true " type="qdebug" -->
<!-- tag="2:local 2" message="cleanup skipSingle local 2 " type="qdebug" -->
</testcase>
<testcase result="pass" name="cleanupTestCase">
<!-- message="cleanupTestCase cleanupTestCase (null) " type="qdebug" -->
</testcase> </testcase>
<testcase result="pass" name="cleanupTestCase"/>
<system-err> <system-err>
<![CDATA[initTestCase initTestCase (null) ]]>
<![CDATA[init testGlobal local 1 ]]>
<![CDATA[global: false ]]>
<![CDATA[local: false ]]>
<![CDATA[cleanup testGlobal local 1 ]]>
<![CDATA[init testGlobal local 2 ]]>
<![CDATA[global: false ]]>
<![CDATA[local: true ]]>
<![CDATA[cleanup testGlobal local 2 ]]>
<![CDATA[init testGlobal local 1 ]]>
<![CDATA[global: true ]]>
<![CDATA[local: false ]]>
<![CDATA[cleanup testGlobal local 1 ]]>
<![CDATA[init testGlobal local 2 ]]>
<![CDATA[global: true ]]>
<![CDATA[local: true ]]>
<![CDATA[cleanup testGlobal local 2 ]]>
<![CDATA[skipping]]> <![CDATA[skipping]]>
<![CDATA[init skipLocal local 1 ]]>
<![CDATA[skipping]]> <![CDATA[skipping]]>
<![CDATA[cleanup skipLocal local 1 ]]>
<![CDATA[init skipSingle local 1 ]]>
<![CDATA[global: false local: false ]]>
<![CDATA[cleanup skipSingle local 1 ]]>
<![CDATA[init skipSingle local 2 ]]>
<![CDATA[global: false local: true ]]>
<![CDATA[cleanup skipSingle local 2 ]]>
<![CDATA[init skipSingle local 1 ]]>
<![CDATA[skipping]]> <![CDATA[skipping]]>
<![CDATA[cleanup skipSingle local 1 ]]>
<![CDATA[init skipSingle local 2 ]]>
<![CDATA[global: true local: true ]]>
<![CDATA[cleanup skipSingle local 2 ]]>
<![CDATA[cleanupTestCase cleanupTestCase (null) ]]>
</system-err> </system-err>
</testsuite> </testsuite>

View File

@ -42,8 +42,9 @@
#include <QtCore> #include <QtCore>
#include <QtTest/QtTest> #include <QtTest/QtTest>
#include <QDebug>
class tst_Subtest: public QObject class tst_globaldata: public QObject
{ {
Q_OBJECT Q_OBJECT
public slots: public slots:
@ -69,57 +70,57 @@ private slots:
}; };
void tst_Subtest::initTestCase() void tst_globaldata::initTestCase()
{ {
printf("initTestCase %s %s\n", qDebug() << "initTestCase"
QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)", << (QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)")
QTest::currentDataTag() ? QTest::currentDataTag() : "(null)"); << (QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
} }
void tst_Subtest::initTestCase_data() void tst_globaldata::initTestCase_data()
{ {
QTest::addColumn<bool>("booli"); QTest::addColumn<bool>("booli");
QTest::newRow("1") << false; QTest::newRow("1") << false;
QTest::newRow("2") << true; QTest::newRow("2") << true;
} }
void tst_Subtest::cleanupTestCase() void tst_globaldata::cleanupTestCase()
{ {
printf("cleanupTestCase %s %s\n", qDebug() << "cleanupTestCase"
QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)", << (QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)")
QTest::currentDataTag() ? QTest::currentDataTag() : "(null)"); << (QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
} }
void tst_Subtest::init() void tst_globaldata::init()
{ {
printf("init %s %s\n", qDebug() << "init"
QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)", << (QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)")
QTest::currentDataTag() ? QTest::currentDataTag() : "(null)"); << (QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
} }
void tst_Subtest::cleanup() void tst_globaldata::cleanup()
{ {
printf("cleanup %s %s\n", qDebug() << "cleanup"
QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)", << (QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)")
QTest::currentDataTag() ? QTest::currentDataTag() : "(null)"); << (QTest::currentDataTag() ? QTest::currentDataTag() : "(null)");
} }
void tst_Subtest::testGlobal_data() void tst_globaldata::testGlobal_data()
{ {
QTest::addColumn<bool>("booll"); QTest::addColumn<bool>("booll");
QTest::newRow("local 1") << false; QTest::newRow("local 1") << false;
QTest::newRow("local 2") << true; QTest::newRow("local 2") << true;
} }
void tst_Subtest::testGlobal() void tst_globaldata::testGlobal()
{ {
QFETCH_GLOBAL(bool, booli); QFETCH_GLOBAL(bool, booli);
printf("global: %d\n", booli); qDebug() << "global:" << booli;
QFETCH(bool, booll); 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::addColumn<bool>("booll");
QTest::newRow("local 1") << false; QTest::newRow("local 1") << false;
@ -128,26 +129,26 @@ void tst_Subtest::skip_data()
QSKIP("skipping", SkipAll); 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_GLOBAL(bool, booli);
QFETCH(bool, booll); QFETCH(bool, booll);
if (booli && !booll) if (booli && !booll)
QSKIP("skipping", SkipSingle); 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); QSKIP("skipping", SkipAll);
} }
QTEST_MAIN(tst_Subtest) QTEST_MAIN(tst_globaldata)
#include "tst_globaldata.moc" #include "tst_globaldata.moc"