OSDN Git Service

gwenview: remove redundant manual thumbnailgen test
authorIvailo Monev <xakepa10@laimg.moc>
Tue, 4 Feb 2020 17:45:20 +0000 (17:45 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Tue, 4 Feb 2020 17:45:25 +0000 (17:45 +0000)
thumbnails are generated via KIO now

gwenview/tests/manual/CMakeLists.txt
gwenview/tests/manual/thumbnailgen.cpp [deleted file]

index 86a7b25..6dcb6b6 100644 (file)
@@ -18,19 +18,3 @@ set(imageloadbench_SRCS
 kde4_add_manual_test(imageloadbench ${imageloadbench_SRCS})
 
 target_link_libraries(imageloadbench ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} gwenviewlib)
-
-# thumbnailgen
-set(thumbnailgen_SRCS
-    thumbnailgen.cpp
-    ../auto/testutils.cpp # FIXME: Move testutils.cpp to test/
-    )
-
-kde4_add_manual_test(thumbnailgen ${thumbnailgen_SRCS})
-
-target_link_libraries(thumbnailgen
-    ${QT_QTCORE_LIBRARY}
-    ${QT_QTGUI_LIBRARY}
-    ${QT_QTTEST_LIBRARY}
-    ${KDE4_KIO_LIBS}
-    ${KDE4_KDEUI_LIBS}
-    gwenviewlib)
diff --git a/gwenview/tests/manual/thumbnailgen.cpp b/gwenview/tests/manual/thumbnailgen.cpp
deleted file mode 100644 (file)
index 4683940..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-// vim: set tabstop=4 shiftwidth=4 expandtab:
-/*
-Gwenview: an image viewer
-Copyright 2012 Aurélien Gâteau <agateau@kde.org>
-
-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) any later version.
-
-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, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA.
-
-*/
-// Local
-#include <lib/thumbnailprovider/thumbnailprovider.h>
-#include <../auto/testutils.h>
-
-// KDE
-#include <KAboutData>
-#include <KApplication>
-#include <KCmdLineArgs>
-#include <KDebug>
-
-// Qt
-#include <QDir>
-#include <QtCore/qdatetime.h>
-
-using namespace Gwenview;
-
-int main(int argc, char** argv)
-{
-    KAboutData aboutData(
-        "thumbnailgen", // appName
-        0,     // catalogName
-        ki18n("thumbnailgen"), // programName
-        "0.0.0");
-
-    // Parser init
-    KCmdLineArgs::init(argc, argv, &aboutData);
-
-    KCmdLineOptions options;
-    options.add("+image-dir", ki18n("Image dir to open"));
-    options.add("+size", ki18n("What size of thumbnails to generate. Can be either 'normal' or 'large'"));
-    options.add("t").add("thumbnail-dir <dir>", ki18n("Use <dir> instead of ~/.thumbnails to store thumbnails"));
-    KCmdLineArgs::addCmdLineOptions(options);
-
-    KApplication app;
-
-    // Read cmdline options
-    KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
-    if (args->count() != 2) {
-        kFatal() << "Wrong number of arguments";
-        return 1;
-    }
-    QString imageDirName = args->arg(0);
-    ThumbnailGroup::Enum group = ThumbnailGroup::Normal;
-    if (args->arg(1) == "large") {
-        group = ThumbnailGroup::Large;
-    } else if (args->arg(1) == "normal") {
-        // group is already set to the right value
-    } else {
-        kFatal() << "Invalid thumbnail size:" << args->arg(1);
-    }
-    QString thumbnailBaseDirName = args->isSet("thumbnail-dir") ? args->getOption("thumbnail-dir") : QString();
-
-    // Set up thumbnail base dir
-    if (!thumbnailBaseDirName.isEmpty()) {
-        QDir dir = QDir(thumbnailBaseDirName);
-        thumbnailBaseDirName = dir.absolutePath();
-        if (!dir.exists()) {
-            bool ok = QDir::root().mkpath(thumbnailBaseDirName);
-            if (!ok) {
-                kFatal() << "Could not create" << thumbnailBaseDirName;
-                return 1;
-            }
-        }
-        if (!thumbnailBaseDirName.endsWith("/")) {
-            thumbnailBaseDirName += "/";
-        }
-        ThumbnailProvider::setThumbnailBaseDir(thumbnailBaseDirName);
-    }
-
-    // List dir
-    QDir dir(imageDirName);
-    KFileItemList list;
-    Q_FOREACH(const QString &name, dir.entryList()) {
-        KUrl url = KUrl::fromLocalFile(dir.absoluteFilePath(name));
-        KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
-        list << item;
-    }
-    kWarning() << "Generating thumbnails for" << list.count() << "files";
-
-    // Start the job
-    QTime chrono;
-    ThumbnailProvider job;
-    job.setThumbnailGroup(group);
-    job.appendItems(list);
-
-    chrono.start();
-
-    QEventLoop loop;
-    QObject::connect(&job, SIGNAL(finished()), &loop, SLOT(quit()));
-    loop.exec();
-
-    kWarning() << "Time to generate thumbnails:" << chrono.restart();
-
-    waitForDeferredDeletes();
-    while (!ThumbnailProvider::isThumbnailWriterEmpty()) {
-        QCoreApplication::processEvents();
-    }
-    kWarning() << "Time to save pending thumbnails:" << chrono.restart();
-
-    return 0;
-}