File: loaderutiltest.cpp

package info (click to toggle)
syndication 1%3A5.116.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,072 kB
  • sloc: xml: 14,780; cpp: 9,693; ruby: 60; makefile: 7
file content (39 lines) | stat: -rw-r--r-- 1,237 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
    This file is part of the syndication library
    SPDX-FileCopyrightText: 2019 Laurent Montel <montel@kde.org>

    SPDX-License-Identifier: LGPL-2.0-or-later
*/

#include "loaderutiltest.h"
#include "loaderutil_p.h"
#include <QTest>
QTEST_GUILESS_MAIN(LoaderUtilTest)

LoaderUtilTest::LoaderUtilTest(QObject *parent)
    : QObject(parent)
{
}

void LoaderUtilTest::testParsing_data()
{
    QTest::addColumn<QString>("fileName");
    QTest::addColumn<QUrl>("url");
    QTest::addColumn<QUrl>("urlfound");
    QTest::addRow("bug-383381") << QString(QStringLiteral(SYNDICATION_DATA_FEEDPARSING_DIR) + QStringLiteral("/bug-383381.txt"))
                                << QUrl(QStringLiteral("https://www.youtube.com/user/bigclivedotcom/videos"))
                                << QUrl(QStringLiteral("https://www.youtube.com/feeds/videos.xml?channel_id=UCtM5z2gkrGRuWd0JQMx76qA"));
}

void LoaderUtilTest::testParsing()
{
    QFETCH(QString, fileName);
    QFETCH(QUrl, url);
    QFETCH(QUrl, urlfound);
    QFile f(fileName);
    QVERIFY(f.open(QIODevice::ReadOnly | QIODevice::Text));
    const QByteArray ba = f.readAll();
    QCOMPARE(Syndication::LoaderUtil::parseFeed(ba, url), urlfound);
}

#include "moc_loaderutiltest.cpp"