File indexing completed on 2024-12-01 04:35:23

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 #include "downloadappslanguagesparsertest.h"
0007 #include "downloadappslanguages/downloadappslanguagesparser.h"
0008 #include <QTest>
0009 QTEST_GUILESS_MAIN(DownloadAppsLanguagesParserTest)
0010 DownloadAppsLanguagesParserTest::DownloadAppsLanguagesParserTest(QObject *parent)
0011     : QObject(parent)
0012 {
0013 }
0014 
0015 void DownloadAppsLanguagesParserTest::shouldParseFile_data()
0016 {
0017     QTest::addColumn<QString>("filename");
0018     QTest::addColumn<int>("identifier");
0019     QTest::addRow("empty") << QStringLiteral("empty") << 0;
0020     QTest::addRow("languages") << QStringLiteral("languages") << 23;
0021 }
0022 
0023 void DownloadAppsLanguagesParserTest::shouldParseFile()
0024 {
0025     QFETCH(QString, filename);
0026     QFETCH(int, identifier);
0027     DownloadAppsLanguagesParser parser;
0028     const QString originalJsonFile = QLatin1String(RUQOLA_DATA_DIR) + QLatin1String("/downloadappslanguages/") + filename;
0029     parser.setFilename(originalJsonFile);
0030     QVERIFY(parser.parse());
0031     QCOMPARE(parser.map().count(), identifier);
0032 }
0033 
0034 #include "moc_downloadappslanguagesparsertest.cpp"