File indexing completed on 2024-04-14 14:19:06

0001 /*
0002     SPDX-FileCopyrightText: 2008 Friedrich W. H. Kossebau <kossebau@kde.org>
0003     SPDX-FileCopyrightText: 2017 Harald Sitter <sitter@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only
0006 */
0007 
0008 // test object
0009 #include <kaboutdata.h>
0010 // Qt
0011 #include <QFile>
0012 #include <QLatin1String>
0013 #include <QObject>
0014 #include <QTest>
0015 #include <QTextStream>
0016 #ifndef Q_OS_WIN
0017 void initLocale()
0018 {
0019     qputenv("LC_ALL", "en_US.utf-8");
0020 }
0021 
0022 Q_CONSTRUCTOR_FUNCTION(initLocale)
0023 #endif
0024 
0025 class KAboutDataTest : public QObject
0026 {
0027     Q_OBJECT
0028 
0029 private Q_SLOTS:
0030     void testLongFormConstructorWithDefaults();
0031     void testLongFormConstructor();
0032     void testShortFormConstructor();
0033     void testSetAddLicense();
0034 #if KCOREADDONS_ENABLE_DEPRECATED_SINCE(5, 2)
0035     void testSetProgramIconName();
0036 #endif
0037     void testSetDesktopFileName();
0038     void testCopying();
0039 
0040     void testKAboutDataOrganizationDomain();
0041 
0042     void testLicenseSPDXID();
0043     void testLicenseOrLater();
0044 
0045     void testProductName();
0046 };
0047 
0048 static const char AppName[] = "app";
0049 static const char ProgramName[] = "ProgramName";
0050 #if KCOREADDONS_ENABLE_DEPRECATED_SINCE(5, 2)
0051 static const char ProgramIconName[] = "program-icon";
0052 #endif
0053 static const char Version[] = "Version";
0054 static const char ShortDescription[] = "ShortDescription";
0055 static const char CopyrightStatement[] = "CopyrightStatement";
0056 static const char Text[] = "Text";
0057 static const char HomePageAddress[] = "http://test.no.where/";
0058 static const char HomePageSecure[] = "https://test.no.where/";
0059 static const char OrganizationDomain[] = "no.where";
0060 static const char BugsEmailAddress[] = "bugs@no.else";
0061 static const char LicenseText[] = "free to write, reading forbidden";
0062 static const char LicenseFileName[] = "testlicensefile";
0063 static const char LicenseFileText[] = "free to write, reading forbidden, in the file";
0064 
0065 void KAboutDataTest::testLongFormConstructorWithDefaults()
0066 {
0067     KAboutData aboutData(QString::fromLatin1(AppName),
0068                          QLatin1String(ProgramName),
0069                          QString::fromLatin1(Version),
0070                          QLatin1String(ShortDescription),
0071                          KAboutLicense::Unknown);
0072 
0073     QCOMPARE(aboutData.componentName(), QString::fromLatin1(AppName));
0074     QCOMPARE(aboutData.productName(), QString::fromLatin1(AppName));
0075     QCOMPARE(aboutData.displayName(), QLatin1String(ProgramName));
0076 #if KCOREADDONS_ENABLE_DEPRECATED_SINCE(5, 2)
0077     QCOMPARE(aboutData.programIconName(), QString::fromLatin1(AppName));
0078 #endif
0079     QCOMPARE(aboutData.programLogo(), QVariant());
0080     QCOMPARE(aboutData.organizationDomain(), QString::fromLatin1("kde.org"));
0081     QCOMPARE(aboutData.version(), QString::fromLatin1(Version));
0082     QCOMPARE(aboutData.homepage(), QString());
0083     QCOMPARE(aboutData.bugAddress(), QString::fromLatin1("submit@bugs.kde.org"));
0084     QVERIFY(aboutData.authors().isEmpty());
0085     QVERIFY(aboutData.credits().isEmpty());
0086     QVERIFY(aboutData.translators().isEmpty());
0087     QCOMPARE(aboutData.otherText(), QString());
0088     QCOMPARE(aboutData.licenses().count(), 1);
0089     // We don't know the default text, do we?
0090     //     QCOMPARE( aboutData.licenses().at(0).name(KAboutLicense::ShortName), QString(WarningText) );
0091     QVERIFY(!aboutData.licenses().at(0).name(KAboutLicense::ShortName).isEmpty());
0092     //     QCOMPARE( aboutData.licenses().at(0).name(KAboutLicense::FullName), QString(WarningText) );
0093     QVERIFY(!aboutData.licenses().at(0).name(KAboutLicense::FullName).isEmpty());
0094     //     QCOMPARE( aboutData.licenses().at(0).text(), QString(WarningText) );
0095     QVERIFY(!aboutData.licenses().at(0).text().isEmpty());
0096     QCOMPARE(aboutData.copyrightStatement(), QString());
0097     QCOMPARE(aboutData.shortDescription(), (QLatin1String(ShortDescription)));
0098     QCOMPARE(aboutData.customAuthorPlainText(), QString());
0099     QCOMPARE(aboutData.customAuthorRichText(), QString());
0100     QVERIFY(!aboutData.customAuthorTextEnabled());
0101     QCOMPARE(aboutData.desktopFileName(), QStringLiteral("org.kde.app"));
0102 
0103     QCOMPARE(aboutData.internalVersion(), Version);
0104     QCOMPARE(aboutData.internalProgramName(), ProgramName);
0105     QCOMPARE(aboutData.internalBugAddress(), "submit@bugs.kde.org");
0106     QCOMPARE(aboutData.internalProductName(), nullptr);
0107 }
0108 
0109 void KAboutDataTest::testLongFormConstructor()
0110 {
0111     KAboutData aboutData(QString::fromLatin1(AppName),
0112                          QLatin1String(ProgramName),
0113                          QString::fromLatin1(Version),
0114                          QLatin1String(ShortDescription),
0115                          KAboutLicense::Unknown,
0116                          QLatin1String(CopyrightStatement),
0117                          QLatin1String(Text),
0118                          QString::fromLatin1(HomePageAddress),
0119                          QString::fromLatin1(BugsEmailAddress));
0120 
0121     QCOMPARE(aboutData.componentName(), QLatin1String(AppName));
0122     QCOMPARE(aboutData.productName(), QLatin1String(AppName));
0123     QCOMPARE(aboutData.displayName(), QLatin1String(ProgramName));
0124 #if KCOREADDONS_ENABLE_DEPRECATED_SINCE(5, 2)
0125     QCOMPARE(aboutData.programIconName(), QLatin1String(AppName));
0126 #endif
0127     QCOMPARE(aboutData.programLogo(), QVariant());
0128     QCOMPARE(aboutData.organizationDomain(), QString::fromLatin1(OrganizationDomain));
0129     QCOMPARE(aboutData.version(), QString::fromLatin1(Version));
0130     QCOMPARE(aboutData.homepage(), QString::fromLatin1(HomePageAddress));
0131     QCOMPARE(aboutData.bugAddress(), QString::fromLatin1(BugsEmailAddress));
0132     QVERIFY(aboutData.authors().isEmpty());
0133     QVERIFY(aboutData.credits().isEmpty());
0134     QVERIFY(aboutData.translators().isEmpty());
0135     QCOMPARE(aboutData.otherText(), QLatin1String(Text));
0136     QCOMPARE(aboutData.licenses().count(), 1);
0137     // We don't know the default text, do we?
0138     //     QCOMPARE( aboutData.licenses().at(0).name(KAboutLicense::ShortName), QString(WarningText) );
0139     QVERIFY(!aboutData.licenses().at(0).name(KAboutLicense::ShortName).isEmpty());
0140     //     QCOMPARE( aboutData.licenses().at(0).name(KAboutLicense::FullName), QString(WarningText) );
0141     QVERIFY(!aboutData.licenses().at(0).name(KAboutLicense::FullName).isEmpty());
0142     //     QCOMPARE( aboutData.licenses().at(0).text(), QString(WarningText) );
0143     QVERIFY(!aboutData.licenses().at(0).text().isEmpty());
0144     QCOMPARE(aboutData.copyrightStatement(), QLatin1String(CopyrightStatement));
0145     QCOMPARE(aboutData.shortDescription(), QLatin1String(ShortDescription));
0146     QCOMPARE(aboutData.customAuthorPlainText(), QString());
0147     QCOMPARE(aboutData.customAuthorRichText(), QString());
0148     QVERIFY(!aboutData.customAuthorTextEnabled());
0149     QCOMPARE(aboutData.desktopFileName(), QStringLiteral("where.no.app"));
0150 
0151     QCOMPARE(aboutData.internalVersion(), Version);
0152     QCOMPARE(aboutData.internalProgramName(), ProgramName);
0153     QCOMPARE(aboutData.internalBugAddress(), BugsEmailAddress);
0154     QCOMPARE(aboutData.internalProductName(), nullptr);
0155 
0156     // We support http and https protocols on the homepage address, ensure they
0157     // give the same org. domain and desktop file name.
0158     KAboutData aboutDataSecure(QString::fromLatin1(AppName),
0159                                QLatin1String(ProgramName),
0160                                QString::fromLatin1(Version),
0161                                QLatin1String(ShortDescription),
0162                                KAboutLicense::Unknown,
0163                                QLatin1String(CopyrightStatement),
0164                                QLatin1String(Text),
0165                                QString::fromLatin1(HomePageSecure),
0166                                QString::fromLatin1(BugsEmailAddress));
0167     QCOMPARE(aboutDataSecure.componentName(), QLatin1String(AppName));
0168     QCOMPARE(aboutDataSecure.productName(), QLatin1String(AppName));
0169     QCOMPARE(aboutDataSecure.organizationDomain(), QString::fromLatin1(OrganizationDomain));
0170     QCOMPARE(aboutDataSecure.desktopFileName(), QStringLiteral("where.no.app"));
0171 }
0172 
0173 void KAboutDataTest::testShortFormConstructor()
0174 {
0175     KAboutData aboutData(QString::fromLatin1(AppName), QLatin1String(ProgramName), QString::fromLatin1(Version));
0176 
0177     QCOMPARE(aboutData.componentName(), QString::fromLatin1(AppName));
0178     QCOMPARE(aboutData.productName(), QString::fromLatin1(AppName));
0179     QCOMPARE(aboutData.displayName(), QLatin1String(ProgramName));
0180 #if KCOREADDONS_ENABLE_DEPRECATED_SINCE(5, 2)
0181     QCOMPARE(aboutData.programIconName(), QString::fromLatin1(AppName));
0182 #endif
0183     QCOMPARE(aboutData.programLogo(), QVariant());
0184     QCOMPARE(aboutData.organizationDomain(), QString::fromLatin1("kde.org"));
0185     QCOMPARE(aboutData.version(), QString::fromLatin1(Version));
0186     QCOMPARE(aboutData.homepage(), QString());
0187     QCOMPARE(aboutData.bugAddress(), QString::fromLatin1("submit@bugs.kde.org"));
0188     QVERIFY(aboutData.authors().isEmpty());
0189     QVERIFY(aboutData.credits().isEmpty());
0190     QVERIFY(aboutData.translators().isEmpty());
0191     QCOMPARE(aboutData.otherText(), QString());
0192     QCOMPARE(aboutData.licenses().count(), 1);
0193     // We don't know the default text, do we?
0194     //     QCOMPARE( aboutData.licenses().at(0).name(KAboutLicense::ShortName), QString(WarningText) );
0195     QVERIFY(!aboutData.licenses().at(0).name(KAboutLicense::ShortName).isEmpty());
0196     //     QCOMPARE( aboutData.licenses().at(0).name(KAboutLicense::FullName), QString(WarningText) );
0197     QVERIFY(!aboutData.licenses().at(0).name(KAboutLicense::FullName).isEmpty());
0198     //     QCOMPARE( aboutData.licenses().at(0).text(), QString(WarningText) );
0199     QVERIFY(!aboutData.licenses().at(0).text().isEmpty());
0200     QCOMPARE(aboutData.copyrightStatement(), QString());
0201     QCOMPARE(aboutData.shortDescription(), QString());
0202     QCOMPARE(aboutData.customAuthorPlainText(), QString());
0203     QCOMPARE(aboutData.customAuthorRichText(), QString());
0204     QVERIFY(!aboutData.customAuthorTextEnabled());
0205     QCOMPARE(aboutData.desktopFileName(), QStringLiteral("org.kde.app"));
0206 
0207     QCOMPARE(aboutData.internalVersion(), Version);
0208     QCOMPARE(aboutData.internalProgramName(), ProgramName);
0209     QCOMPARE(aboutData.internalBugAddress(), "submit@bugs.kde.org");
0210     QCOMPARE(aboutData.internalProductName(), nullptr);
0211 }
0212 
0213 void KAboutDataTest::testKAboutDataOrganizationDomain()
0214 {
0215     KAboutData data(QString::fromLatin1("app"),
0216                     QLatin1String("program"),
0217                     QString::fromLatin1("version"),
0218                     QLatin1String("description"),
0219                     KAboutLicense::LGPL,
0220                     QLatin1String("copyright"),
0221                     QLatin1String("hello world"),
0222                     QStringLiteral("http://www.koffice.org"));
0223     QCOMPARE(data.organizationDomain(), QString::fromLatin1("koffice.org"));
0224     QCOMPARE(data.desktopFileName(), QStringLiteral("org.koffice.app"));
0225 
0226     KAboutData data2(QString::fromLatin1("app"),
0227                      QLatin1String("program"),
0228                      QString::fromLatin1("version"),
0229                      QLatin1String("description"),
0230                      KAboutLicense::LGPL,
0231                      QString::fromLatin1("copyright"),
0232                      QLatin1String("hello world"),
0233                      QStringLiteral("app"));
0234     QCOMPARE(data2.organizationDomain(), QString::fromLatin1("kde.org"));
0235     QCOMPARE(data2.desktopFileName(), QStringLiteral("org.kde.app"));
0236 }
0237 
0238 void KAboutDataTest::testSetAddLicense()
0239 {
0240     // prepare a file with a license text
0241     QFile licenseFile(QString::fromLatin1(LicenseFileName));
0242     licenseFile.open(QIODevice::WriteOnly);
0243     QTextStream licenseFileStream(&licenseFile);
0244     licenseFileStream << LicenseFileText;
0245     licenseFile.close();
0246 
0247     const QString copyrightStatement = QLatin1String(CopyrightStatement);
0248     const QString lineFeed = QString::fromLatin1("\n\n");
0249 
0250     KAboutData aboutData(QString::fromLatin1(AppName),
0251                          QLatin1String(ProgramName),
0252                          QString::fromLatin1(Version),
0253                          QLatin1String(ShortDescription),
0254                          KAboutLicense::Unknown,
0255                          QLatin1String(CopyrightStatement),
0256                          QLatin1String(Text),
0257                          QString::fromLatin1(HomePageAddress),
0258                          QString::fromLatin1(BugsEmailAddress));
0259 
0260     // set to GPL2
0261     aboutData.setLicense(KAboutLicense::GPL_V2);
0262 
0263     QCOMPARE(aboutData.licenses().count(), 1);
0264     QCOMPARE(aboutData.licenses().at(0).name(KAboutLicense::ShortName), QString::fromLatin1("GPL v2"));
0265     QCOMPARE(aboutData.licenses().at(0).name(KAboutLicense::FullName), QString::fromLatin1("GNU General Public License Version 2"));
0266     //     QCOMPARE( aboutData.licenses().at(0).text(), QString(GPL2Text) );
0267     QVERIFY(!aboutData.licenses().at(0).text().isEmpty());
0268 
0269     // set to Unknown again
0270     aboutData.setLicense(KAboutLicense::Unknown);
0271 
0272     QCOMPARE(aboutData.licenses().count(), 1);
0273     // We don't know the default text, do we?
0274     //     QCOMPARE( aboutData.licenses().at(0).name(KAboutLicense::ShortName), QString(WarningText) );
0275     QVERIFY(!aboutData.licenses().at(0).name(KAboutLicense::ShortName).isEmpty());
0276     //     QCOMPARE( aboutData.licenses().at(0).name(KAboutLicense::FullName), QString(WarningText) );
0277     QVERIFY(!aboutData.licenses().at(0).name(KAboutLicense::FullName).isEmpty());
0278     //     QCOMPARE( aboutData.licenses().at(0).text(), QString(WarningText) );
0279     QVERIFY(!aboutData.licenses().at(0).text().isEmpty());
0280 
0281     // add GPL3
0282     aboutData.addLicense(KAboutLicense::GPL_V3);
0283 
0284     QCOMPARE(aboutData.licenses().count(), 1);
0285     QCOMPARE(aboutData.licenses().at(0).name(KAboutLicense::ShortName), QString::fromLatin1("GPL v3"));
0286     QCOMPARE(aboutData.licenses().at(0).name(KAboutLicense::FullName), QString::fromLatin1("GNU General Public License Version 3"));
0287     //     QCOMPARE( aboutData.licenses().at(0).text(), QString(GPL3Text) );
0288     QVERIFY(!aboutData.licenses().at(0).text().isEmpty());
0289 
0290     // add GPL2, Custom and File
0291     aboutData.addLicense(KAboutLicense::GPL_V2);
0292     aboutData.addLicenseText(QLatin1String(LicenseText));
0293     aboutData.addLicenseTextFile(QLatin1String(LicenseFileName));
0294 
0295     QCOMPARE(aboutData.licenses().count(), 4);
0296     QCOMPARE(aboutData.licenses().at(0).name(KAboutLicense::ShortName), QString::fromLatin1("GPL v3"));
0297     QCOMPARE(aboutData.licenses().at(0).name(KAboutLicense::FullName), QString::fromLatin1("GNU General Public License Version 3"));
0298     //     QCOMPARE( aboutData.licenses().at(0).text(), QString(GPL3Text) );
0299     QVERIFY(!aboutData.licenses().at(0).text().isEmpty());
0300     QCOMPARE(aboutData.licenses().at(1).name(KAboutLicense::ShortName), QString::fromLatin1("GPL v2"));
0301     QCOMPARE(aboutData.licenses().at(1).name(KAboutLicense::FullName), QString::fromLatin1("GNU General Public License Version 2"));
0302     //     QCOMPARE( aboutData.licenses().at(1).text(), QString(GPL2Text) );
0303     QVERIFY(!aboutData.licenses().at(1).text().isEmpty());
0304     QCOMPARE(aboutData.licenses().at(2).name(KAboutLicense::ShortName), QString::fromLatin1("Custom"));
0305     QCOMPARE(aboutData.licenses().at(2).name(KAboutLicense::FullName), QString::fromLatin1("Custom"));
0306     QCOMPARE(aboutData.licenses().at(2).text(), QLatin1String(LicenseText));
0307     QCOMPARE(aboutData.licenses().at(3).name(KAboutLicense::ShortName), QString::fromLatin1("Custom"));
0308     QCOMPARE(aboutData.licenses().at(3).name(KAboutLicense::FullName), QString::fromLatin1("Custom"));
0309     QCOMPARE(aboutData.licenses().at(3).text(), QString(copyrightStatement + lineFeed + QLatin1String(LicenseFileText)));
0310 }
0311 
0312 #if KCOREADDONS_ENABLE_DEPRECATED_SINCE(5, 2)
0313 void KAboutDataTest::testSetProgramIconName()
0314 {
0315     const QString programIconName(QString::fromLatin1(ProgramIconName));
0316 
0317     KAboutData aboutData(QString::fromLatin1(AppName),
0318                          QLatin1String(ProgramName),
0319                          QString::fromLatin1(Version),
0320                          QLatin1String(ShortDescription),
0321                          KAboutLicense::Unknown,
0322                          QLatin1String(CopyrightStatement),
0323                          QLatin1String(Text),
0324                          QString::fromLatin1(HomePageAddress),
0325                          QString::fromLatin1(BugsEmailAddress));
0326 
0327     // Deprecated, still want to test this though. Silence GCC warnings.
0328 #pragma GCC diagnostic push
0329 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
0330     // set different iconname
0331     aboutData.setProgramIconName(programIconName);
0332 #pragma GCC diagnostic pop
0333     QCOMPARE(aboutData.programIconName(), programIconName);
0334 }
0335 #endif
0336 
0337 void KAboutDataTest::testCopying()
0338 {
0339     KAboutData aboutData(QString::fromLatin1(AppName),
0340                          QLatin1String(ProgramName),
0341                          QString::fromLatin1(Version),
0342                          QLatin1String(ShortDescription),
0343                          KAboutLicense::GPL_V2);
0344 
0345     {
0346         KAboutData aboutData2(QString::fromLatin1(AppName),
0347                               QLatin1String(ProgramName),
0348                               QString::fromLatin1(Version),
0349                               QLatin1String(ShortDescription),
0350                               KAboutLicense::GPL_V3);
0351         aboutData2.addLicense(KAboutLicense::GPL_V2, KAboutLicense::OrLaterVersions);
0352         aboutData = aboutData2;
0353     }
0354     QList<KAboutLicense> licenses = aboutData.licenses();
0355     QCOMPARE(licenses.count(), 2);
0356     QCOMPARE(licenses.at(0).key(), KAboutLicense::GPL_V3);
0357     QCOMPARE(aboutData.licenses().at(0).spdx(), QStringLiteral("GPL-3.0"));
0358     // check it doesn't crash
0359     QVERIFY(!licenses.at(0).text().isEmpty());
0360     QCOMPARE(licenses.at(1).key(), KAboutLicense::GPL_V2);
0361     QCOMPARE(aboutData.licenses().at(1).spdx(), QStringLiteral("GPL-2.0+"));
0362     // check it doesn't crash
0363     QVERIFY(!licenses.at(1).text().isEmpty());
0364 }
0365 
0366 void KAboutDataTest::testSetDesktopFileName()
0367 {
0368     KAboutData aboutData(QString::fromLatin1(AppName),
0369                          QLatin1String(ProgramName),
0370                          QString::fromLatin1(Version),
0371                          QLatin1String(ShortDescription),
0372                          KAboutLicense::Unknown);
0373     QCOMPARE(aboutData.desktopFileName(), QStringLiteral("org.kde.app"));
0374 
0375     // set different desktopFileName
0376     aboutData.setDesktopFileName(QStringLiteral("foo.bar.application"));
0377     QCOMPARE(aboutData.desktopFileName(), QStringLiteral("foo.bar.application"));
0378 }
0379 
0380 void KAboutDataTest::testLicenseSPDXID()
0381 {
0382     // Input with + should output with +.
0383     auto license = KAboutLicense::byKeyword(QStringLiteral("GPLv2+"));
0384     QCOMPARE(license.spdx(), QStringLiteral("GPL-2.0+"));
0385     // Input without should output without.
0386     license = KAboutLicense::byKeyword(QStringLiteral("GPLv2"));
0387     QCOMPARE(license.spdx(), QStringLiteral("GPL-2.0"));
0388     // Input of spdx with or-later should also work
0389     license = KAboutLicense::byKeyword(QStringLiteral("GPL-2.0-or-later"));
0390     QCOMPARE(license.spdx(), QStringLiteral("GPL-2.0+")); // TODO: should not return the deprecatd version
0391 
0392     // we should be able to match by spdx too
0393     // create a KAboutLicense from enum, then make sure going to spdx and back gives the same enum
0394     for (int i = 1; i <= KAboutLicense::LGPL_V2_1; ++i) { /*current highest enum value*/
0395         KAboutData aboutData(QString::fromLatin1(AppName),
0396                              QLatin1String(ProgramName),
0397                              QString::fromLatin1(Version),
0398                              QLatin1String(ShortDescription),
0399                              KAboutLicense::GPL_V2);
0400         aboutData.setLicense(KAboutLicense::LicenseKey(i));
0401         QVERIFY(aboutData.licenses().count() == 1);
0402         const auto license = aboutData.licenses().constFirst();
0403         auto licenseFromKeyword = KAboutLicense::byKeyword(license.spdx());
0404 
0405         QCOMPARE(license.key(), licenseFromKeyword.key());
0406     }
0407 }
0408 
0409 void KAboutDataTest::testLicenseOrLater()
0410 {
0411     // For kaboutdata we can replace the license with an orLater version. Or add a second one.
0412     KAboutData aboutData(QString::fromLatin1(AppName),
0413                          QLatin1String(ProgramName),
0414                          QString::fromLatin1(Version),
0415                          QLatin1String(ShortDescription),
0416                          KAboutLicense::GPL_V2);
0417     QCOMPARE(aboutData.licenses().at(0).spdx(), QStringLiteral("GPL-2.0"));
0418     aboutData.setLicense(KAboutLicense::GPL_V2, KAboutLicense::OrLaterVersions);
0419     QCOMPARE(aboutData.licenses().at(0).spdx(), QStringLiteral("GPL-2.0+"));
0420     aboutData.addLicense(KAboutLicense::LGPL_V3, KAboutLicense::OrLaterVersions);
0421     bool foundLGPL = false;
0422     const QList<KAboutLicense> licenses = aboutData.licenses();
0423     for (const auto &license : licenses) {
0424         if (license.key() == KAboutLicense::LGPL_V3) {
0425             QCOMPARE(license.spdx(), QStringLiteral("LGPL-3.0+"));
0426             foundLGPL = true;
0427             break;
0428         }
0429     }
0430     QCOMPARE(foundLGPL, true);
0431 }
0432 
0433 void KAboutDataTest::testProductName()
0434 {
0435     KAboutData aboutData(QString::fromLatin1(AppName), QString::fromLatin1(ProgramName));
0436     QCOMPARE(aboutData.productName(), QString::fromLatin1(AppName));
0437     QCOMPARE(aboutData.internalProductName(), nullptr);
0438     aboutData.setProductName("frameworks-kcoreaddons/aboutdata");
0439     QCOMPARE(aboutData.productName(), QString::fromLatin1("frameworks-kcoreaddons/aboutdata"));
0440     QCOMPARE(aboutData.internalProductName(), "frameworks-kcoreaddons/aboutdata");
0441 }
0442 
0443 QTEST_MAIN(KAboutDataTest)
0444 
0445 #include "kaboutdatatest.moc"