summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests/printdatatagswithglobaltags
diff options
context:
space:
mode:
authorJo Asplin <jo.asplin@nokia.com>2011-11-01 12:19:39 +0100
committerQt by Nokia <qt-info@nokia.com>2011-11-04 19:23:33 +0100
commitb68bae1132b5dc5c8f55435c72cd48e24aa52ec9 (patch)
tree0b8a6bbed8b86d5aeed7c8f725dff4d01d593da2 /tests/auto/testlib/selftests/printdatatagswithglobaltags
parent456236b8c8fb90ddbb7812a4bb200a37d2318757 (diff)
Added -datatags option to QTestLib
(Note: This feature is ported from Qt 4.8. See the following commits: 01575deafb7d26ca2431374e92c6d71de96547c7 4866d1ba8afbab61e102942d1ea93b81fea053d6 ) Passing the -datatags option to a QTestLib program prints the available data tags to standard output. For completeness, the test case name is also printed at the start of each output line. (Although the file name is supposed to match the lower-case version of the test case name, this is currently not true in all cases (particularly not under tests/benchmarks/). Even if there was a script to enforce this convention, the -datatags option provides this information in a reliable way.) Data tags for each test function (f() in this case) are printed in four different ways depending on the presence of local and global data tags: Case 1: No tags: tst_MyTestCasetst_MyTestCase f Case 2: Local tags only: tst_MyTestCase f local tag 1 tst_MyTestCase f local tag 2 ... Case 3: Global tags only: tst_MyTestCase f __global__ global tag 1 tst_MyTestCase f __global__ global tag 2 ... Case 4: Local and global tags: tst_MyTestCase f local tag 1 __global__ global tag 1 tst_MyTestCase f local tag 2 __global__ global tag 1 ... tst_MyTestCase f local tag 1 __global__ global tag 2 tst_MyTestCase f local tag 2 __global__ global tag 2 ... ... Note that the string __global__ is assumed to be highly unlikely to occur in a data tag (if it does, an ambiguity results). Change-Id: Ib51aa0c3c32ad52e52ce519729292cf8f0ec5d50 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Diffstat (limited to 'tests/auto/testlib/selftests/printdatatagswithglobaltags')
-rw-r--r--tests/auto/testlib/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro8
-rw-r--r--tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp106
2 files changed, 114 insertions, 0 deletions
diff --git a/tests/auto/testlib/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro b/tests/auto/testlib/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro
new file mode 100644
index 0000000000..baec7dab06
--- /dev/null
+++ b/tests/auto/testlib/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro
@@ -0,0 +1,8 @@
+CONFIG += testcase
+SOURCES += tst_printdatatagswithglobaltags.cpp
+QT = core testlib
+
+mac:CONFIG -= app_bundle
+CONFIG -= debug_and_release_target
+
+TARGET = printdatatagswithglobaltags
diff --git a/tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp b/tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp
new file mode 100644
index 0000000000..6b0e61b7cd
--- /dev/null
+++ b/tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 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 <QtTest/QtTest>
+
+class tst_MyTestCase: public QObject
+{
+ Q_OBJECT
+private slots:
+ void initTestCase_data() const;
+ void initTestCase() const;
+
+ void a_data() const;
+ void a() const;
+
+ void b() const;
+
+ void c_data() const;
+ void c() const;
+};
+
+void tst_MyTestCase::initTestCase_data() const
+{
+ QTest::addColumn<int>("f");
+ QTest::addColumn<int>("g");
+
+ QTest::newRow("global data tag 1 ") << 1 << 2;
+ QTest::newRow("global data tag 2") << 1 << 2;
+}
+
+void tst_MyTestCase::initTestCase() const
+{
+}
+
+void tst_MyTestCase::a_data() const
+{
+ QTest::addColumn<int>("x");
+ QTest::addColumn<int>("y");
+
+ QTest::newRow("data tag a1 ") << 1 << 2;
+ QTest::newRow("data tag a2") << 1 << 2;
+}
+
+void tst_MyTestCase::a() const
+{
+}
+
+void tst_MyTestCase::b() const
+{
+}
+
+void tst_MyTestCase::c_data() const
+{
+ QTest::addColumn<int>("x");
+
+ QTest::newRow("data tag c1") << 1;
+ QTest::newRow("data tag c2") << 1;
+ QTest::newRow("data tag c3") << 1;
+}
+
+void tst_MyTestCase::c() const
+{
+}
+
+QTEST_MAIN(tst_MyTestCase)
+
+#include "tst_printdatatagswithglobaltags.moc"