Merge pull request #1332 from bhangart/fix/autonumids-settings-dir
Linux build and tests / Build and test (Qt 6, Debug) (push) Failing after 1m49s

Fix tst_elementautonumids on macOS and Windows: pass its settings through QET_SETTINGS_DIR
This commit is contained in:
Laurent Trinques
2026-10-06 16:57:40 +02:00
committed by GitHub
+6 -2
View File
@@ -47,14 +47,18 @@ class tst_elementautonumids : public QObject
{
const QString home = m_dir.filePath(QStringLiteral("home%1").arg(m_run++));
QDir().mkpath(home);
// QET_SETTINGS_DIR, not a file under XDG_CONFIG_HOME: macOS and
// Windows keep the settings elsewhere and would never read it.
const QString settings_dir = home + QStringLiteral("/settings");
if (!m_preferences.isEmpty()) {
QDir().mkpath(home + QStringLiteral("/config/QElectroTech"));
QFile settings(home + QStringLiteral("/config/QElectroTech/QElectroTech.conf"));
QDir().mkpath(settings_dir + QStringLiteral("/QElectroTech"));
QFile settings(settings_dir + QStringLiteral("/QElectroTech/QElectroTech.ini"));
if (settings.open(QIODevice::WriteOnly)) {
settings.write(m_preferences.toUtf8());
}
}
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert(QStringLiteral("QET_SETTINGS_DIR"), settings_dir);
env.insert(QStringLiteral("QT_QPA_PLATFORM"), QStringLiteral("offscreen"));
env.insert(QStringLiteral("QET_ENABLE_SCRIPTING"), QStringLiteral("1"));
env.insert(QStringLiteral("HOME"), home);