diff --git a/ark/kerfuffle/tests/jobstest.cpp b/ark/kerfuffle/tests/jobstest.cpp index 45fd77d8..96dcb709 100644 --- a/ark/kerfuffle/tests/jobstest.cpp +++ b/ark/kerfuffle/tests/jobstest.cpp @@ -114,14 +114,13 @@ void JobsTest::startAndWaitForResult(KJob *job) void JobsTest::testExtractedFilesSize() { - Kerfuffle::ListJob *listJob; JSONArchiveInterface *noSizeIface = createArchiveInterface(QLatin1String(KDESRCDIR "data/archive001.json")); JSONArchiveInterface *sizeIface = createArchiveInterface(QLatin1String(KDESRCDIR "data/archive002.json")); - listJob = new Kerfuffle::ListJob(noSizeIface, this); + Kerfuffle::ListJob *listJob = new Kerfuffle::ListJob(noSizeIface, this); listJob->setAutoDelete(false); startAndWaitForResult(listJob); diff --git a/ark/kerfuffle/tests/jsonarchiveinterface.cpp b/ark/kerfuffle/tests/jsonarchiveinterface.cpp index bf0d088a..eaf3350c 100644 --- a/ark/kerfuffle/tests/jsonarchiveinterface.cpp +++ b/ark/kerfuffle/tests/jsonarchiveinterface.cpp @@ -26,10 +26,13 @@ #include "jsonarchiveinterface.h" #include -#include - #include +#ifndef QT_KATIE +# include +#endif + + JSONArchiveInterface::JSONArchiveInterface(QObject *parent, const QVariantList& args) : Kerfuffle::ReadWriteArchiveInterface(parent, args) { diff --git a/ark/kerfuffle/tests/jsonparser.cpp b/ark/kerfuffle/tests/jsonparser.cpp index 8c4c7e6f..688ed1e0 100644 --- a/ark/kerfuffle/tests/jsonparser.cpp +++ b/ark/kerfuffle/tests/jsonparser.cpp @@ -28,10 +28,13 @@ #include "kerfuffle/archiveinterface.h" #include +#include -#include - -#include +#ifndef QT_KATIE +# include +#else +# include +#endif typedef QMap ArchiveProperties; @@ -73,6 +76,7 @@ JSONParser::~JSONParser() JSONParser::JSONArchive JSONParser::parse(const QString &json) { +#ifndef QT_KATIE bool ok; QJson::Parser parser; @@ -82,12 +86,22 @@ JSONParser::JSONArchive JSONParser::parse(const QString &json) kDebug() << "Line" << parser.errorLine() << ":" << parser.errorString(); return JSONParser::JSONArchive(); } +#else + QJsonParseError error; + const QVariant result = QJsonDocument::fromJson(json.toUtf8(), &error).toVariant(); + + if (error.error != QJsonParseError::NoError) { + kDebug() << "Line" << error.offset << ":" << error.errorString(); + return JSONParser::JSONArchive(); + } +#endif return createJSONArchive(result); } JSONParser::JSONArchive JSONParser::parse(QIODevice *json) { +#ifndef QT_KATIE bool ok; QJson::Parser parser; @@ -97,6 +111,15 @@ JSONParser::JSONArchive JSONParser::parse(QIODevice *json) kDebug() << "Line" << parser.errorLine() << ":" << parser.errorString(); return JSONParser::JSONArchive(); } +#else + QJsonParseError error; + const QVariant result = QJsonDocument::fromJson(json->readAll(), &error).toVariant(); + + if (error.error != QJsonParseError::NoError) { + kDebug() << "Line" << error.offset << ":" << error.errorString(); + return JSONParser::JSONArchive(); + } +#endif return createJSONArchive(result); }