tests: ignore missing index.theme in ScalableTest::test_scalableDuplicates()
It currently happens when configuring with SKIP_INSTALL_ICONS=ON, as that skips also the generation of the index.theme files that this test tries to load.
This commit is contained in:
parent
67905087c6
commit
af78948294
@ -20,6 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
|
#include <QFileInfo>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
@ -164,13 +165,19 @@ class ScalableTest : public QObject
|
|||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void test_scalable_data(bool checkInherits=true)
|
void test_scalable_data(bool checkInherits=true)
|
||||||
{
|
{
|
||||||
|
bool hasData = false;
|
||||||
for (auto dir : ICON_DIRS) {
|
for (auto dir : ICON_DIRS) {
|
||||||
QString themeDir = PROJECT_SOURCE_DIR + QStringLiteral("/") + dir;
|
QString themeDir = PROJECT_SOURCE_DIR + QStringLiteral("/") + dir;
|
||||||
|
QString themeFile = themeDir + QStringLiteral("/index.theme");
|
||||||
|
if (!QFileInfo::exists(themeFile)) {
|
||||||
|
qWarning() << themeFile << "does not exist, skipping collecting the data from it";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
QHash<KIconLoaderDummy::Context, QList<std::shared_ptr<Dir>>> contextHash;
|
QHash<KIconLoaderDummy::Context, QList<std::shared_ptr<Dir>>> contextHash;
|
||||||
QHash<KIconLoaderDummy::Context, QString> contextStringHash;
|
QHash<KIconLoaderDummy::Context, QString> contextStringHash;
|
||||||
|
|
||||||
QSettings config(themeDir + QStringLiteral("/index.theme"), QSettings::IniFormat);
|
QSettings config(themeFile, QSettings::IniFormat);
|
||||||
auto keys = config.allKeys();
|
auto keys = config.allKeys();
|
||||||
|
|
||||||
config.beginGroup("Icon Theme");
|
config.beginGroup("Icon Theme");
|
||||||
@ -235,8 +242,12 @@ private Q_SLOTS:
|
|||||||
// Gets rid of the stupid second hash
|
// Gets rid of the stupid second hash
|
||||||
auto contextId = QString(dir + QStringLiteral(":") + contextStringHash[key]).toLatin1();
|
auto contextId = QString(dir + QStringLiteral(":") + contextStringHash[key]).toLatin1();
|
||||||
QTest::newRow(contextId.constData()) << key << contextHash[key];
|
QTest::newRow(contextId.constData()) << key << contextHash[key];
|
||||||
|
hasData = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!hasData) {
|
||||||
|
QSKIP("no available index.theme files");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_scalableDuplicates_data()
|
void test_scalableDuplicates_data()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user