v0.3.0 : migration des dialogues vers wNim + renommage NimPulse + installeur une-ligne
This commit is contained in:
@@ -8,7 +8,7 @@ import std/[unittest, os]
|
||||
import ../src/config
|
||||
|
||||
# Redirige APPDATA vers un répertoire temporaire pour isoler les fichiers.
|
||||
let tmpApd = getTempDir() / "traytempo_test_apd"
|
||||
let tmpApd = getTempDir() / "nimpulse_test_apd"
|
||||
if dirExists(tmpApd):
|
||||
removeDir(tmpApd)
|
||||
putEnv("APPDATA", tmpApd)
|
||||
@@ -102,11 +102,11 @@ suite "config":
|
||||
writeFile(marker, "")
|
||||
check configDir() == exeDir
|
||||
removeFile(marker)
|
||||
check configDir() == (getEnv("APPDATA") / "TrayTempo")
|
||||
check configDir() == (getEnv("APPDATA") / "NimPulse")
|
||||
|
||||
test "acquireSingleInstance detects a second lock":
|
||||
check not acquireSingleInstance("TrayTempo_Test_Mutex_0.2.0")
|
||||
check acquireSingleInstance("TrayTempo_Test_Mutex_0.2.0")
|
||||
check not acquireSingleInstance("NimPulse_Test_Mutex_0.2.0")
|
||||
check acquireSingleInstance("NimPulse_Test_Mutex_0.2.0")
|
||||
|
||||
suite "autostart registry":
|
||||
test "setAutostart toggles the Run key and cleans up":
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
## test_dialogs.nim
|
||||
## =================
|
||||
## Test d'intégration de la construction du panneau de réglages : vérifie que la
|
||||
## fenêtre et ses contrôles sont réellement créés (sans lancer la boucle modale,
|
||||
## qui bloquerait). Cela rend observable la création de l'interface, au-delà de
|
||||
## la simple compilation.
|
||||
|
||||
import std/unittest
|
||||
import winim/lean
|
||||
import ../src/dialogs
|
||||
import ../src/config
|
||||
|
||||
proc createParent(): HWND =
|
||||
let hInstance = GetModuleHandleW(nil)
|
||||
var wc: WNDCLASSW
|
||||
wc.lpfnWndProc = cast[WNDPROC](DefWindowProcW)
|
||||
wc.hInstance = hInstance
|
||||
wc.lpszClassName = L"TrayTempoDialogTestClass"
|
||||
discard RegisterClass(&wc)
|
||||
result = CreateWindowExW(0, L"TrayTempoDialogTestClass", L"", WS_OVERLAPPED,
|
||||
0, 0, 0, 0, 0, 0, hInstance, nil)
|
||||
|
||||
suite "dialogs":
|
||||
test "settings dialog window and controls are built":
|
||||
let parent = createParent()
|
||||
check parent != 0
|
||||
|
||||
let hwnd = buildSettingsDialog(parent, defaultConfig())
|
||||
check hwnd != 0
|
||||
# La fenêtre doit avoir au moins un contrôle enfant (champ, bouton, etc.).
|
||||
check GetWindow(hwnd, GW_CHILD) != 0
|
||||
|
||||
discard DestroyWindow(hwnd)
|
||||
discard DestroyWindow(parent)
|
||||
@@ -80,7 +80,7 @@ suite "stats":
|
||||
var st = initStats()
|
||||
st.daily["2026-08-13"] = 3
|
||||
st.daily["2026-08-14"] = 5
|
||||
let path = getTempDir() / "traytempo_test_export.csv"
|
||||
let path = getTempDir() / "nimpulse_test_export.csv"
|
||||
check st.exportCsv(path)
|
||||
let content = readFile(path)
|
||||
check content.contains("date,count")
|
||||
@@ -91,7 +91,7 @@ suite "stats":
|
||||
suite "stats persistence":
|
||||
test "saveStats then loadStats round-trips":
|
||||
# Isole l'écriture disque dans un APPDATA temporaire.
|
||||
let tmpApd = getTempDir() / "traytempo_test_stats"
|
||||
let tmpApd = getTempDir() / "nimpulse_test_stats"
|
||||
if dirExists(tmpApd):
|
||||
removeDir(tmpApd)
|
||||
putEnv("APPDATA", tmpApd)
|
||||
|
||||
@@ -19,9 +19,9 @@ proc createTestWindow(): HWND =
|
||||
var wc: WNDCLASSW
|
||||
wc.lpfnWndProc = cast[WNDPROC](DefWindowProcW)
|
||||
wc.hInstance = hInstance
|
||||
wc.lpszClassName = L"TrayTempoTestClass"
|
||||
wc.lpszClassName = L"NimPulseTestClass"
|
||||
discard RegisterClass(&wc)
|
||||
result = CreateWindowExW(0, L"TrayTempoTestClass", L"", WS_OVERLAPPED,
|
||||
result = CreateWindowExW(0, L"NimPulseTestClass", L"", WS_OVERLAPPED,
|
||||
0, 0, 0, 0, 0, 0, hInstance, nil)
|
||||
|
||||
suite "tray integration":
|
||||
@@ -34,7 +34,7 @@ suite "tray integration":
|
||||
check phaseIcon(phase) != 0
|
||||
|
||||
# Ajout de l'icône dans le tray (Shell_NotifyIcon NIM_ADD -> bool).
|
||||
check addTrayIcon(hwnd, phaseIcon(phIdle), "TrayTempo") == true
|
||||
check addTrayIcon(hwnd, phaseIcon(phIdle), "NimPulse") == true
|
||||
|
||||
# Mise à jour de l'icône et du tooltip.
|
||||
updateTrayIcon(hwnd, phaseIcon(phWorking), "Travail: 25:00")
|
||||
|
||||
Reference in New Issue
Block a user