diff options
author | Paul Wicking <paul.wicking@qt.io> | 2018-10-03 14:10:11 +0200 |
---|---|---|
committer | Paul Wicking <paul.wicking@qt.io> | 2018-10-11 08:49:19 +0000 |
commit | 0a9bf92e8809d49a59fcbb5c6361b752e529bbbe (patch) | |
tree | 9e1c3f2bfe6f04c803559aaa411e5e622069be57 /tests | |
parent | 5c69c450bd7bfa3e17ca278d158d674a1c719e20 (diff) |
QDoc: Move global variables out of main.cpp
This change moves most of the global variables out of main.cpp, and
into the new qdocglobals class, with getter and setter functions for
each variable.
It also introduces the basic structure for autotests for QDoc.
The motivation is to increase the testability of QDoc, as well as to
simplify any future refactoring.
Change-Id: If71ba9f1837e759aa75b1c9fec326d72c41c4fcf
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Ole-Morten Duesund <olemd@odinprosjekt.no>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/auto.pro | 1 | ||||
-rw-r--r-- | tests/auto/qdoc/qdoc.pro | 5 | ||||
-rw-r--r-- | tests/auto/qdoc/qdocglobals/qdocglobals.pro | 7 | ||||
-rw-r--r-- | tests/auto/qdoc/qdocglobals/tst_qdocglobals.cpp | 56 |
4 files changed, 69 insertions, 0 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 15a7cf569..0d3c1d1eb 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -1,6 +1,7 @@ TEMPLATE=subdirs SUBDIRS=\ linguist \ + qdoc \ qtattributionsscanner \ qhelpcontentmodel \ qhelpenginecore \ diff --git a/tests/auto/qdoc/qdoc.pro b/tests/auto/qdoc/qdoc.pro new file mode 100644 index 000000000..da9d55a8f --- /dev/null +++ b/tests/auto/qdoc/qdoc.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs + +SUBDIRS = \ + qdocglobals + diff --git a/tests/auto/qdoc/qdocglobals/qdocglobals.pro b/tests/auto/qdoc/qdocglobals/qdocglobals.pro new file mode 100644 index 000000000..eecfc35f5 --- /dev/null +++ b/tests/auto/qdoc/qdocglobals/qdocglobals.pro @@ -0,0 +1,7 @@ +CONFIG += testcase +QT = core testlib +TARGET = tst_qdocglobals + +include($$PWD/../../../../src/qdoc/qdoc.pri) + +SOURCES += tst_qdocglobals.cpp diff --git a/tests/auto/qdoc/qdocglobals/tst_qdocglobals.cpp b/tests/auto/qdoc/qdocglobals/tst_qdocglobals.cpp new file mode 100644 index 000000000..d534a9646 --- /dev/null +++ b/tests/auto/qdoc/qdocglobals/tst_qdocglobals.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest/QtTest> +#include "qdocglobals.h" + +class qdocglobals : public QObject +{ + Q_OBJECT + +private slots: + void testClassMembersInitializeToFalse(); + +}; + +void qdocglobals::testClassMembersInitializeToFalse() +{ + QDocGlobals qdocGlobals; + QCOMPARE(qdocGlobals.highlighting(), false); + QCOMPARE(qdocGlobals.showInternal(), false); + QCOMPARE(qdocGlobals.singleExec(), false); + QCOMPARE(qdocGlobals.writeQaPages(), false); + QCOMPARE(qdocGlobals.redirectDocumentationToDevNull(), false); + QCOMPARE(qdocGlobals.noLinkErrors(), false); + QCOMPARE(qdocGlobals.autolinkErrors(), false); + QCOMPARE(qdocGlobals.obsoleteLinks(), false); +} + +QTEST_APPLESS_MAIN(qdocglobals) + +#include "tst_qdocglobals.moc" |