From 43cc013e543c212c526ff1e949e8bb6689a4102e Mon Sep 17 00:00:00 2001 From: Beat Hangartner Date: Tue, 6 Oct 2026 10:53:10 +0200 Subject: [PATCH] Fix tst_elementautonumids on macOS: give the binary its settings through QET_SETTINGS_DIR duplicatesAreNotNumberedWhenSwitchedOff turns two preferences off by writing /config/QElectroTech/QElectroTech.conf and pointing XDG_CONFIG_HOME there. Only Linux reads settings from that file. macOS keeps them in the system preferences, so the binary never saw the two preferences, numbered the pasted duplicates anyway, and the test failed on macOS, on master too. Write the file where QET_SETTINGS_DIR points instead (#1178), and set that variable for every run of the binary, so no run reads the user's own settings either. No file-format change. Tests: tst_elementautonumids fails on master on macOS and passes with this change. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Beat Hangartner --- tests/qttest/tst_elementautonumids.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/qttest/tst_elementautonumids.cpp b/tests/qttest/tst_elementautonumids.cpp index 2b213da82..1c703efda 100644 --- a/tests/qttest/tst_elementautonumids.cpp +++ b/tests/qttest/tst_elementautonumids.cpp @@ -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);