From 3c40bf5bd12b2a6164f7541f92ca1e460b6c9e68 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Sun, 18 Oct 2026 10:06:15 +1300 Subject: [PATCH] Tests: fix the two tests that fail on Windows Windows CI stopped running tests (bdd3b2050) after these two failed: - tst_reporttextafterinfo wrote "columns numbered from 1" to a .conf under XDG_CONFIG_HOME, which only Linux reads. On Windows the setting stayed in the registry, columns counted from 0 and the report read 1-C8. The setting now goes to an INI file QET_SETTINGS_DIR points at (#1178), read on every system. - tst_projectlock::readOnlyFolderDoesNotBlock relies on a read-only folder refusing new files. Windows ignores that flag on folders, so the lock was taken; the case is skipped there. Co-Authored-By: Claude Opus 5.5 --- tests/qttest/tst_projectlock.cpp | 4 +++- tests/qttest/tst_reporttextafterinfo.cpp | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/qttest/tst_projectlock.cpp b/tests/qttest/tst_projectlock.cpp index 8befad6e2..225d14615 100644 --- a/tests/qttest/tst_projectlock.cpp +++ b/tests/qttest/tst_projectlock.cpp @@ -214,7 +214,9 @@ class tst_projectlock : public QObject void readOnlyFolderDoesNotBlock() { -#ifndef Q_OS_WIN +#ifdef Q_OS_WIN + QSKIP("a read-only folder still takes new files on Windows"); +#else if (geteuid() == 0) QSKIP("root can write anywhere"); #endif diff --git a/tests/qttest/tst_reporttextafterinfo.cpp b/tests/qttest/tst_reporttextafterinfo.cpp index 4f8cc4acc..ecc015a9a 100644 --- a/tests/qttest/tst_reporttextafterinfo.cpp +++ b/tests/qttest/tst_reporttextafterinfo.cpp @@ -69,10 +69,12 @@ private slots: f.close(); // Columns numbered from 1, as QElectroTech's settings page - // shows by default + // shows by default. Written to an INI file QET_SETTINGS_DIR + // points at: on Windows the settings are in the registry + // otherwise, and the columns would count from 0 const QString home = m_dir.filePath(tag + QStringLiteral("-home")); - QVERIFY(QDir().mkpath(home + QStringLiteral("/config/QElectroTech"))); - QFile conf(home + QStringLiteral("/config/QElectroTech/QElectroTech.conf")); + QVERIFY(QDir().mkpath(home + QStringLiteral("/settings/QElectroTech"))); + QFile conf(home + QStringLiteral("/settings/QElectroTech/QElectroTech.ini")); QVERIFY(conf.open(QIODevice::WriteOnly)); conf.write("[General]\nborder-columns_0=false\n"); conf.close(); @@ -80,6 +82,7 @@ private slots: QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert(QStringLiteral("QT_QPA_PLATFORM"), QStringLiteral("offscreen")); env.insert(QStringLiteral("QET_ENABLE_SCRIPTING"), QStringLiteral("1")); + env.insert(QStringLiteral("QET_SETTINGS_DIR"), home + QStringLiteral("/settings")); env.insert(QStringLiteral("HOME"), home); env.insert(QStringLiteral("XDG_CONFIG_HOME"), home + QStringLiteral("/config")); env.insert(QStringLiteral("XDG_DATA_HOME"), home + QStringLiteral("/data"));