Files
DualFloatingClock/tests/autostart_manager_test.cpp
T
sebastian 45fc172fc8
Build and Release DualFloatingClock / build-linux (push) Failing after 32s
CI Build / build (macos-latest) (push) Canceled after 0s
CI Build / build (windows-latest) (push) Canceled after 0s
Build and Release DualFloatingClock / build-macos (push) Canceled after 0s
Build and Release DualFloatingClock / build-windows (push) Canceled after 0s
Build and Release DualFloatingClock / generate-changelog (push) Canceled after 0s
Build and Release DualFloatingClock / create-release (push) Canceled after 0s
feat: rename project to DualFloatingClock, add README, public release
- Full rename: CMake target, bundle, LaunchAgent label
  (com.dualfloatingclock.clock), QSettings org/app, tray tooltip,
  icns resource, build scripts, CI workflows, sample config
- Config XML: new root DualFloatingClockConfig; reader accepts legacy
  ClouckConfig root for painless migration of existing settings
- README rewritten: fork provenance (ivaquero/clouck), features, build,
  tests, usage
- Drop stale README-CN.md
2026-08-27 22:36:05 +03:00

49 lines
1.5 KiB
C++

#include "autostart_manager.h"
#include <QTemporaryDir>
#include <QtTest>
class AutoStartManagerTest : public QObject
{
Q_OBJECT
private slots:
void createsRunAtLoadLaunchAgent();
void roundTripsPlistRoundTrip();
};
void AutoStartManagerTest::createsRunAtLoadLaunchAgent()
{
const QString executablePath = "/Applications/DualFloatingClock.app/Contents/MacOS/DualFloatingClock";
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/>"));
}
void AutoStartManagerTest::roundTripsPlistRoundTrip()
{
// Disabled-by-default: no plist written when enable is false,
// enableForPath + disable must leave no residue.
QTemporaryDir home;
QVERIFY(home.isValid());
qputenv("HOME", home.path().toUtf8());
QVERIFY(AutoStartManager::disable());
QVERIFY(!QFile::exists(AutoStartManager::launchAgentPath()));
QVERIFY(!AutoStartManager::isEnabled());
QVERIFY(AutoStartManager::enableForPath("/Applications/DualFloatingClock.app/Contents/MacOS/DualFloatingClock"));
QVERIFY(AutoStartManager::isEnabled());
QVERIFY(QFile::exists(AutoStartManager::launchAgentPath()));
QVERIFY(AutoStartManager::disable());
QVERIFY(!AutoStartManager::isEnabled());
}
QTEST_APPLESS_MAIN(AutoStartManagerTest)
#include "autostart_manager_test.moc"