Warning, file /frameworks/syndication/autotests/loaderutiltest.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     This file is part of the syndication library
0003     SPDX-FileCopyrightText: 2019 Laurent Montel <montel@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #include "loaderutiltest.h"
0009 #include "loaderutil_p.h"
0010 #include <QTest>
0011 QTEST_GUILESS_MAIN(LoaderUtilTest)
0012 
0013 LoaderUtilTest::LoaderUtilTest(QObject *parent)
0014     : QObject(parent)
0015 {
0016 }
0017 
0018 void LoaderUtilTest::testParsing_data()
0019 {
0020     QTest::addColumn<QString>("fileName");
0021     QTest::addColumn<QUrl>("url");
0022     QTest::addColumn<QUrl>("urlfound");
0023     QTest::addRow("bug-383381") << QString(QStringLiteral(SYNDICATION_DATA_FEEDPARSING_DIR) + QStringLiteral("/bug-383381.txt"))
0024                                 << QUrl(QStringLiteral("https://www.youtube.com/user/bigclivedotcom/videos"))
0025                                 << QUrl(QStringLiteral("https://www.youtube.com/feeds/videos.xml?channel_id=UCtM5z2gkrGRuWd0JQMx76qA"));
0026 }
0027 
0028 void LoaderUtilTest::testParsing()
0029 {
0030     QFETCH(QString, fileName);
0031     QFETCH(QUrl, url);
0032     QFETCH(QUrl, urlfound);
0033     QFile f(fileName);
0034     QVERIFY(f.open(QIODevice::ReadOnly | QIODevice::Text));
0035     const QByteArray ba = f.readAll();
0036     QCOMPARE(Syndication::LoaderUtil::parseFeed(ba, url), urlfound);
0037 }