diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-09-20 13:13:34 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-20 08:46:27 +0200 |
commit | 57368c7037c6d2a6c8cc18d9d41399bf740abe5c (patch) | |
tree | fe985dfedc02e690487c7efe7671859e571384af | |
parent | 01ece201ab08804c4ab226a39f1e1885aeaae0bd (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>
5 files changed, 394 insertions, 84 deletions
diff --git a/tests/auto/testlib/selftests/expected_globaldata.lightxml b/tests/auto/testlib/selftests/expected_globaldata.lightxml index c4db4bc90c..df9394edbe 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.lightxml +++ b/tests/auto/testlib/selftests/expected_globaldata.lightxml @@ -3,30 +3,152 @@ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> +<Message type="qdebug" file="" line="0"> + <Description><![CDATA[initTestCase initTestCase (null) ]]></Description> +</Message> <Incident type="pass" file="" line="0" /> </TestFunction> <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" /> </TestFunction> <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> <Description><![CDATA[skipping]]></Description> </Message> </TestFunction> <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> <Description><![CDATA[skipping]]></Description> </Message> +<Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[1:local 1]]></DataTag> + <Description><![CDATA[cleanup skipLocal local 1 ]]></Description> +</Message> </TestFunction> <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> <Description><![CDATA[skipping]]></Description> </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" /> </TestFunction> <TestFunction name="cleanupTestCase"> +<Message type="qdebug" file="" line="0"> + <Description><![CDATA[cleanupTestCase cleanupTestCase (null) ]]></Description> +</Message> <Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_globaldata.txt b/tests/auto/testlib/selftests/expected_globaldata.txt index 983376b261..75ceb2c0ce 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.txt +++ b/tests/auto/testlib/selftests/expected_globaldata.txt @@ -1,45 +1,45 @@ -********* Start testing of tst_Subtest ********* -Config: Using QTest library 4.3.0, Qt 4.3.0 -initTestCase initTestCase (null) -PASS : tst_Subtest::initTestCase() -init testGlobal local 1 -global: 0 -local: 0 -cleanup testGlobal local 1 -init testGlobal local 2 -global: 0 -local: 1 -cleanup testGlobal local 2 -init testGlobal local 1 -global: 1 -local: 0 -cleanup testGlobal local 1 -init testGlobal local 2 -global: 1 -local: 1 -cleanup testGlobal local 2 -PASS : tst_Subtest::testGlobal() -SKIP : tst_Subtest::skip(1) skipping - Loc: [/home/fenglich/dev/qt-4.3/tests/auto/selftests/globaldata/tst_globaldata.cpp(95)] -init skipLocal local 1 -SKIP : tst_Subtest::skipLocal(1:local 1) skipping - Loc: [/home/fenglich/dev/qt-4.3/tests/auto/selftests/globaldata/tst_globaldata.cpp(115)] -cleanup skipLocal local 1 -init skipSingle local 1 -global: 0, local 0 -cleanup skipSingle local 1 -init skipSingle local 2 -global: 0, local 1 -cleanup skipSingle local 2 -init skipSingle local 1 -SKIP : tst_Subtest::skipSingle(2:local 1) skipping - Loc: [/home/fenglich/dev/qt-4.3/tests/auto/selftests/globaldata/tst_globaldata.cpp(109)] -cleanup skipSingle local 1 -init skipSingle local 2 -global: 1, local 1 -cleanup skipSingle local 2 -PASS : tst_Subtest::skipSingle() -cleanupTestCase cleanupTestCase (null) -PASS : tst_Subtest::cleanupTestCase() +********* Start testing of tst_globaldata ********* +Config: Using QTest library 5.0.0, Qt 5.0.0 +QDEBUG : tst_globaldata::initTestCase() initTestCase initTestCase (null) +PASS : tst_globaldata::initTestCase() +QDEBUG : tst_globaldata::testGlobal(1:local 1) init testGlobal local 1 +QDEBUG : tst_globaldata::testGlobal(1:local 1) global: false +QDEBUG : tst_globaldata::testGlobal(1:local 1) local: false +QDEBUG : tst_globaldata::testGlobal(1:local 1) cleanup testGlobal local 1 +QDEBUG : tst_globaldata::testGlobal(1:local 2) init testGlobal local 2 +QDEBUG : tst_globaldata::testGlobal(1:local 2) global: false +QDEBUG : tst_globaldata::testGlobal(1:local 2) local: true +QDEBUG : tst_globaldata::testGlobal(1:local 2) cleanup testGlobal local 2 +QDEBUG : tst_globaldata::testGlobal(2:local 1) init testGlobal local 1 +QDEBUG : tst_globaldata::testGlobal(2:local 1) global: true +QDEBUG : tst_globaldata::testGlobal(2:local 1) local: false +QDEBUG : tst_globaldata::testGlobal(2:local 1) cleanup testGlobal local 1 +QDEBUG : tst_globaldata::testGlobal(2:local 2) init testGlobal local 2 +QDEBUG : tst_globaldata::testGlobal(2:local 2) global: true +QDEBUG : tst_globaldata::testGlobal(2:local 2) local: true +QDEBUG : tst_globaldata::testGlobal(2:local 2) cleanup testGlobal local 2 +PASS : tst_globaldata::testGlobal() +SKIP : tst_globaldata::skip(1) skipping + Loc: [/home/dev/qt5/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(129)] +QDEBUG : tst_globaldata::skipLocal(1:local 1) init skipLocal local 1 +SKIP : tst_globaldata::skipLocal(1:local 1) skipping + Loc: [/home/dev/qt5/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(149)] +QDEBUG : tst_globaldata::skipLocal(1:local 1) cleanup skipLocal local 1 +QDEBUG : tst_globaldata::skipSingle(1:local 1) init skipSingle local 1 +QDEBUG : tst_globaldata::skipSingle(1:local 1) global: false local: false +QDEBUG : tst_globaldata::skipSingle(1:local 1) cleanup skipSingle local 1 +QDEBUG : tst_globaldata::skipSingle(1:local 2) init skipSingle local 2 +QDEBUG : tst_globaldata::skipSingle(1:local 2) global: false local: true +QDEBUG : tst_globaldata::skipSingle(1:local 2) cleanup skipSingle local 2 +QDEBUG : tst_globaldata::skipSingle(2:local 1) init skipSingle local 1 +SKIP : tst_globaldata::skipSingle(2:local 1) skipping + Loc: [/home/dev/qt5/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(143)] +QDEBUG : tst_globaldata::skipSingle(2:local 1) cleanup skipSingle local 1 +QDEBUG : tst_globaldata::skipSingle(2:local 2) init skipSingle local 2 +QDEBUG : tst_globaldata::skipSingle(2:local 2) global: true local: true +QDEBUG : tst_globaldata::skipSingle(2:local 2) cleanup skipSingle local 2 +PASS : tst_globaldata::skipSingle() +QDEBUG : tst_globaldata::cleanupTestCase() cleanupTestCase cleanupTestCase (null) +PASS : tst_globaldata::cleanupTestCase() Totals: 4 passed, 0 failed, 3 skipped -********* Finished testing of tst_Subtest ********* +********* Finished testing of tst_globaldata ********* diff --git a/tests/auto/testlib/selftests/expected_globaldata.xml b/tests/auto/testlib/selftests/expected_globaldata.xml index ea4beb1886..7a3d9d4ded 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.xml +++ b/tests/auto/testlib/selftests/expected_globaldata.xml @@ -1,35 +1,157 @@ <?xml version="1.0" encoding="ISO-8859-1"?> -<TestCase name="tst_Subtest"> +<TestCase name="tst_globaldata"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> +<Message type="qdebug" file="" line="0"> + <Description><![CDATA[initTestCase initTestCase (null) ]]></Description> +</Message> <Incident type="pass" file="" line="0" /> </TestFunction> <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" /> </TestFunction> <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> <Description><![CDATA[skipping]]></Description> </Message> </TestFunction> <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> <Description><![CDATA[skipping]]></Description> </Message> +<Message type="qdebug" file="" line="0"> + <DataTag><![CDATA[1:local 1]]></DataTag> + <Description><![CDATA[cleanup skipLocal local 1 ]]></Description> +</Message> </TestFunction> <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> <Description><![CDATA[skipping]]></Description> </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" /> </TestFunction> <TestFunction name="cleanupTestCase"> +<Message type="qdebug" file="" line="0"> + <Description><![CDATA[cleanupTestCase cleanupTestCase (null) ]]></Description> +</Message> <Incident type="pass" file="" line="0" /> </TestFunction> </TestCase> diff --git a/tests/auto/testlib/selftests/expected_globaldata.xunitxml b/tests/auto/testlib/selftests/expected_globaldata.xunitxml index d88fdbffa6..eade59734f 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.xunitxml +++ b/tests/auto/testlib/selftests/expected_globaldata.xunitxml @@ -1,24 +1,89 @@ <?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> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> </properties> - <testcase result="pass" name="initTestCase"/> - <testcase result="pass" name="testGlobal"/> + <testcase result="pass" name="initTestCase"> + <!-- 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"> <!-- tag="1" message="skipping" type="skip" --> </testcase> <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="cleanup skipLocal local 1 " type="qdebug" --> </testcase> <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="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 result="pass" name="cleanupTestCase"/> <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[init skipLocal local 1 ]]> <![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[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> </testsuite> 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" |