diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt --- a/tests/auto/CMakeLists.txt +++ b/tests/auto/CMakeLists.txt @@ -26,10 +26,12 @@ gv_add_unit_test(imagescalertest testutils.cpp) gv_add_unit_test(paintutilstest) -# gv_add_unit_test(documenttest testutils.cpp) +if (KF5KDcraw_FOUND) + gv_add_unit_test(documenttest testutils.cpp) +endif() gv_add_unit_test(transformimageoperationtest) gv_add_unit_test(jpegcontenttest) -# gv_add_unit_test(thumbnailprovidertest testutils.cpp) +gv_add_unit_test(thumbnailprovidertest testutils.cpp) if (NOT GWENVIEW_SEMANTICINFO_BACKEND_NONE) gv_add_unit_test(semanticinfobackendtest) endif() diff --git a/tests/auto/documenttest.cpp b/tests/auto/documenttest.cpp --- a/tests/auto/documenttest.cpp +++ b/tests/auto/documenttest.cpp @@ -25,7 +25,7 @@ // KDE #include #include -#include +#include #include #include @@ -85,17 +85,17 @@ QUrl url = urlForTestFile(fileName); // testing RAW loading. For raw, QImage directly won't work -> load it using KDCRaw - QByteArray mFormatHint = url.fileName().section('.', -1).toAscii().toLower(); + QByteArray mFormatHint = url.fileName().section('.', -1).toLocal8Bit().toLower(); if (KDcrawIface::KDcraw::rawFilesList().contains(QString(mFormatHint))) { if (!KDcrawIface::KDcraw::loadEmbeddedPreview(expectedImage, url.toLocalFile())) { QSKIP("Not running this test: failed to get expectedImage. Try running ./fetch_testing_raw.sh\ - in the tests/data directory and then rerun the tests.", SkipSingle); + in the tests/data directory and then rerun the tests."); } } if (expectedKind != MimeTypeUtils::KIND_SVG_IMAGE) { if (expectedImage.isNull()) { - QSKIP("Not running this test: QImage failed to load the test image", SkipSingle); + QSKIP("Not running this test: QImage failed to load the test image"); } } @@ -265,12 +265,12 @@ { QUrl url = setUpRemoteTestDir("test.png"); if (!url.isValid()) { - return; + QSKIP("Not running this test: failed to setup remote test dir."); } url = url.adjusted(QUrl::StripTrailingSlash); url.setPath(url.path() + '/' + "test.png"); - QVERIFY2(KIO::NetAccess::exists(url, KIO::NetAccess::SourceSide, 0), "test url not found"); + QVERIFY2(KIO::stat(url, KIO::StatJob::SourceSide, 0)->exec(), "test url not found"); Document::Ptr doc = DocumentFactory::instance()->load(url); doc->startLoadingFullImage(); @@ -328,7 +328,7 @@ { QUrl dstUrl = setUpRemoteTestDir(); if (!dstUrl.isValid()) { - return; + QSKIP("Not running this test: failed to setup remote test dir."); } QUrl srcUrl = urlForTestFile("test.png"); @@ -376,7 +376,7 @@ url = urlForTestFile("dsd_1838.nef"); if (!KDcrawIface::KDcraw::loadEmbeddedPreview(image, url.toLocalFile())) { QSKIP("Not running this test: failed to get image. Try running ./fetch_testing_raw.sh\ - in the tests/data directory and then rerun the tests.", SkipSingle); + in the tests/data directory and then rerun the tests."); } matrix = ImageUtils::transformMatrix(ROT_270); image = image.transformed(matrix); diff --git a/tests/auto/thumbnailprovidertest.cpp b/tests/auto/thumbnailprovidertest.cpp --- a/tests/auto/thumbnailprovidertest.cpp +++ b/tests/auto/thumbnailprovidertest.cpp @@ -73,8 +73,9 @@ void SandBox::copyTestImage(const QString& testFileName, int width, int height) { - QString testPath = pathForTestFile(testFileName); - KIO::Job* job = KIO::copy(testPath, QUrl(mPath + '/' + testFileName)); + QUrl testPath = urlForTestFile(testFileName); + QUrl testDest = QUrl("file://" + mPath + '/' + testFileName); + KIO::Job* job = KIO::copy(testPath, testDest); QVERIFY2(job->exec(), "Couldn't copy test image"); mSizeHash.insert(testFileName, QSize(width, height)); } @@ -232,7 +233,7 @@ { QUrl url = setUpRemoteTestDir("test.png"); if (!url.isValid()) { - return; + QSKIP("Not running this test: failed to setup remote test dir."); } url = url.adjusted(QUrl::StripTrailingSlash); url.setPath(url.path() + '/' + "test.png");