summaryrefslogtreecommitdiffstats
path: root/tests/auto/qdoc/config/tst_config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qdoc/config/tst_config.cpp')
-rw-r--r--tests/auto/qdoc/config/tst_config.cpp29
1 files changed, 29 insertions, 0 deletions
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"