diff --git a/src/tests/allocinefetchertest.cpp b/src/tests/allocinefetchertest.cpp index cdbffe86..98b5572d 100644 --- a/src/tests/allocinefetchertest.cpp +++ b/src/tests/allocinefetchertest.cpp @@ -1,238 +1,238 @@ /*************************************************************************** Copyright (C) 2010-2012 Robby Stephenson ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * * published by the Free Software Foundation; either version 2 of * * the License or (at your option) version 3 or any later version * * accepted by the membership of KDE e.V. (or its successor approved * * by the membership of KDE e.V.), which shall act as a proxy * * defined in Section 14 of version 3 of the license. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * * * ***************************************************************************/ #undef QT_NO_CAST_FROM_ASCII #include "allocinefetchertest.h" #include "../fetch/execexternalfetcher.h" #include "../fetch/allocinefetcher.h" #include "../collections/videocollection.h" #include "../collectionfactory.h" #include "../entry.h" #include "../images/imagefactory.h" #include #include #include QTEST_GUILESS_MAIN( AllocineFetcherTest ) AllocineFetcherTest::AllocineFetcherTest() : AbstractFetcherTest() { } void AllocineFetcherTest::initTestCase() { Tellico::RegisterCollection registerVideo(Tellico::Data::Collection::Video, "video"); Tellico::ImageFactory::init(); } void AllocineFetcherTest::cleanupTestCase() { Tellico::ImageFactory::clean(true); } void AllocineFetcherTest::testTitle() { // Allocine script is currently failing return; Tellico::Fetch::FetchRequest request(Tellico::Data::Collection::Video, Tellico::Fetch::Title, QStringLiteral("Superman Returns")); Tellico::Fetch::Fetcher::Ptr fetcher(new Tellico::Fetch::ExecExternalFetcher(this)); KConfig config(QFINDTESTDATA("../fetch/scripts/fr.allocine.py.spec"), KConfig::SimpleConfig); KConfigGroup cg = config.group(QStringLiteral("")); cg.writeEntry("ExecPath", QFINDTESTDATA("../fetch/scripts/fr.allocine.py")); // don't sync() and save the new path cg.markAsClean(); fetcher->readConfig(cg, cg.name()); Tellico::Data::EntryList results = DO_FETCH1(fetcher, request, 1); QCOMPARE(results.size(), 1); Tellico::Data::EntryPtr entry = results.at(0); QCOMPARE(entry->field(QStringLiteral("title")), QStringLiteral("Superman Returns")); QCOMPARE(entry->field(QStringLiteral("director")), QStringLiteral("Bryan Singer")); QCOMPARE(entry->field(QStringLiteral("producer")), QStringLiteral("Jon Peters; Gilbert Adler; Bryan Singer; Lorne Orleans")); QCOMPARE(entry->field(QStringLiteral("studio")), QStringLiteral("Warner Bros. France")); QCOMPARE(entry->field(QStringLiteral("year")), QStringLiteral("2006")); QCOMPARE(entry->field(QStringLiteral("genre")), QStringLiteral("Fantastique; Action")); QCOMPARE(entry->field(QStringLiteral("nationality")), QString::fromUtf8("Américain; Australien")); QCOMPARE(entry->field(QStringLiteral("running-time")), QStringLiteral("154")); QStringList castList = Tellico::FieldFormat::splitTable(entry->field(QStringLiteral("cast"))); QVERIFY(!castList.isEmpty()); QCOMPARE(castList.at(0), QStringLiteral("Brandon Routh::Clark Kent / Superman")); QCOMPARE(castList.size(), 8); QVERIFY(!entry->field(QStringLiteral("plot")).isEmpty()); QVERIFY(!entry->field(QStringLiteral("cover")).isEmpty()); QVERIFY(!entry->field(QStringLiteral("cover")).contains(QLatin1Char('/'))); } void AllocineFetcherTest::testTitleAccented() { // Allocine script is currently failing return; Tellico::Fetch::FetchRequest request(Tellico::Data::Collection::Video, Tellico::Fetch::Title, QStringLiteral("Opération Tonnerre")); Tellico::Fetch::Fetcher::Ptr fetcher(new Tellico::Fetch::ExecExternalFetcher(this)); KConfig config(QFINDTESTDATA("../fetch/scripts/fr.allocine.py.spec"), KConfig::SimpleConfig); KConfigGroup cg = config.group(QStringLiteral("")); cg.writeEntry("ExecPath", QFINDTESTDATA("../fetch/scripts/fr.allocine.py")); // don't sync() and save the new path cg.markAsClean(); fetcher->readConfig(cg, cg.name()); Tellico::Data::EntryList results = DO_FETCH1(fetcher, request, 1); QCOMPARE(results.size(), 1); Tellico::Data::EntryPtr entry = results.at(0); QCOMPARE(entry->field(QStringLiteral("title")), QString::fromUtf8("Opération Tonnerre")); QCOMPARE(entry->field(QStringLiteral("titre-original")), QStringLiteral("Thunderball")); QCOMPARE(entry->field(QStringLiteral("studio")), QString()); } void AllocineFetcherTest::testTitleAccentRemoved() { // Allocine script is currently failing return; Tellico::Fetch::FetchRequest request(Tellico::Data::Collection::Video, Tellico::Fetch::Title, QStringLiteral("Operation Tonnerre")); Tellico::Fetch::Fetcher::Ptr fetcher(new Tellico::Fetch::ExecExternalFetcher(this)); KConfig config(QFINDTESTDATA("../fetch/scripts/fr.allocine.py.spec"), KConfig::SimpleConfig); KConfigGroup cg = config.group(QStringLiteral("")); cg.writeEntry("ExecPath", QFINDTESTDATA("../fetch/scripts/fr.allocine.py")); // don't sync() and save the new path cg.markAsClean(); fetcher->readConfig(cg, cg.name()); Tellico::Data::EntryList results = DO_FETCH1(fetcher, request, 1); QCOMPARE(results.size(), 1); Tellico::Data::EntryPtr entry = results.at(0); QCOMPARE(entry->field(QStringLiteral("title")), QString::fromUtf8("Opération Tonnerre")); } void AllocineFetcherTest::testPlotQuote() { // Allocine script is currently failing return; Tellico::Fetch::FetchRequest request(Tellico::Data::Collection::Video, Tellico::Fetch::Title, QStringLiteral("Goldfinger")); Tellico::Fetch::Fetcher::Ptr fetcher(new Tellico::Fetch::ExecExternalFetcher(this)); KConfig config(QFINDTESTDATA("../fetch/scripts/fr.allocine.py.spec"), KConfig::SimpleConfig); KConfigGroup cg = config.group(QStringLiteral("")); cg.writeEntry("ExecPath", QFINDTESTDATA("../fetch/scripts/fr.allocine.py")); // don't sync() and save the new path cg.markAsClean(); fetcher->readConfig(cg, cg.name()); Tellico::Data::EntryList results = DO_FETCH1(fetcher, request, 1); QCOMPARE(results.size(), 1); Tellico::Data::EntryPtr entry = results.at(0); QCOMPARE(entry->field(QStringLiteral("title")), QStringLiteral("Goldfinger")); QVERIFY(!entry->field(QStringLiteral("plot")).contains(QStringLiteral("""))); } void AllocineFetcherTest::testTitleAPI() { KConfig config(QFINDTESTDATA("tellicotest.config"), KConfig::SimpleConfig); QString groupName = QStringLiteral("allocine"); if(!config.hasGroup(groupName)) { QSKIP("This test requires a config file.", SkipAll); } KConfigGroup cg(&config, groupName); Tellico::Fetch::FetchRequest request(Tellico::Data::Collection::Video, Tellico::Fetch::Keyword, QStringLiteral("Superman Returns")); Tellico::Fetch::Fetcher::Ptr fetcher(new Tellico::Fetch::AllocineFetcher(this)); fetcher->readConfig(cg, cg.name()); Tellico::Data::EntryList results = DO_FETCH1(fetcher, request, 1); QCOMPARE(results.size(), 1); Tellico::Data::EntryPtr entry = results.at(0); QCOMPARE(entry->field(QStringLiteral("title")), QStringLiteral("Superman Returns")); QCOMPARE(entry->field(QStringLiteral("director")), QStringLiteral("Bryan Singer")); QCOMPARE(entry->field(QStringLiteral("producer")), QStringLiteral("Jon Peters; Gilbert Adler; Bryan Singer; Lorne Orleans")); QCOMPARE(entry->field(QStringLiteral("studio")), QStringLiteral("Warner Bros. France")); QCOMPARE(entry->field(QStringLiteral("year")), QStringLiteral("2006")); QCOMPARE(entry->field(QStringLiteral("genre")), QStringLiteral("Fantastique; Action")); QCOMPARE(entry->field(QStringLiteral("nationality")), QStringLiteral("U.S.A.; Australie")); QCOMPARE(entry->field(QStringLiteral("running-time")), QStringLiteral("154")); QStringList castList = Tellico::FieldFormat::splitTable(entry->field(QStringLiteral("cast"))); QVERIFY(!castList.isEmpty()); QCOMPARE(castList.at(0), QStringLiteral("Brandon Routh::Clark Kent / Superman")); QCOMPARE(castList.size(), 5); QVERIFY(!entry->field(QStringLiteral("plot")).isEmpty()); QVERIFY(!entry->field(QStringLiteral("cover")).isEmpty()); QVERIFY(!entry->field(QStringLiteral("cover")).contains(QLatin1Char('/'))); } void AllocineFetcherTest::testTitleAPIAccented() { KConfig config(QFINDTESTDATA("tellicotest.config"), KConfig::SimpleConfig); QString groupName = QStringLiteral("allocine"); if(!config.hasGroup(groupName)) { QSKIP("This test requires a config file.", SkipAll); } KConfigGroup cg(&config, groupName); Tellico::Fetch::FetchRequest request(Tellico::Data::Collection::Video, Tellico::Fetch::Keyword, QStringLiteral("Opération Tonnerre")); Tellico::Fetch::Fetcher::Ptr fetcher(new Tellico::Fetch::AllocineFetcher(this)); fetcher->readConfig(cg, cg.name()); Tellico::Data::EntryList results = DO_FETCH1(fetcher, request, 1); QCOMPARE(results.size(), 1); Tellico::Data::EntryPtr entry = results.at(0); QCOMPARE(entry->field(QStringLiteral("title")), QString::fromUtf8("Opération Tonnerre")); QCOMPARE(entry->field(QStringLiteral("origtitle")), QStringLiteral("Thunderball")); - QCOMPARE(entry->field(QStringLiteral("studio")), QString()); + QCOMPARE(entry->field(QStringLiteral("studio")), QStringLiteral("United International Pictures (UIP)")); QCOMPARE(entry->field(QStringLiteral("director")), QStringLiteral("Terence Young")); QCOMPARE(entry->field(QStringLiteral("color")), QStringLiteral("Color")); QVERIFY(!entry->field(QStringLiteral("allocine")).isEmpty()); } // mentioned in https://bugs.kde.org/show_bug.cgi?id=337432 void AllocineFetcherTest::testGhostDog() { KConfig config(QFINDTESTDATA("tellicotest.config"), KConfig::SimpleConfig); QString groupName = QStringLiteral("allocine"); if(!config.hasGroup(groupName)) { QSKIP("This test requires a config file.", SkipAll); } KConfigGroup cg(&config, groupName); Tellico::Fetch::FetchRequest request(Tellico::Data::Collection::Video, Tellico::Fetch::Keyword, QStringLiteral("Ghost Dog: la voie du samourai")); Tellico::Fetch::Fetcher::Ptr fetcher(new Tellico::Fetch::AllocineFetcher(this)); fetcher->readConfig(cg, cg.name()); Tellico::Data::EntryList results = DO_FETCH1(fetcher, request, 1); QCOMPARE(results.size(), 1); Tellico::Data::EntryPtr entry = results.at(0); QCOMPARE(entry->field(QStringLiteral("title")), QStringLiteral("Ghost Dog: la voie du samourai")); } diff --git a/src/tests/boardgamegeekfetchertest.cpp b/src/tests/boardgamegeekfetchertest.cpp index e21ed204..d534b176 100644 --- a/src/tests/boardgamegeekfetchertest.cpp +++ b/src/tests/boardgamegeekfetchertest.cpp @@ -1,83 +1,83 @@ /*************************************************************************** Copyright (C) 2010-2011 Robby Stephenson ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * * published by the Free Software Foundation; either version 2 of * * the License or (at your option) version 3 or any later version * * accepted by the membership of KDE e.V. (or its successor approved * * by the membership of KDE e.V.), which shall act as a proxy * * defined in Section 14 of version 3 of the license. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * * * ***************************************************************************/ #undef QT_NO_CAST_FROM_ASCII #include "boardgamegeekfetchertest.h" #include "../fetch/execexternalfetcher.h" #include "../fetch/boardgamegeekfetcher.h" #include "../collections/boardgamecollection.h" #include "../collectionfactory.h" #include "../entry.h" #include "../images/imagefactory.h" #include "../utils/datafileregistry.h" #include #include QTEST_GUILESS_MAIN( BoardGameGeekFetcherTest ) BoardGameGeekFetcherTest::BoardGameGeekFetcherTest() : AbstractFetcherTest() { } void BoardGameGeekFetcherTest::initTestCase() { Tellico::RegisterCollection registerBoard(Tellico::Data::Collection::BoardGame, "boardgame"); Tellico::ImageFactory::init(); Tellico::DataFileRegistry::self()->addDataLocation(QFINDTESTDATA("../../xslt/boardgamegeek2tellico.xsl")); } void BoardGameGeekFetcherTest::testTitle() { Tellico::Fetch::FetchRequest request(Tellico::Data::Collection::BoardGame, Tellico::Fetch::Title, QStringLiteral("Catan")); Tellico::Fetch::Fetcher::Ptr fetcher(new Tellico::Fetch::BoardGameGeekFetcher(this)); Tellico::Data::EntryList results = DO_FETCH1(fetcher, request, 1); QCOMPARE(results.size(), 1); Tellico::Data::EntryPtr entry = results.at(0); QCOMPARE(entry->collection()->type(), Tellico::Data::Collection::BoardGame); QCOMPARE(entry->field(QStringLiteral("title")), QStringLiteral("Catan")); QCOMPARE(entry->field(QStringLiteral("designer")), QStringLiteral("Klaus Teuber")); QCOMPARE(Tellico::FieldFormat::splitValue(entry->field(QStringLiteral("publisher"))).at(0), QStringLiteral("KOSMOS")); QCOMPARE(entry->field(QStringLiteral("year")), QStringLiteral("1995")); - QCOMPARE(Tellico::FieldFormat::splitValue(entry->field(QStringLiteral("genre"))).at(0), QStringLiteral("Negotiation")); + QCOMPARE(Tellico::FieldFormat::splitValue(entry->field(QStringLiteral("genre"))).at(0), QStringLiteral("Economic")); QCOMPARE(Tellico::FieldFormat::splitValue(entry->field(QStringLiteral("mechanism"))).at(0), QStringLiteral("Dice Rolling")); QCOMPARE(entry->field(QStringLiteral("num-player")), QStringLiteral("3; 4")); QVERIFY(!entry->field(QStringLiteral("cover")).isEmpty()); QVERIFY(!entry->field(QStringLiteral("cover")).contains(QLatin1Char('/'))); QVERIFY(!entry->field(QStringLiteral("description")).isEmpty()); } void BoardGameGeekFetcherTest::testKeyword() { Tellico::Fetch::FetchRequest request(Tellico::Data::Collection::BoardGame, Tellico::Fetch::Keyword, QStringLiteral("The Settlers of Catan")); Tellico::Fetch::Fetcher::Ptr fetcher(new Tellico::Fetch::BoardGameGeekFetcher(this)); Tellico::Data::EntryList results = DO_FETCH(fetcher, request); QCOMPARE(results.size(), 10); } diff --git a/src/tests/comicvinefetchertest.cpp b/src/tests/comicvinefetchertest.cpp index ee3b8793..4d8f79d4 100644 --- a/src/tests/comicvinefetchertest.cpp +++ b/src/tests/comicvinefetchertest.cpp @@ -1,82 +1,82 @@ /*************************************************************************** Copyright (C) 2019 Robby Stephenson ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * * published by the Free Software Foundation; either version 2 of * * the License or (at your option) version 3 or any later version * * accepted by the membership of KDE e.V. (or its successor approved * * by the membership of KDE e.V.), which shall act as a proxy * * defined in Section 14 of version 3 of the license. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * * * ***************************************************************************/ #undef QT_NO_CAST_FROM_ASCII #include "comicvinefetchertest.h" #include "../fetch/comicvinefetcher.h" #include "../collections/comicbookcollection.h" #include "../collectionfactory.h" #include "../entry.h" #include "../images/imagefactory.h" #include "../utils/datafileregistry.h" #include #include #include QTEST_GUILESS_MAIN( ComicVineFetcherTest ) ComicVineFetcherTest::ComicVineFetcherTest() : AbstractFetcherTest() { } void ComicVineFetcherTest::initTestCase() { Tellico::RegisterCollection registerCB(Tellico::Data::Collection::ComicBook, "comic"); // since we use the importer Tellico::DataFileRegistry::self()->addDataLocation(QFINDTESTDATA("../../xslt/comicvine2tellico.xsl")); Tellico::ImageFactory::init(); } void ComicVineFetcherTest::testKeyword() { KConfig config(QFINDTESTDATA("tellicotest.config"), KConfig::SimpleConfig); QString groupName = QStringLiteral("comicvine"); if(!config.hasGroup(groupName)) { QSKIP("This test requires a config file.", SkipAll); } KConfigGroup cg(&config, groupName); Tellico::Fetch::FetchRequest request(Tellico::Data::Collection::ComicBook, Tellico::Fetch::Keyword, - QStringLiteral("Avengers Endgame")); + QStringLiteral("Avengers Endgame Prelude")); Tellico::Fetch::Fetcher::Ptr fetcher(new Tellico::Fetch::ComicVineFetcher(this)); fetcher->readConfig(cg, cg.name()); Tellico::Data::EntryList results = DO_FETCH1(fetcher, request, 1); QCOMPARE(results.size(), 1); Tellico::Data::EntryPtr entry = results.at(0); - QCOMPARE(entry->field(QStringLiteral("title")), QStringLiteral("Marvel's Avengers: Endgame Prelude")); + QCOMPARE(entry->field(QStringLiteral("title")), QStringLiteral("TPB")); QCOMPARE(entry->field(QStringLiteral("pub_year")), QStringLiteral("2019")); QCOMPARE(entry->field(QStringLiteral("issue")), QStringLiteral("1")); QCOMPARE(entry->field(QStringLiteral("writer")), QStringLiteral("Will Corona Pilgrim")); QCOMPARE(entry->field(QStringLiteral("artist")), QStringLiteral("Dono Almara; Paco Diaz Luque; Travis Lanham")); QCOMPARE(entry->field(QStringLiteral("series")), QStringLiteral("Marvel's Avengers: Endgame Prelude")); QCOMPARE(entry->field(QStringLiteral("publisher")), QStringLiteral("Marvel")); QCOMPARE(entry->field(QStringLiteral("comicvine")), QStringLiteral("https://comicvine.gamespot.com/marvels-avengers-endgame-prelude-1-tpb/4000-705478/")); QVERIFY(!entry->field(QStringLiteral("plot")).isEmpty()); QVERIFY(!entry->field(QStringLiteral("cover")).isEmpty()); QVERIFY(!entry->field(QStringLiteral("cover")).contains(QLatin1Char('/'))); }