summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2020-05-22 15:19:19 +0200
committerKai Koehne <kai.koehne@qt.io>2020-05-26 15:11:41 +0200
commitec3ba7209e624873da83ed8785eb4822ce0be2f7 (patch)
treef94e88de08d0f8c299c31076bcb50105f24b119e /src/testlib
parentcede00ec892805ad0f04db6566bf002195c4cb09 (diff)
Document how to use CMake for Qt TestLib
Task-number: QTBUG-73058 Change-Id: I6e29a83a1346ea0d2f94fcf445e1de9c07072aa6 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/doc/qttestlib.qdocconf1
-rw-r--r--src/testlib/doc/snippets/CMakeLists.txt4
-rw-r--r--src/testlib/doc/snippets/snippets.pro6
-rw-r--r--src/testlib/doc/src/qttest-index.qdoc16
-rw-r--r--src/testlib/doc/src/qttest.qdoc22
5 files changed, 19 insertions, 30 deletions
diff --git a/src/testlib/doc/qttestlib.qdocconf b/src/testlib/doc/qttestlib.qdocconf
index 52e1480295..b12e3c14ca 100644
--- a/src/testlib/doc/qttestlib.qdocconf
+++ b/src/testlib/doc/qttestlib.qdocconf
@@ -44,6 +44,7 @@ sources += ../../corelib/kernel/qtestsupport_core.cpp \
exampledirs += ../../../examples/qtestlib \
../ \
+ . / \
snippets
excludedirs += ../../../examples/widgets/doc
diff --git a/src/testlib/doc/snippets/CMakeLists.txt b/src/testlib/doc/snippets/CMakeLists.txt
new file mode 100644
index 0000000000..ddf5445b77
--- /dev/null
+++ b/src/testlib/doc/snippets/CMakeLists.txt
@@ -0,0 +1,4 @@
+#! [cmake_use]
+find_package(Qt6 COMPONENTS Test REQUIRED)
+target_link_libraries(mytarget Qt::Test)
+#! [cmake_use]
diff --git a/src/testlib/doc/snippets/snippets.pro b/src/testlib/doc/snippets/snippets.pro
index 8d49575aeb..cd0b6d49de 100644
--- a/src/testlib/doc/snippets/snippets.pro
+++ b/src/testlib/doc/snippets/snippets.pro
@@ -1,6 +1,10 @@
TEMPLATE = app
TARGET = testlib_cppsnippet
-QT = core testlib sql widgets
+QT = core sql widgets
+
+#! [qmake_use]
+QT += testlib
+#! [qmake_use]
SOURCES += code/src_qtestlib_qtestcase.cpp \
code/doc_src_qtestlib.cpp \
diff --git a/src/testlib/doc/src/qttest-index.qdoc b/src/testlib/doc/src/qttest-index.qdoc
index d1b24a7858..9182881a2a 100644
--- a/src/testlib/doc/src/qttest-index.qdoc
+++ b/src/testlib/doc/src/qttest-index.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2019 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -40,17 +40,13 @@
to work with the Qt version it was developed against. However, source
compatibility is guaranteed.
- \section1 Getting Started
+ \include module-use.qdocinc using qt module
+ \snippet snippets/CMakeLists.txt cmake_use
- To enable Qt Test in a project, add this directive into the C++ files:
+ See also the \l[QtDoc]{Building with CMake} overview.
- \snippet code/doc_src_qttest.cpp 0
-
- \if !define(qtforpython)
- To link against Qt Test, add this line to the project file:
-
- \snippet code/doc_src_qttest.pro 1
- \endif
+ \include module-use.qdocinc building with qmake
+ \snippet snippets/snippets.pro qmake_use
\section1 Articles and Guides
diff --git a/src/testlib/doc/src/qttest.qdoc b/src/testlib/doc/src/qttest.qdoc
index e61fd71e69..29b51d9572 100644
--- a/src/testlib/doc/src/qttest.qdoc
+++ b/src/testlib/doc/src/qttest.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -35,22 +35,6 @@
\brief Provides classes for unit testing Qt applications and libraries.
- Applications that use Qt's unit testing classes need to
- be configured to be built against the Qt Test module.
- To include the definitions of the module's classes, use the
- following directive:
-
- \snippet code/doc_src_qttest.cpp 0
-
- \if !defined(qtforpython)
- To link against the module, add this line to your \l qmake \c
- .pro file:
-
- \snippet code/doc_src_qttest.pro 1
- \endif
-
- See \l{Qt Test Overview} for an introduction on how to use
- Qt's unit testing features with your applications.
-
+ See the \l{Qt Test} page and the \l{Qt Test Overview} guide for further
+ information about using this module in your application.
*/
-