summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorVenugopal Shivashankar <Venugopal.Shivashankar@qt.io>2021-02-09 13:15:58 +0100
committerVenugopal Shivashankar <Venugopal.Shivashankar@qt.io>2021-02-10 21:19:15 +0100
commit746393545f6e68292b780ea62ea2f6bef81c708c (patch)
treec4df170c7024e917198f560a27682be32daa4300 /src/testlib
parent1549dff04c49aa37333e54f8bc45900d0f35b270 (diff)
CMake: Port the snippet project setup to CMake
Change-Id: I411e58e94752f3b2d0a3e8aac0ab7c4c2272db89 Fixes: QTBUG-89826 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/CMakeLists.txt5
-rw-r--r--src/testlib/doc/snippets/code/CMakeLists.txt26
-rw-r--r--src/testlib/doc/snippets/code/doc_src_qtestevent.cpp8
-rw-r--r--src/testlib/doc/snippets/code/doc_src_qtestevent.h58
-rw-r--r--src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp2
5 files changed, 91 insertions, 8 deletions
diff --git a/src/testlib/CMakeLists.txt b/src/testlib/CMakeLists.txt
index 35f824af49..56ab1eb4c5 100644
--- a/src/testlib/CMakeLists.txt
+++ b/src/testlib/CMakeLists.txt
@@ -133,3 +133,8 @@ qt_internal_add_docs(Test
# special case begin
qt_internal_apply_testlib_coverage_options(Test)
# special case end
+
+# include the snippet projects for developer-builds
+if(QT_FEATURE_private_tests)
+ add_subdirectory(doc/snippets/code)
+endif()
diff --git a/src/testlib/doc/snippets/code/CMakeLists.txt b/src/testlib/doc/snippets/code/CMakeLists.txt
new file mode 100644
index 0000000000..8a244e4dd6
--- /dev/null
+++ b/src/testlib/doc/snippets/code/CMakeLists.txt
@@ -0,0 +1,26 @@
+add_library(testlib_code_snippets OBJECT
+ doc_src_qtqskip.cpp
+ doc_src_qttest.cpp
+ src_corelib_kernel_qtestsupport_core.cpp
+)
+
+target_link_libraries(testlib_code_snippets PRIVATE
+ Qt::Core
+ Qt::Test
+)
+
+qt_internal_extend_target(testlib_code_snippets CONDITION QT_FEATURE_gui AND QT_FEATURE_sql
+ SOURCES
+ doc_src_qtestlib.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::Sql
+)
+
+qt_internal_extend_target(testlib_code_snippets CONDITION QT_FEATURE_widgets
+ SOURCES
+ doc_src_qtestevent.cpp
+ doc_src_qtestevent.h
+ PUBLIC_LIBRARIES
+ Qt::Widgets
+)
diff --git a/src/testlib/doc/snippets/code/doc_src_qtestevent.cpp b/src/testlib/doc/snippets/code/doc_src_qtestevent.cpp
index 1d91ebd644..a987cf79fb 100644
--- a/src/testlib/doc/snippets/code/doc_src_qtestevent.cpp
+++ b/src/testlib/doc/snippets/code/doc_src_qtestevent.cpp
@@ -51,13 +51,7 @@
#include <QTest>
#include <QLineEdit>
-// dummy
-class TestGui: public QObject
-{
- Q_OBJECT
-public:
- void testGui_data();
-};
+#include "doc_src_qtestevent.h"
void TestGui::testGui_data()
{
diff --git a/src/testlib/doc/snippets/code/doc_src_qtestevent.h b/src/testlib/doc/snippets/code/doc_src_qtestevent.h
new file mode 100644
index 0000000000..af2bf607f1
--- /dev/null
+++ b/src/testlib/doc/snippets/code/doc_src_qtestevent.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QObject>
+
+// dummy
+class TestGui: public QObject
+{
+ Q_OBJECT
+public:
+ void testGui_data();
+};
diff --git a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
index 01f4e11eb4..ceb2743141 100644
--- a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
+++ b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
@@ -49,7 +49,7 @@
****************************************************************************/
#include <QTest>
#include <QSqlDatabase>
-#include <QtGui/qfontdatabase.h>
+#include <QFontDatabase>
#include <initializer_list>