diff options
Diffstat (limited to 'tests')
6 files changed, 60 insertions, 0 deletions
diff --git a/tests/auto/qtattributionsscanner/CMakeLists.txt b/tests/auto/qtattributionsscanner/CMakeLists.txt index 24d512afe..da5257fd2 100644 --- a/tests/auto/qtattributionsscanner/CMakeLists.txt +++ b/tests/auto/qtattributionsscanner/CMakeLists.txt @@ -9,5 +9,9 @@ qt_internal_add_test(tst_qtattributionsscanner tst_qtattributionsscanner.cpp ) +target_compile_definitions(tst_qtattributionsscanner + PRIVATE QTTOOLS_LICENSES_DIR="${CMAKE_CURRENT_SOURCE_DIR}/../../../LICENSES" +) + #### Keys ignored in scope 1:.:.:qtattributionsscanner.pro:<TRUE>: # DISTFILES = "testdata/good/expected.json" "testdata/good/expected.error" "testdata/good/minimal/qt_attribution_test.json" "testdata/good/minimal/expected.json" "testdata/good/minimal/expected.error" "testdata/good/complete/qt_attribution_test.json" "testdata/good/complete/expected.json" "testdata/good/complete/expected.error" "testdata/good/variants/qt_attribution_test.json" "testdata/good/variants/expected.json" "testdata/good/variants/expected.error" "testdata/warnings/incomplete/qt_attribution_test.json" "testdata/warnings/incomplete/expected.json" "testdata/warnings/incomplete/expected.error" "testdata/warnings/unknown/qt_attribution_test.json" "testdata/warnings/unknown/expected.json" "testdata/warnings/unknown/expected.error" diff --git a/tests/auto/qtattributionsscanner/testdata/good/expected.json b/tests/auto/qtattributionsscanner/testdata/good/expected.json index 24bcdaa0f..f5d5fa5d2 100644 --- a/tests/auto/qtattributionsscanner/testdata/good/expected.json +++ b/tests/auto/qtattributionsscanner/testdata/good/expected.json @@ -48,6 +48,27 @@ "DownloadLocation": "", "Files": "", "Homepage": "", + "Id": "licenses-dir", + "License": "BSD 3-Clause \"New\" or \"Revised\" License", + "LicenseFile": "%{LICENSES_DIR}/BSD-3-Clause.txt", + "LicenseId": "BSD-3-Clause", + "Name": "LicensesDir", + "PackageComment": "", + "Path": "%{PWD}/licenses-dir", + "QDocModule": "qtest", + "QtParts": [ + "libs" + ], + "QtUsage": "Usage", + "Version": "" + }, + { + "Copyright": "Copyright", + "CopyrightFile": "", + "Description": "", + "DownloadLocation": "", + "Files": "", + "Homepage": "", "Id": "minimal", "License": "License", "LicenseFile": "", diff --git a/tests/auto/qtattributionsscanner/testdata/good/licenses-dir/expected.error b/tests/auto/qtattributionsscanner/testdata/good/licenses-dir/expected.error new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/auto/qtattributionsscanner/testdata/good/licenses-dir/expected.error diff --git a/tests/auto/qtattributionsscanner/testdata/good/licenses-dir/expected.json b/tests/auto/qtattributionsscanner/testdata/good/licenses-dir/expected.json new file mode 100644 index 000000000..1e808b008 --- /dev/null +++ b/tests/auto/qtattributionsscanner/testdata/good/licenses-dir/expected.json @@ -0,0 +1,23 @@ +[ + { + "Copyright": "Copyright", + "CopyrightFile": "", + "Description": "", + "DownloadLocation": "", + "Files": "", + "Homepage": "", + "Id": "licenses-dir", + "License": "BSD 3-Clause \"New\" or \"Revised\" License", + "LicenseFile": "%{LICENSES_DIR}/BSD-3-Clause.txt", + "LicenseId": "BSD-3-Clause", + "Name": "LicensesDir", + "PackageComment": "", + "Path": "%{PWD}", + "QDocModule": "qtest", + "QtParts": [ + "libs" + ], + "QtUsage": "Usage", + "Version": "" + } +] diff --git a/tests/auto/qtattributionsscanner/testdata/good/licenses-dir/qt_attribution_test.json b/tests/auto/qtattributionsscanner/testdata/good/licenses-dir/qt_attribution_test.json new file mode 100644 index 000000000..bf3f0658f --- /dev/null +++ b/tests/auto/qtattributionsscanner/testdata/good/licenses-dir/qt_attribution_test.json @@ -0,0 +1,9 @@ +{ + "Id": "licenses-dir", + "Name": "LicensesDir", + "QDocModule": "qtest", + "QtUsage": "Usage", + "License": "BSD 3-Clause \"New\" or \"Revised\" License", + "LicenseId": "BSD-3-Clause", + "Copyright": "Copyright" +} diff --git a/tests/auto/qtattributionsscanner/tst_qtattributionsscanner.cpp b/tests/auto/qtattributionsscanner/tst_qtattributionsscanner.cpp index 7fafc93d1..f2f04ed98 100644 --- a/tests/auto/qtattributionsscanner/tst_qtattributionsscanner.cpp +++ b/tests/auto/qtattributionsscanner/tst_qtattributionsscanner.cpp @@ -67,6 +67,9 @@ void tst_qtattributionsscanner::readExpectedFile(const QString &baseDir, const Q QVERIFY2(file.open(QIODevice::ReadOnly | QIODevice::Text), "Could not open " + file.fileName().toLocal8Bit()); *content = file.readAll(); content->replace("%{PWD}", baseDir.toUtf8()); + + QDir licensesDir(QStringLiteral(QTTOOLS_LICENSES_DIR)); + content->replace("%{LICENSES_DIR}", licensesDir.canonicalPath().toUtf8()); } void tst_qtattributionsscanner::test() |