1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the test suite of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 as published by the Free Software
20** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21** included in the packaging of this file. Please review the following
22** information to ensure the GNU General Public License requirements will
23** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24**
25** $QT_END_LICENSE$
26**
27****************************************************************************/
28
29
30#include <QtCore/QCoreApplication>
31#include <QtTest/QtTest>
32
33class tst_Skip: public QObject
34{
35 Q_OBJECT
36
37private slots:
38 void test_data();
39 void test();
40
41 void emptytest_data();
42 void emptytest();
43
44 void singleSkip_data();
45 void singleSkip();
46};
47
48
49void tst_Skip::test_data()
50{
51 QTest::addColumn<bool>(name: "booll");
52 QTest::newRow(dataTag: "local 1") << false;
53 QTest::newRow(dataTag: "local 2") << true;
54
55 QSKIP("skipping all");
56}
57
58void tst_Skip::test()
59{
60 qDebug(msg: "this line should never be reached, since we skip in the _data function");
61}
62
63void tst_Skip::emptytest_data()
64{
65 QSKIP("skipping all");
66}
67
68void tst_Skip::emptytest()
69{
70 qDebug(msg: "this line should never be reached, since we skip in the _data function");
71}
72
73void tst_Skip::singleSkip_data()
74{
75 QTest::addColumn<bool>(name: "booll");
76 QTest::newRow(dataTag: "local 1") << false;
77 QTest::newRow(dataTag: "local 2") << true;
78}
79
80void tst_Skip::singleSkip()
81{
82 QFETCH(bool, booll);
83 if (!booll)
84 QSKIP("skipping one");
85 qDebug(msg: "this line should only be reached once (%s)", booll ? "true" : "false");
86}
87
88QTEST_MAIN(tst_Skip)
89
90#include "tst_skip.moc"
91

source code of qtbase/tests/auto/testlib/selftests/skip/tst_skip.cpp