author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Wed, 21 Apr 2010 12:15:23 +0300 | |
branch | RCL_3 |
changeset 12 | cc75c76972ee |
parent 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the test suite of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
||
43 |
#include <QtCore> |
|
44 |
#include <QtTest/QtTest> |
|
45 |
||
46 |
class tst_Subtest: public QObject |
|
47 |
{ |
|
48 |
Q_OBJECT |
|
49 |
public slots: |
|
50 |
void init(); |
|
51 |
void initTestCase(); |
|
52 |
void initTestCase_data(); |
|
53 |
||
54 |
void cleanup(); |
|
55 |
void cleanupTestCase(); |
|
56 |
||
57 |
private slots: |
|
58 |
void testGlobal_data(); |
|
59 |
void testGlobal(); |
|
60 |
||
61 |
void skip_data(); |
|
62 |
void skip(); |
|
63 |
||
64 |
void skipLocal_data() { testGlobal_data(); } |
|
65 |
void skipLocal(); |
|
66 |
||
67 |
void skipSingle_data() { testGlobal_data(); } |
|
68 |
void skipSingle(); |
|
69 |
}; |
|
70 |
||
71 |
||
72 |
void tst_Subtest::initTestCase() |
|
73 |
{ |
|
74 |
printf("initTestCase %s %s\n", |
|
75 |
QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)", |
|
76 |
QTest::currentDataTag() ? QTest::currentDataTag() : "(null)"); |
|
77 |
} |
|
78 |
||
79 |
void tst_Subtest::initTestCase_data() |
|
80 |
{ |
|
81 |
QTest::addColumn<bool>("booli"); |
|
82 |
QTest::newRow("1") << false; |
|
83 |
QTest::newRow("2") << true; |
|
84 |
} |
|
85 |
||
86 |
void tst_Subtest::cleanupTestCase() |
|
87 |
{ |
|
88 |
printf("cleanupTestCase %s %s\n", |
|
89 |
QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)", |
|
90 |
QTest::currentDataTag() ? QTest::currentDataTag() : "(null)"); |
|
91 |
} |
|
92 |
||
93 |
void tst_Subtest::init() |
|
94 |
{ |
|
95 |
printf("init %s %s\n", |
|
96 |
QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)", |
|
97 |
QTest::currentDataTag() ? QTest::currentDataTag() : "(null)"); |
|
98 |
} |
|
99 |
||
100 |
void tst_Subtest::cleanup() |
|
101 |
{ |
|
102 |
printf("cleanup %s %s\n", |
|
103 |
QTest::currentTestFunction() ? QTest::currentTestFunction() : "(null)", |
|
104 |
QTest::currentDataTag() ? QTest::currentDataTag() : "(null)"); |
|
105 |
} |
|
106 |
||
107 |
void tst_Subtest::testGlobal_data() |
|
108 |
{ |
|
109 |
QTest::addColumn<bool>("booll"); |
|
110 |
QTest::newRow("local 1") << false; |
|
111 |
QTest::newRow("local 2") << true; |
|
112 |
} |
|
113 |
||
114 |
void tst_Subtest::testGlobal() |
|
115 |
{ |
|
116 |
QFETCH_GLOBAL(bool, booli); |
|
117 |
printf("global: %d\n", booli); |
|
118 |
QFETCH(bool, booll); |
|
119 |
printf("local: %d\n", booll); |
|
120 |
} |
|
121 |
||
122 |
void tst_Subtest::skip_data() |
|
123 |
{ |
|
124 |
QTest::addColumn<bool>("booll"); |
|
125 |
QTest::newRow("local 1") << false; |
|
126 |
QTest::newRow("local 2") << true; |
|
127 |
||
128 |
QSKIP("skipping", SkipAll); |
|
129 |
} |
|
130 |
||
131 |
void tst_Subtest::skip() |
|
132 |
{ |
|
133 |
printf("this line should never be reached\n"); |
|
134 |
} |
|
135 |
||
136 |
void tst_Subtest::skipSingle() |
|
137 |
{ |
|
138 |
QFETCH_GLOBAL(bool, booli); |
|
139 |
QFETCH(bool, booll); |
|
140 |
||
141 |
if (booli && !booll) |
|
142 |
QSKIP("skipping", SkipSingle); |
|
143 |
printf("global: %d, local %d\n", booli, booll); |
|
144 |
} |
|
145 |
||
146 |
void tst_Subtest::skipLocal() |
|
147 |
{ |
|
148 |
QSKIP("skipping", SkipAll); |
|
149 |
} |
|
150 |
||
151 |
QTEST_MAIN(tst_Subtest) |
|
152 |
||
153 |
#include "tst_globaldata.moc" |