mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-10 06:04:12 +02:00
Give the toolbar and gesture settings tests their own settings scope
tst_toolbarsettings, tst_diagramtoolbarsettings and tst_gesturesettings never set an organization or application name. On macOS and Linux, QSettings then falls back to an "Unknown Organization" file, so the tests pass there. On Windows it has no registry key: every write is dropped and every read gives the default, and nine checks fail. Each test now sets its own organization and application name in initTestCase(), as tst_scriptingsetting and tst_sheetbackgroundsetting already do. That also keeps the tests away from the settings of the account that runs them. Tests only; no change to the app or its files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <QAction>
|
||||
#include <QComboBox>
|
||||
#include <QCoreApplication>
|
||||
#include <QListWidget>
|
||||
#include <QPushButton>
|
||||
#include <QSettings>
|
||||
@@ -86,6 +87,11 @@ private slots:
|
||||
void initTestCase()
|
||||
{
|
||||
QStandardPaths::setTestModeEnabled(true);
|
||||
//A scope of this test's own. Without an organization name,
|
||||
//QSettings on Windows has no registry key: it drops every
|
||||
//write and reads only defaults.
|
||||
QCoreApplication::setOrganizationName(QStringLiteral("QElectroTech-tst_diagramtoolbarsettings"));
|
||||
QCoreApplication::setApplicationName(QStringLiteral("tst_diagramtoolbarsettings"));
|
||||
clearSettings();
|
||||
//A few of the diagram editor's commands, as it registers them
|
||||
for (const QString &id : {QStringLiteral("diagrameditor.copy"),
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <QAction>
|
||||
#include <QComboBox>
|
||||
#include <QCoreApplication>
|
||||
#include <QDropEvent>
|
||||
#include <QListWidget>
|
||||
#include <QMainWindow>
|
||||
@@ -64,6 +65,11 @@ private slots:
|
||||
void initTestCase()
|
||||
{
|
||||
QStandardPaths::setTestModeEnabled(true);
|
||||
//A scope of this test's own. Without an organization name,
|
||||
//QSettings on Windows has no registry key: it drops every
|
||||
//write and reads only defaults.
|
||||
QCoreApplication::setOrganizationName(QStringLiteral("QElectroTech-tst_gesturesettings"));
|
||||
QCoreApplication::setApplicationName(QStringLiteral("tst_gesturesettings"));
|
||||
QSettings().remove(QStringLiteral("diagrameditor"));
|
||||
addCommand(QStringLiteral("diagrameditor.copy"), QStringLiteral("Copier"));
|
||||
addCommand(QStringLiteral("diagrameditor.cut"), QStringLiteral("Couper"));
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QCoreApplication>
|
||||
#include <QDockWidget>
|
||||
#include <QMainWindow>
|
||||
#include <QSettings>
|
||||
@@ -48,6 +49,11 @@ private slots:
|
||||
void initTestCase()
|
||||
{
|
||||
QStandardPaths::setTestModeEnabled(true);
|
||||
//A scope of this test's own. Without an organization name,
|
||||
//QSettings on Windows has no registry key: it drops every
|
||||
//write and reads only defaults.
|
||||
QCoreApplication::setOrganizationName(QStringLiteral("QElectroTech-tst_toolbarsettings"));
|
||||
QCoreApplication::setApplicationName(QStringLiteral("tst_toolbarsettings"));
|
||||
QSettings().remove(QStringLiteral("toolbars"));
|
||||
|
||||
m_window = new QMainWindow();
|
||||
|
||||
Reference in New Issue
Block a user