[krita] /: Make it possible for tests to access resources

Boudewijn Rempt null at kde.org
Wed Jul 25 15:26:35 BST 2018


Git commit f9ee9a42da64797a0d6ae5807e2ee78fd6e3e7b1 by Boudewijn Rempt.
Committed on 25/07/2018 at 14:24.
Pushed by rempt into branch 'master'.

Make it possible for tests to access resources

If a test needs access to the resources in the install folder, it
needs to use KISTEST_MAIN instead of QTEST_MAIN. This will set an
env variable, EXTRA_RESOURCE_DIRS, where KoREsourcePaths will then
also look.

Also remove the setReady/isReady methods for KoResourcePaths: we
don't need that. We can add resource dirs in as many places as
we want.

CCMAIL:kimageshop at kde.org

M  +3    -0    KoConfig.h.cmake
M  +5    -3    libs/image/tests/kis_painter_test.cpp
M  +1    -4    libs/ui/KisApplication.cpp
M  +73   -72   libs/widgetutils/KoResourcePaths.cpp
M  +0    -12   libs/widgetutils/KoResourcePaths.h
M  +3    -10   plugins/color/lcms2engine/LcmsEnginePlugin.cpp
M  +49   -0    sdk/tests/testutil.h

https://commits.kde.org/krita/f9ee9a42da64797a0d6ae5807e2ee78fd6e3e7b1

diff --git a/KoConfig.h.cmake b/KoConfig.h.cmake
index fbf063d758d..bd4c2de3a70 100644
--- a/KoConfig.h.cmake
+++ b/KoConfig.h.cmake
@@ -60,3 +60,6 @@
 
 /* This variable contains the path to the current build directory */
 #define KRITA_BUILD_DIR "${CMAKE_BINARY_DIR}"
+
+/* This variable contains the path to the data install dir */
+#define KRITA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}"
diff --git a/libs/image/tests/kis_painter_test.cpp b/libs/image/tests/kis_painter_test.cpp
index 73657c897fd..4785896ccc0 100644
--- a/libs/image/tests/kis_painter_test.cpp
+++ b/libs/image/tests/kis_painter_test.cpp
@@ -42,9 +42,11 @@
 
 void KisPainterTest::allCsApplicator(void (KisPainterTest::* funcPtr)(const KoColorSpace*cs))
 {
-    QList<const KoColorSpace*> colorsapces = KoColorSpaceRegistry::instance()->allColorSpaces(KoColorSpaceRegistry::AllColorSpaces, KoColorSpaceRegistry::OnlyDefaultProfile);
+    qDebug() << qAppName();
 
-    Q_FOREACH (const KoColorSpace* cs, colorsapces) {
+    QList<const KoColorSpace*> colorspaces = KoColorSpaceRegistry::instance()->allColorSpaces(KoColorSpaceRegistry::AllColorSpaces, KoColorSpaceRegistry::OnlyDefaultProfile);
+
+    Q_FOREACH (const KoColorSpace* cs, colorspaces) {
 
         QString csId = cs->id();
         // ALL THESE COLORSPACES ARE BROKEN: WE NEED UNITTESTS FOR COLORSPACES!
@@ -862,6 +864,6 @@ void KisPainterTest::testOptimizedCopying()
 
 }
 
-QTEST_MAIN(KisPainterTest)
+KISTEST_MAIN(KisPainterTest)
 
 
diff --git a/libs/ui/KisApplication.cpp b/libs/ui/KisApplication.cpp
index 70deb0c6896..8bde174da49 100644
--- a/libs/ui/KisApplication.cpp
+++ b/libs/ui/KisApplication.cpp
@@ -221,7 +221,6 @@ void KisApplication::addResourceTypes()
     // All Krita's resource types
     KoResourcePaths::addResourceType("kis_pics", "data", "/pics/");
     KoResourcePaths::addResourceType("kis_images", "data", "/images/");
-    KoResourcePaths::addResourceType("icc_profiles", "data", "/profiles/");
     KoResourcePaths::addResourceType("metadata_schema", "data", "/metadata/schemas/");
     KoResourcePaths::addResourceType("kis_brushes", "data", "/brushes/");
     KoResourcePaths::addResourceType("kis_taskset", "data", "/taskset/");
@@ -241,6 +240,7 @@ void KisApplication::addResourceTypes()
     KoResourcePaths::addResourceType("kis_shortcuts", "data", "/shortcuts/");
     KoResourcePaths::addResourceType("kis_actions", "data", "/actions");
     KoResourcePaths::addResourceType("icc_profiles", "data", "/color/icc");
+    KoResourcePaths::addResourceType("icc_profiles", "data", "/profiles/");
     KoResourcePaths::addResourceType("ko_effects", "data", "/effects/");
     KoResourcePaths::addResourceType("tags", "data", "/tags/");
     KoResourcePaths::addResourceType("templates", "data", "/templates");
@@ -277,9 +277,6 @@ void KisApplication::addResourceTypes()
     d.mkpath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/preset_icons/");
     d.mkpath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/preset_icons/tool_icons/");
     d.mkpath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/preset_icons/emblem_icons/");
-
-    // Indicate that it is now safe for users of KoResourcePaths to load resources
-    KoResourcePaths::setReady();
 }
 
 void KisApplication::loadResources()
diff --git a/libs/widgetutils/KoResourcePaths.cpp b/libs/widgetutils/KoResourcePaths.cpp
index 1ea1d30d27a..22157fd8fd7 100644
--- a/libs/widgetutils/KoResourcePaths.cpp
+++ b/libs/widgetutils/KoResourcePaths.cpp
@@ -28,7 +28,7 @@
 #include <QApplication>
 #include <QMutex>
 #include "kis_debug.h"
-#include "WidgetUtilsDebug.h"
+
 
 Q_GLOBAL_STATIC(KoResourcePaths, s_instance);
 
@@ -89,15 +89,15 @@ QString getInstallationPrefix() {
 #ifdef Q_OS_OSX
      QString appPath = qApp->applicationDirPath();
 
-     debugWidgetUtils << "1" << appPath;
+     dbgResources << "1" << appPath;
      appPath.chop(QString("MacOS/").length());
-     debugWidgetUtils << "2" << appPath;
+     dbgResources << "2" << appPath;
 
      bool makeInstall = QDir(appPath + "/../../../share/kritaplugins").exists();
      bool inBundle = QDir(appPath + "/Resources/kritaplugins").exists();
 
-     debugWidgetUtils << "3. After make install" << makeInstall;
-     debugWidgetUtils << "4. In Bundle" << inBundle;
+     dbgResources << "3. After make install" << makeInstall;
+     dbgResources << "4. In Bundle" << inBundle;
 
      QString bundlePath;
 
@@ -112,7 +112,7 @@ QString getInstallationPrefix() {
          qFatal("Cannot calculate the bundle path from the app path");
      }
 
-     debugWidgetUtils << ">>>>>>>>>>>" << bundlePath;
+     dbgResources << ">>>>>>>>>>>" << bundlePath;
      return bundlePath;
 #else
     #ifdef Q_OS_QWIN
@@ -141,8 +141,6 @@ public:
     QMutex relativesMutex;
     QMutex absolutesMutex;
 
-    bool ready = false; // Paths have been initialized
-
     QStringList aliases(const QString &type)
     {
         QStringList r;
@@ -152,12 +150,12 @@ public:
             r += relatives[type];
         }
         relativesMutex.unlock();
-        debugWidgetUtils << "\trelatives" << r;
+        dbgResources << "\trelatives" << r;
         absolutesMutex.lock();
         if (absolutes.contains(type)) {
             a += absolutes[type];
         }
-        debugWidgetUtils << "\tabsolutes" << a;
+        dbgResources << "\tabsolutes" << a;
         absolutesMutex.unlock();
 
         return r + a;
@@ -275,7 +273,7 @@ void KoResourcePaths::addResourceTypeInternal(const QString &type, const QString
     }
     d->relativesMutex.unlock();
 
-    debugWidgetUtils << "addResourceType: type" << type << "basetype" << basetype << "relativename" << relativename << "priority" << priority << d->relatives[type];
+    dbgResources << "addResourceType: type" << type << "basetype" << basetype << "relativename" << relativename << "priority" << priority << d->relatives[type];
 }
 
 void KoResourcePaths::addResourceDirInternal(const QString &type, const QString &absdir, bool priority)
@@ -299,19 +297,19 @@ void KoResourcePaths::addResourceDirInternal(const QString &type, const QString
     }
     d->absolutesMutex.unlock();
 
-    debugWidgetUtils << "addResourceDir: type" << type << "absdir" << absdir << "priority" << priority << d->absolutes[type];
+    dbgResources << "addResourceDir: type" << type << "absdir" << absdir << "priority" << priority << d->absolutes[type];
 }
 
 QString KoResourcePaths::findResourceInternal(const QString &type, const QString &fileName)
 {
     QStringList aliases = d->aliases(type);
-    debugWidgetUtils << "aliases" << aliases << getApplicationRoot();
+    dbgResources << "aliases" << aliases << getApplicationRoot();
     QString resource = QStandardPaths::locate(QStandardPaths::AppDataLocation, fileName, QStandardPaths::LocateFile);
 
     if (resource.isEmpty()) {
         Q_FOREACH (const QString &alias, aliases) {
             resource = QStandardPaths::locate(d->mapTypeToQStandardPaths(type), alias + '/' + fileName, QStandardPaths::LocateFile);
-            debugWidgetUtils << "\t1" << resource;
+            dbgResources << "\t1" << resource;
             if (QFile::exists(resource)) {
                 continue;
             }
@@ -321,7 +319,7 @@ QString KoResourcePaths::findResourceInternal(const QString &type, const QString
         QString approot = getApplicationRoot();
         Q_FOREACH (const QString &alias, aliases) {
             resource = approot + "/share/" + alias + '/' + fileName;
-            debugWidgetUtils << "\t1" << resource;
+            dbgResources << "\t1" << resource;
 
             if (QFile::exists(resource)) {
                 continue;
@@ -332,22 +330,49 @@ QString KoResourcePaths::findResourceInternal(const QString &type, const QString
         QString approot = getApplicationRoot();
         Q_FOREACH (const QString &alias, aliases) {
             resource = approot + "/share/krita/" + alias + '/' + fileName;
-            debugWidgetUtils << "\t1" << resource;
+            dbgResources << "\t1" << resource;
             if (QFile::exists(resource)) {
                 continue;
             }
         }
     }
 
-    debugWidgetUtils << "findResource: type" << type << "filename" << fileName << "resource" << resource;
+    dbgResources << "findResource: type" << type << "filename" << fileName << "resource" << resource;
     Q_ASSERT(!resource.isEmpty());
     return resource;
 }
 
+
+QStringList filesInDir(const QString &startdir, const QString & filter, bool recursive)
+{
+    dbgResources << "filesInDir: startdir" << startdir << "filter" << filter << "recursive" << recursive;
+    QStringList result;
+
+    // First the entries in this path
+    QStringList nameFilters;
+    nameFilters << filter;
+    const QStringList fileNames = QDir(startdir).entryList(nameFilters, QDir::Files | QDir::CaseSensitive, QDir::Name);
+    dbgResources << "\tFound:" << fileNames.size() << ":" << fileNames;
+    Q_FOREACH (const QString &fileName, fileNames) {
+        QString file = startdir + '/' + fileName;
+        result << file;
+    }
+
+    // And then everything underneath, if recursive is specified
+    if (recursive) {
+        const QStringList entries = QDir(startdir).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
+        Q_FOREACH (const QString &subdir, entries) {
+            dbgResources << "\tGoing to look in subdir" << subdir << "of" << startdir;
+            result << filesInDir(startdir + '/' + subdir, filter, recursive);
+        }
+    }
+    return result;
+}
+
 QStringList KoResourcePaths::findDirsInternal(const QString &type)
 {
     QStringList aliases = d->aliases(type);
-    debugWidgetUtils << type << aliases << d->mapTypeToQStandardPaths(type);
+    dbgResources << type << aliases << d->mapTypeToQStandardPaths(type);
 
     QStringList dirs;
     QStringList standardDirs =
@@ -356,17 +381,17 @@ QStringList KoResourcePaths::findDirsInternal(const QString &type)
 
     Q_FOREACH (const QString &alias, aliases) {
         QStringList aliasDirs =
-            QStandardPaths::locateAll(d->mapTypeToQStandardPaths(type), alias + '/', QStandardPaths::LocateDirectory);
+           QStandardPaths::locateAll(d->mapTypeToQStandardPaths(type), alias + '/', QStandardPaths::LocateDirectory);
         appendResources(&dirs, aliasDirs, true);
 
 #ifdef Q_OS_OSX
-        debugWidgetUtils << "MAC:" << getApplicationRoot();
+        dbgResources << "MAC:" << getApplicationRoot();
         QStringList bundlePaths;
         bundlePaths << getApplicationRoot() + "/share/krita/" + alias;
         bundlePaths << getApplicationRoot() + "/../share/krita/" + alias;
-        debugWidgetUtils << "bundlePaths" << bundlePaths;
+        dbgResources << "bundlePaths" << bundlePaths;
         appendResources(&dirs, bundlePaths, true);
-        Q_ASSERT(!dirs.isEmpty());
+       Q_ASSERT(!dirs.isEmpty());
 #endif
 
         QStringList fallbackPaths;
@@ -375,47 +400,21 @@ QStringList KoResourcePaths::findDirsInternal(const QString &type)
         appendResources(&dirs, fallbackPaths, true);
 
     }
-    debugWidgetUtils << "findDirs: type" << type << "resource" << dirs;
+    dbgResources << "findDirs: type" << type << "resource" << dirs;
     return dirs;
 }
 
 
-QStringList filesInDir(const QString &startdir, const QString & filter, bool recursive)
-{
-    debugWidgetUtils << "filesInDir: startdir" << startdir << "filter" << filter << "recursive" << recursive;
-    QStringList result;
-
-    // First the entries in this path
-    QStringList nameFilters;
-    nameFilters << filter;
-    const QStringList fileNames = QDir(startdir).entryList(nameFilters, QDir::Files | QDir::CaseSensitive, QDir::Name);
-    debugWidgetUtils << "\tFound:" << fileNames.size() << ":" << fileNames;
-    Q_FOREACH (const QString &fileName, fileNames) {
-        QString file = startdir + '/' + fileName;
-        result << file;
-    }
-
-    // And then everything underneath, if recursive is specified
-    if (recursive) {
-        const QStringList entries = QDir(startdir).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
-        Q_FOREACH (const QString &subdir, entries) {
-            debugWidgetUtils << "\tGoing to look in subdir" << subdir << "of" << startdir;
-            result << filesInDir(startdir + '/' + subdir, filter, recursive);
-        }
-    }
-    return result;
-}
-
 QStringList KoResourcePaths::findAllResourcesInternal(const QString &type,
                                                       const QString &_filter,
                                                       SearchOptions options) const
 {
-    debugWidgetUtils << "=====================================================";
-    debugWidgetUtils << type << _filter << QStandardPaths::standardLocations(d->mapTypeToQStandardPaths(type));
+    dbgResources << "=====================================================";
+    dbgResources << type << _filter << QStandardPaths::standardLocations(d->mapTypeToQStandardPaths(type));
 
     bool recursive = options & KoResourcePaths::Recursive;
 
-    debugWidgetUtils << "findAllResources: type" << type << "filter" << _filter << "recursive" << recursive;
+    dbgResources << "findAllResources: type" << type << "filter" << _filter << "recursive" << recursive;
 
     QStringList aliases = d->aliases(type);
     QString filter = _filter;
@@ -424,7 +423,7 @@ QStringList KoResourcePaths::findAllResourcesInternal(const QString &type,
     if (filter.indexOf('*') > 0) {
         aliases << filter.split('*').first();
         filter = '*' + filter.split('*')[1];
-        debugWidgetUtils << "Split up alias" << aliases << "filter" << filter;
+        dbgResources << "Split up alias" << aliases << "filter" << filter;
     }
 
     QStringList resources;
@@ -432,13 +431,25 @@ QStringList KoResourcePaths::findAllResourcesInternal(const QString &type,
         QStringList standardResources =
             QStandardPaths::locateAll(d->mapTypeToQStandardPaths(type),
                                       filter, QStandardPaths::LocateFile);
+        dbgResources << "standardResources" << standardResources;
         appendResources(&resources, standardResources, true);
+        dbgResources << "1" << resources;
     }
 
-    debugWidgetUtils << "\tresources from qstandardpaths:" << resources.size();
+
+    QString extraResourceDirs = qgetenv("EXTRA_RESOURCE_DIRS");
+    dbgResources << ">>>>>>>>>>>>>>>>" << extraResourceDirs;
+    if (!extraResourceDirs.isEmpty()) {
+        Q_FOREACH(const QString &extraResourceDir, extraResourceDirs.split(':', QString::SkipEmptyParts)) {
+            appendResources(&resources, filesInDir(extraResourceDir, filter, recursive), true);
+        }
+
+    }
+
+    dbgResources << "\tresources from qstandardpaths:" << resources.size();
 
     Q_FOREACH (const QString &alias, aliases) {
-        debugWidgetUtils << "\t\talias:" << alias;
+        dbgResources << "\t\talias:" << alias;
         QStringList dirs;
 
         QFileInfo dirInfo(alias);
@@ -457,7 +468,7 @@ QStringList KoResourcePaths::findAllResourcesInternal(const QString &type,
         }
     }
 
-    debugWidgetUtils << "\tresources also from aliases:" << resources.size();
+    dbgResources << "\tresources also from aliases:" << resources.size();
 
     // if the original filter is "input/*", we only want share/input/* and share/krita/input/* here, but not
     // share/*. therefore, use _filter here instead of filter which was split into alias and "*".
@@ -468,8 +479,8 @@ QStringList KoResourcePaths::findAllResourcesInternal(const QString &type,
     prefixResources << filesInDir(getInstallationPrefix() + "share/krita/" + fi.path(), fi.fileName(), false);
     appendResources(&resources, prefixResources, true);
 
-    debugWidgetUtils << "\tresources from installation:" << resources.size();
-    debugWidgetUtils << "=====================================================";
+    dbgResources << "\tresources from installation:" << resources.size();
+    dbgResources << "=====================================================";
 
     return resources;
 }
@@ -492,7 +503,7 @@ QStringList KoResourcePaths::resourceDirsInternal(const QString &type)
         appendResources(&resourceDirs, aliasDirs, true);
     }
 
-    debugWidgetUtils << "resourceDirs: type" << type << resourceDirs;
+    dbgResources << "resourceDirs: type" << type << resourceDirs;
 
     return resourceDirs;
 }
@@ -519,7 +530,7 @@ QString KoResourcePaths::saveLocationInternal(const QString &type, const QString
     if (!d.exists() && create) {
         d.mkpath(path);
     }
-    debugWidgetUtils << "saveLocation: type" << type << "suffix" << suffix << "create" << create << "path" << path;
+    dbgResources << "saveLocation: type" << type << "suffix" << suffix << "create" << create << "path" << path;
 
     return path;
 }
@@ -537,7 +548,7 @@ QString KoResourcePaths::locateInternal(const QString &type, const QString &file
         locations << QStandardPaths::locate(d->mapTypeToQStandardPaths(type),
                                             (alias.endsWith('/') ? alias : alias + '/') + filename, QStandardPaths::LocateFile);
     }
-    debugWidgetUtils << "locate: type" << type << "filename" << filename << "locations" << locations;
+    dbgResources << "locate: type" << type << "filename" << filename << "locations" << locations;
     if (locations.size() > 0) {
         return locations.first();
     }
@@ -549,16 +560,6 @@ QString KoResourcePaths::locateInternal(const QString &type, const QString &file
 QString KoResourcePaths::locateLocalInternal(const QString &type, const QString &filename, bool createDir)
 {
     QString path = saveLocationInternal(type, "", createDir);
-    debugWidgetUtils << "locateLocal: type" << type << "filename" << filename << "CreateDir" << createDir << "path" << path;
+    dbgResources << "locateLocal: type" << type << "filename" << filename << "CreateDir" << createDir << "path" << path;
     return path + '/' + filename;
 }
-
-void KoResourcePaths::setReady()
-{
-    s_instance->d->ready = true;
-}
-
-bool KoResourcePaths::isReady()
-{
-    return s_instance->d->ready;
-}
diff --git a/libs/widgetutils/KoResourcePaths.h b/libs/widgetutils/KoResourcePaths.h
index 853ad89bbc2..5dd831396ab 100644
--- a/libs/widgetutils/KoResourcePaths.h
+++ b/libs/widgetutils/KoResourcePaths.h
@@ -219,18 +219,6 @@ public:
      **/
     static QString locateLocal(const char *type, const QString &filename, bool createDir = false);
 
-    /**
-     * Indicate that resource paths have been initialized and users
-     * of this class may expect to load resources from the proper paths.
-     */
-    static void setReady();
-
-    /**
-     * Return if resource paths have been initialized and users
-     * of this class may expect to load resources from the proper paths.
-     */
-    static bool isReady();
-
 private:
 
     void addResourceTypeInternal(const QString &type, const QString &basetype,
diff --git a/plugins/color/lcms2engine/LcmsEnginePlugin.cpp b/plugins/color/lcms2engine/LcmsEnginePlugin.cpp
index 0d572b5a560..a2df81c249b 100644
--- a/plugins/color/lcms2engine/LcmsEnginePlugin.cpp
+++ b/plugins/color/lcms2engine/LcmsEnginePlugin.cpp
@@ -81,20 +81,13 @@ void lcms2LogErrorHandlerFunction(cmsContext /*ContextID*/, cmsUInt32Number Erro
     qCritical() << "Lcms2 error: " << ErrorCode << Text;
 }
 
-K_PLUGIN_FACTORY_WITH_JSON(PluginFactory, "kolcmsengine.json",
-                           registerPlugin<LcmsEnginePlugin>();)
+K_PLUGIN_FACTORY_WITH_JSON(PluginFactory, "kolcmsengine.json", registerPlugin<LcmsEnginePlugin>();)
 
 LcmsEnginePlugin::LcmsEnginePlugin(QObject *parent, const QVariantList &)
     : QObject(parent)
 {
-    // We need all resource paths to be properly initialized via KisApplication, otherwise we will
-    // initialize this instance with lacking color profiles which will cause lookup errors later on.
-
-    KIS_ASSERT_X(KoResourcePaths::isReady() ||
-                 (QApplication::instance()->applicationName() != "krita" &&
-                  QApplication::instance()->applicationName() != "krita.exe"),
-                 "LcmsEnginePlugin::LcmsEnginePlugin", "Resource paths are not ready yet.");
-
+    KoResourcePaths::addResourceType("icc_profiles", "data", "/color/icc");
+    KoResourcePaths::addResourceType("icc_profiles", "data", "/profiles/");
 
     // Set the lmcs error reporting function
     cmsSetLogErrorHandler(&lcms2LogErrorHandlerFunction);
diff --git a/sdk/tests/testutil.h b/sdk/tests/testutil.h
index 0cc62921f82..79dfa16ee6d 100644
--- a/sdk/tests/testutil.h
+++ b/sdk/tests/testutil.h
@@ -25,6 +25,7 @@
 #include <QTime>
 #include <QDir>
 
+#include <KoConfig.h>
 #include <KoColorSpace.h>
 #include <KoColorSpaceRegistry.h>
 #include <KoColorProfile.h>
@@ -524,4 +525,52 @@ bool checkHierarchy(KisNodeSP root, const QStringList &expected);
 
 }
 
+#include <QtTest/qtestsystem.h>
+#include <set>
+
+#include <QtTest/qtestsystem.h>
+#include <set>
+
+#ifndef QT_NO_OPENGL
+#  define QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS \
+    extern Q_TESTLIB_EXPORT std::set<QByteArray> *(*qgpu_features_ptr)(const QString &); \
+    extern Q_GUI_EXPORT std::set<QByteArray> *qgpu_features(const QString &);
+#  define QTEST_ADD_GPU_BLACKLIST_SUPPORT \
+    qgpu_features_ptr = qgpu_features;
+#else
+#  define QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
+#  define QTEST_ADD_GPU_BLACKLIST_SUPPORT
+#endif
+
+#if defined(QT_NETWORK_LIB)
+#  include <QtTest/qtest_network.h>
+#endif
+#include <QtTest/qtest_widgets.h>
+
+#ifdef QT_KEYPAD_NAVIGATION
+#  define QTEST_DISABLE_KEYPAD_NAVIGATION QApplication::setNavigationMode(Qt::NavigationModeNone);
+#else
+#  define QTEST_DISABLE_KEYPAD_NAVIGATION
+#endif
+
+#define KISTEST_MAIN(TestObject) \
+QT_BEGIN_NAMESPACE \
+QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS \
+QT_END_NAMESPACE \
+int main(int argc, char *argv[]) \
+{ \
+    qputenv("EXTRA_RESOURCE_DIRS", QByteArray(KRITA_INSTALL_DIR)); \
+    QApplication app(argc, argv); \
+    app.setAttribute(Qt::AA_Use96Dpi, true); \
+    QTEST_DISABLE_KEYPAD_NAVIGATION \
+    QTEST_ADD_GPU_BLACKLIST_SUPPORT \
+    TestObject tc; \
+    QTEST_SET_MAIN_SOURCE_PATH \
+    return QTest::qExec(&tc, argc, argv); \
+}
+
+
+
+
+
 #endif


More information about the kimageshop mailing list