From af789482941aea45a29a485b44631e06d1dd359f Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Sat, 7 Dec 2024 17:59:16 +0100 Subject: [PATCH] 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. --- autotests/scalabletest.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/autotests/scalabletest.cpp b/autotests/scalabletest.cpp index 1135b0bc..3780cdbe 100644 --- a/autotests/scalabletest.cpp +++ b/autotests/scalabletest.cpp @@ -20,6 +20,7 @@ */ #include +#include #include #include @@ -164,13 +165,19 @@ class ScalableTest : public QObject private Q_SLOTS: void test_scalable_data(bool checkInherits=true) { + bool hasData = false; for (auto dir : ICON_DIRS) { 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>> contextHash; QHash contextStringHash; - QSettings config(themeDir + QStringLiteral("/index.theme"), QSettings::IniFormat); + QSettings config(themeFile, QSettings::IniFormat); auto keys = config.allKeys(); config.beginGroup("Icon Theme"); @@ -235,8 +242,12 @@ private Q_SLOTS: // Gets rid of the stupid second hash auto contextId = QString(dir + QStringLiteral(":") + contextStringHash[key]).toLatin1(); QTest::newRow(contextId.constData()) << key << contextHash[key]; + hasData = true; } } + if (!hasData) { + QSKIP("no available index.theme files"); + } } void test_scalableDuplicates_data()