From 379cb7294141e337bec6bd8eda1279f604e21ea5 Mon Sep 17 00:00:00 2001 From: Jeff Patterson Date: Sat, 3 Oct 2026 11:39:48 -0500 Subject: [PATCH] Fixed tst_importcategory on macOS The test set the elements folder in a settings file under XDG_CONFIG_HOME, which macOS does not read, so common:// paths did not resolve and the first placement failed. It now passes --common-elements-dir. --- tests/qttest/tst_importcategory.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/tests/qttest/tst_importcategory.cpp b/tests/qttest/tst_importcategory.cpp index 6ea53d641..c8345b08b 100644 --- a/tests/qttest/tst_importcategory.cpp +++ b/tests/qttest/tst_importcategory.cpp @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include -#include #include #include #include @@ -27,14 +26,6 @@ class tst_importcategory : public QObject { const QString path = m_dir.filePath(QStringLiteral("probe.js")); const QString home = m_dir.filePath(QStringLiteral("home")); - QDir().mkpath(home + QStringLiteral("/config/QElectroTech")); - //The shipped collection, so common:// paths resolve; forward - //slashes, as Qt reads a backslash here as an escape. - QFile conf(home + QStringLiteral("/config/QElectroTech/QElectroTech.conf")); - if (!conf.open(QIODevice::WriteOnly)) return {}; - conf.write("[elements-collections]\ncommon-collection-path=" - QET_ELEMENTS_DIR "\n"); - conf.close(); QFile f(path); if (!f.open(QIODevice::WriteOnly)) return {}; f.write(script.toUtf8()); @@ -49,8 +40,12 @@ class tst_importcategory : public QObject env.insert(QStringLiteral("TMPDIR"), m_dir.path()); QProcess proc; proc.setProcessEnvironment(env); + //The shipped collection, so common:// paths resolve. Given + //on the command line: macOS does not read a settings file + //under XDG_CONFIG_HOME. proc.start(QStringLiteral(QET_TEST_BINARY_PATH), - {QStringLiteral("--run"), path, project}); + {QStringLiteral("--common-elements-dir=" QET_ELEMENTS_DIR "/"), + QStringLiteral("--run"), path, project}); if (!proc.waitForFinished(120000)) return {}; const QString out = QString::fromUtf8(proc.readAllStandardOutput() + proc.readAllStandardError());