Revision control

++ // Copyright (C) 2026 The Qt Company Ltd.
++ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
++
++ #include "qtopenapigen_common.h"
++
++ using namespace Qt::StringLiterals;
++ namespace QtOpenAPI {
++ #ifndef CMAKE_GENERATOR_TESTS_COMMON
++ # define CMAKE_GENERATOR_TESTS_COMMON
++ #endif
++ constexpr QLatin1StringView CMakeGeneratorTestsCommon(CMAKE_GENERATOR_TESTS_COMMON);
++
++ class QtOpenAPIGeneratorCommonLib : public QObject {
++ Q_OBJECT
++
++ private Q_SLOTS:
++ void initTestCase();
++ void checkVersionIsNotEmpty();
++ void cmakeGeneratedLibraries_data();
++ void cmakeGeneratedLibraries();
++
++ private:
++ QString m_expectedResultPath;
++ QString m_cmakeExpectedResultPath;
++ QString m_cmakeGeneratedPath;
++ };
++
++ void QtOpenAPIGeneratorCommonLib::initTestCase()
++ {
++ m_expectedResultPath = QFINDTESTDATA("data");
++ m_cmakeGeneratedPath = BinaryDir + '/'_L1 + CMakeGeneratedDir;
++ m_cmakeExpectedResultPath = m_expectedResultPath + '/'_L1 + CMakeGeneratedDir;
++ }
++
++ void QtOpenAPIGeneratorCommonLib::checkVersionIsNotEmpty()
++ {
++ QCOMPARE_NE(QT_OPENAPI_GENERATOR_VERSION, "");
++ }
++
++ void QtOpenAPIGeneratorCommonLib::cmakeGeneratedLibraries_data()
++ {
++ QTest::addColumn<QString>("testFolder");
++ QTest::addColumn<QString>("filePath");
++
++ const QStringList tests = QString(CMakeGeneratorTestsCommon).split(','_L1, Qt::SkipEmptyParts);
++ for (const auto &testName : tests) {
++ QDir testDir(m_cmakeExpectedResultPath + '/'_L1 + testName);
++ const auto testFiles = scanDirectoryRecursively(testDir);
++ for (const auto &testFile : testFiles) {
++ auto relativePath = testDir.relativeFilePath(testFile.absoluteFilePath());
++ QTest::addRow("%s: %s", testName.toUtf8().constData(),
++ relativePath.toUtf8().constData())
++ << testName << relativePath;
++ }
++ }
++ }
++
++ void QtOpenAPIGeneratorCommonLib::cmakeGeneratedLibraries()
++ {
++ QFETCH(QString, testFolder);
++ QFETCH(QString, filePath);
++ compareTwoFiles(m_cmakeExpectedResultPath + '/'_L1 + testFolder + '/'_L1 + filePath,
++ m_cmakeGeneratedPath + '/'_L1 + testFolder + '/'_L1 + filePath);
++ }
++
++ } // QtOpenAPI
++
++ QTEST_MAIN(QtOpenAPI::QtOpenAPIGeneratorCommonLib)
++ #include "tst_commonopenapigen.moc"