summaryrefslogtreecommitdiffstats
path: root/tests/auto/qdoc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qdoc')
-rw-r--r--tests/auto/qdoc/config/testdata/configs/exampletest.qdocconf2
-rw-r--r--tests/auto/qdoc/config/testdata/exampletest/examples/test/empty/test.pro1
-rw-r--r--tests/auto/qdoc/config/testdata/exampletest/examples/test/example1/example1.pro1
-rw-r--r--tests/auto/qdoc/config/testdata/exampletest/examples/test/example2/example2.qmlproject1
-rw-r--r--tests/auto/qdoc/config/testdata/exampletest/examples/test/example3/example3.pyproject1
-rw-r--r--tests/auto/qdoc/config/testdata/exampletest/examples/test/example4/CMakeLists.txt1
-rw-r--r--tests/auto/qdoc/config/tst_config.cpp29
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/examples-manifest.xml5
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/test-cmaketest-example.html22
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/test.qhp4
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/configs/testqml.qdocconf2
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/qml/cmaketest/CMakeLists.txt2
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/qml/cmaketest/doc/src/cmaketest.qdoc32
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/qml/cmaketest/main.cpp1
-rw-r--r--tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp1
15 files changed, 104 insertions, 1 deletions
diff --git a/tests/auto/qdoc/config/testdata/configs/exampletest.qdocconf b/tests/auto/qdoc/config/testdata/configs/exampletest.qdocconf
new file mode 100644
index 000000000..a1459f977
--- /dev/null
+++ b/tests/auto/qdoc/config/testdata/configs/exampletest.qdocconf
@@ -0,0 +1,2 @@
+project = ExampleTest
+exampledirs = ../exampletest/examples
diff --git a/tests/auto/qdoc/config/testdata/exampletest/examples/test/empty/test.pro b/tests/auto/qdoc/config/testdata/exampletest/examples/test/empty/test.pro
new file mode 100644
index 000000000..556df42ea
--- /dev/null
+++ b/tests/auto/qdoc/config/testdata/exampletest/examples/test/empty/test.pro
@@ -0,0 +1 @@
+# nothing
diff --git a/tests/auto/qdoc/config/testdata/exampletest/examples/test/example1/example1.pro b/tests/auto/qdoc/config/testdata/exampletest/examples/test/example1/example1.pro
new file mode 100644
index 000000000..556df42ea
--- /dev/null
+++ b/tests/auto/qdoc/config/testdata/exampletest/examples/test/example1/example1.pro
@@ -0,0 +1 @@
+# nothing
diff --git a/tests/auto/qdoc/config/testdata/exampletest/examples/test/example2/example2.qmlproject b/tests/auto/qdoc/config/testdata/exampletest/examples/test/example2/example2.qmlproject
new file mode 100644
index 000000000..556df42ea
--- /dev/null
+++ b/tests/auto/qdoc/config/testdata/exampletest/examples/test/example2/example2.qmlproject
@@ -0,0 +1 @@
+# nothing
diff --git a/tests/auto/qdoc/config/testdata/exampletest/examples/test/example3/example3.pyproject b/tests/auto/qdoc/config/testdata/exampletest/examples/test/example3/example3.pyproject
new file mode 100644
index 000000000..556df42ea
--- /dev/null
+++ b/tests/auto/qdoc/config/testdata/exampletest/examples/test/example3/example3.pyproject
@@ -0,0 +1 @@
+# nothing
diff --git a/tests/auto/qdoc/config/testdata/exampletest/examples/test/example4/CMakeLists.txt b/tests/auto/qdoc/config/testdata/exampletest/examples/test/example4/CMakeLists.txt
new file mode 100644
index 000000000..556df42ea
--- /dev/null
+++ b/tests/auto/qdoc/config/testdata/exampletest/examples/test/example4/CMakeLists.txt
@@ -0,0 +1 @@
+# nothing
diff --git a/tests/auto/qdoc/config/tst_config.cpp b/tests/auto/qdoc/config/tst_config.cpp
index 1e9383fb9..44a1ba953 100644
--- a/tests/auto/qdoc/config/tst_config.cpp
+++ b/tests/auto/qdoc/config/tst_config.cpp
@@ -28,6 +28,8 @@
#include "config.h"
+#include <QtCore/qdir.h>
+#include <QtCore/qfileinfo.h>
#include <QtCore/qhash.h>
#include <QtCore/qstringlist.h>
#include <QtTest/QtTest>
@@ -43,6 +45,7 @@ class tst_Config : public QObject
private slots:
void classMembersInitializeToFalseOrEmpty();
void includePathsFromCommandLine();
+ void getExampleProjectFile();
};
void tst_Config::classMembersInitializeToFalseOrEmpty()
@@ -80,6 +83,32 @@ void tst_Config::includePathsFromCommandLine()
QCOMPARE(actual, expected);
}
+void::tst_Config::getExampleProjectFile()
+{
+ QStringList commandLineArgs = { QStringLiteral("./qdoc") };
+ Config::instance().init("QDoc Test", commandLineArgs);
+ auto &config = Config::instance();
+
+ const auto docConfig = QFINDTESTDATA("/testdata/configs/exampletest.qdocconf");
+ config.load(docConfig);
+
+ auto rootDir = QFileInfo(docConfig).dir();
+ QVERIFY(rootDir.cd("../exampletest/examples/test"));
+
+ QVERIFY(config.getExampleProjectFile("invalid").isEmpty());
+ QVERIFY(config.getExampleProjectFile("test/empty").isEmpty());
+
+ QCOMPARE(config.getExampleProjectFile("test/example1"),
+ rootDir.absoluteFilePath("example1/example1.pro"));
+ QCOMPARE(config.getExampleProjectFile("test/example2"),
+ rootDir.absoluteFilePath("example2/example2.qmlproject"));
+ QCOMPARE(config.getExampleProjectFile("test/example3"),
+ rootDir.absoluteFilePath("example3/example3.pyproject"));
+ QCOMPARE(config.getExampleProjectFile("test/example4"),
+ rootDir.absoluteFilePath("example4/CMakeLists.txt"));
+}
+
+
QTEST_APPLESS_MAIN(tst_Config)
#include "tst_config.moc"
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/examples-manifest.xml b/tests/auto/qdoc/generatedoutput/expected_output/examples-manifest.xml
index 7f206d0e8..8aa9ce303 100644
--- a/tests/auto/qdoc/generatedoutput/expected_output/examples-manifest.xml
+++ b/tests/auto/qdoc/generatedoutput/expected_output/examples-manifest.xml
@@ -1,6 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<instructionals module="Test">
<examples>
+ <example name="CMake Example Project" docUrl="qthelp://org.qt-project.test.001/test/test-cmaketest-example.html" projectPath="test/cmaketest/CMakeLists.txt" isTest="true">
+ <description><![CDATA[No description available]]></description>
+ <tags>cmake,project,test</tags>
+ <fileToOpen mainFile="true">test/cmaketest/main.cpp</fileToOpen>
+ </example>
<example name="QML Documentation Example" docUrl="qthelp://org.qt-project.test.001/test/test-componentset-example.html" projectPath="tutorials/componentset/componentset.pro" isTest="true">
<description><![CDATA[Example for documenting QML types.]]></description>
<tags>documentation,qml,sample,test</tags>
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/test-cmaketest-example.html b/tests/auto/qdoc/generatedoutput/expected_output/test-cmaketest-example.html
new file mode 100644
index 000000000..dc123674d
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/expected_output/test-cmaketest-example.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+<!-- cmaketest.qdoc -->
+ <title>CMake Example Project | Test</title>
+</head>
+<body>
+<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div>
+<h1 class="title">CMake Example Project</h1>
+<span class="subtitle"></span>
+<!-- $$$cmaketest-description -->
+<div class="descr"> <a name="details"></a>
+<p>Files:</p>
+<ul>
+<li><a href="test-cmaketest-cmakelists-txt.html">cmaketest/CMakeLists.txt</a></li>
+<li><a href="test-cmaketest-main-cpp.html">cmaketest/main.cpp</a></li>
+</ul>
+</div>
+<!-- @@@cmaketest -->
+</body>
+</html>
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/test.qhp b/tests/auto/qdoc/generatedoutput/expected_output/test.qhp
index 4816ef1d5..459892df1 100644
--- a/tests/auto/qdoc/generatedoutput/expected_output/test.qhp
+++ b/tests/auto/qdoc/generatedoutput/expected_output/test.qhp
@@ -8,6 +8,7 @@
<section ref="uicomponents-qmlmodule.html" title="UI Components">
<section ref="uicomponents-qmlmodule.html" title="Test">
<section ref="qdoc-test-qmlmodule.html" title=""/>
+ <section ref="test-cmaketest-example.html" title="CMake Example Project"/>
<section ref="testcpp-module.html" title="QDoc Test C++ Classes"/>
<section ref="test-componentset-example.html" title="QML Documentation Example"/>
<section ref="uicomponents-qmlmodule.html" title="UI Components"/>
@@ -119,6 +120,9 @@
<file>qml-uicomponents-switch.html</file>
<file>qml-uicomponents-tabwidget-members.html</file>
<file>qml-uicomponents-tabwidget.html</file>
+ <file>test-cmaketest-cmakelists-txt.html</file>
+ <file>test-cmaketest-example.html</file>
+ <file>test-cmaketest-main-cpp.html</file>
<file>test-componentset-componentset-pro.html</file>
<file>test-componentset-example.html</file>
<file>test-componentset-progressbar-qml.html</file>
diff --git a/tests/auto/qdoc/generatedoutput/testdata/configs/testqml.qdocconf b/tests/auto/qdoc/generatedoutput/testdata/configs/testqml.qdocconf
index 2eb2c5036..8eec4ea4d 100644
--- a/tests/auto/qdoc/generatedoutput/testdata/configs/testqml.qdocconf
+++ b/tests/auto/qdoc/generatedoutput/testdata/configs/testqml.qdocconf
@@ -16,7 +16,7 @@ excludedirs = ../bug80259
sources.fileextensions = "*.qml *.cpp *.qdoc"
headers.fileextensions = "*.h"
-examples.fileextensions = "*.qml"
+examples.fileextensions = "*.qml *.cpp"
macro.begincomment = "\\c{/*}"
macro.QDocTestVer = "1.1"
diff --git a/tests/auto/qdoc/generatedoutput/testdata/qml/cmaketest/CMakeLists.txt b/tests/auto/qdoc/generatedoutput/testdata/qml/cmaketest/CMakeLists.txt
new file mode 100644
index 000000000..c6a5c654b
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/testdata/qml/cmaketest/CMakeLists.txt
@@ -0,0 +1,2 @@
+cmake_minimum_required (VERSION 2.8.11)
+project (QDOCTEST)
diff --git a/tests/auto/qdoc/generatedoutput/testdata/qml/cmaketest/doc/src/cmaketest.qdoc b/tests/auto/qdoc/generatedoutput/testdata/qml/cmaketest/doc/src/cmaketest.qdoc
new file mode 100644
index 000000000..13767e147
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/testdata/qml/cmaketest/doc/src/cmaketest.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 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$
+**
+****************************************************************************/
+
+/*!
+ \example cmaketest
+ \title CMake Example Project
+*/
diff --git a/tests/auto/qdoc/generatedoutput/testdata/qml/cmaketest/main.cpp b/tests/auto/qdoc/generatedoutput/testdata/qml/cmaketest/main.cpp
new file mode 100644
index 000000000..68d71eb71
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/testdata/qml/cmaketest/main.cpp
@@ -0,0 +1 @@
+void main(){}
diff --git a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp
index ead94584a..b3c69af71 100644
--- a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp
+++ b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp
@@ -204,6 +204,7 @@ void tst_generatedOutput::htmlFromQml()
{
testAndCompare("testdata/configs/testqml.qdocconf",
"test-componentset-example.html "
+ "test-cmaketest-example.html "
"uicomponents-qmlmodule.html "
"qdoc-test-qmlmodule.html "
"qml-qdoc-test-abstractparent.html "