feat: dual time zones, autostart, tray icon, config relocation, tests
- Dual clock (primary/secondary time zone) with IANA picker, persisted in XML - AutoStartManager: macOS LaunchAgent (com.clouck.clock, RunAtLoad) - Tray icon: template image, light/dark adaptation, toggle + quit menu - ConfigManager: default path moved to QStandardPaths::AppConfigLocation - Qt Test suite (ConfigManager, AutoStartManager) wired into CTest - GitHub origin renamed to upstream; private Gitea repo as origin
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#include "autostart_manager.h"
|
||||
|
||||
#include <QtTest>
|
||||
|
||||
class AutoStartManagerTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void createsRunAtLoadLaunchAgent();
|
||||
};
|
||||
|
||||
void AutoStartManagerTest::createsRunAtLoadLaunchAgent()
|
||||
{
|
||||
const QString executablePath = "/Applications/Clouck.app/Contents/MacOS/Clouck";
|
||||
const QString contents = AutoStartManager::launchAgentContents(executablePath);
|
||||
|
||||
QVERIFY(contents.contains("<key>ProgramArguments</key>"));
|
||||
QVERIFY(contents.contains(executablePath));
|
||||
QVERIFY(contents.contains("<key>RunAtLoad</key>"));
|
||||
QVERIFY(contents.contains("<true/>"));
|
||||
}
|
||||
|
||||
QTEST_APPLESS_MAIN(AutoStartManagerTest)
|
||||
|
||||
#include "autostart_manager_test.moc"
|
||||
@@ -0,0 +1,40 @@
|
||||
#include "config_manager.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QTemporaryDir>
|
||||
#include <QtTest>
|
||||
|
||||
class ConfigManagerTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void roundTripsBothClockTimeZones();
|
||||
void usesAnAbsoluteDefaultSettingsPath();
|
||||
};
|
||||
|
||||
void ConfigManagerTest::roundTripsBothClockTimeZones()
|
||||
{
|
||||
QTemporaryDir directory;
|
||||
QVERIFY(directory.isValid());
|
||||
|
||||
const QString filename = directory.filePath("config.xml");
|
||||
ConfigManager writer;
|
||||
writer.setPrimaryTimeZoneId("Europe/Bucharest");
|
||||
writer.setSecondaryTimeZoneId("America/Los_Angeles");
|
||||
QVERIFY(writer.saveSettings(filename));
|
||||
|
||||
ConfigManager reader;
|
||||
QVERIFY(reader.loadSettings(filename));
|
||||
QCOMPARE(reader.primaryTimeZoneId(), QString("Europe/Bucharest"));
|
||||
QCOMPARE(reader.secondaryTimeZoneId(), QString("America/Los_Angeles"));
|
||||
}
|
||||
|
||||
void ConfigManagerTest::usesAnAbsoluteDefaultSettingsPath()
|
||||
{
|
||||
QVERIFY(QDir::isAbsolutePath(ConfigManager::defaultSettingsPath()));
|
||||
}
|
||||
|
||||
QTEST_APPLESS_MAIN(ConfigManagerTest)
|
||||
|
||||
#include "config_manager_test.moc"
|
||||
Reference in New Issue
Block a user