Merge pull request #1517 from ispyisail/fix/apptest-standardpaths-testmode

Fix app tests hanging on an autosave and rewriting the user's files
This commit is contained in:
ispyisail
2026-10-18 10:02:27 +13:00
committed by GitHub
2 changed files with 7 additions and 9 deletions
+6
View File
@@ -36,6 +36,7 @@
#include <QApplication>
#include <QCoreApplication>
#include <QSettings>
#include <QStandardPaths>
#include <QTemporaryDir>
#include <QtTest>
@@ -86,6 +87,11 @@ inline QAction *action(const QString &name)
template <typename Test>
int run(int argc, char **argv)
{
//Some files are written to the standard folders whatever
//--data-dir says (qet-assistant.json, with the live-mode token, as
//the editor opens): test mode, before anything is written, keeps
//them away from the user's own
QStandardPaths::setTestModeEnabled(true);
QApplication app(argc, argv);
QCoreApplication::setOrganizationName("QElectroTech");
QCoreApplication::setApplicationName("QElectroTech");
+1 -9
View File
@@ -25,7 +25,6 @@
#include <QJsonDocument>
#include <QJsonObject>
#include <QSignalBlocker>
#include <QStandardPaths>
/**
qet-assistant.json names the user and company collections, and the qet
@@ -88,13 +87,6 @@ private slots:
}
};
int main(int argc, char **argv)
{
//AssistantInfo writes to the standard data folder, whatever
//--data-dir says, and QETApp writes it as its editor opens: test
//mode from the very start keeps the user's own file out of reach.
QStandardPaths::setTestModeEnabled(true);
return QetAppTest::run<tst_assistantinfopaths>(argc, argv);
}
QET_APP_TEST_MAIN(tst_assistantinfopaths)
#include "tst_assistantinfopaths.moc"