Files
gtk-ahfail/crates/ahfail-ui/tests/volume_tests.rs
Asger Geel Weirsøe 74e0f544a0 feat: add volume save/restore on failure/unload
On the first failed unlock attempt, save the current system volume and
mute state then set volume to maximum unmuted; restore on g_module_unload.
A lock file under XDG_RUNTIME_DIR prevents double-acquisition when
multiple gtklock windows are active.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 09:50:49 +02:00

13 lines
383 B
Rust

#[test]
fn lock_file_created_and_prevents_second_acquisition() {
let dir = tempfile::tempdir().unwrap();
let lock_path = dir.path().join("ahfail.lock");
let acquired = ahfail_ui::volume::try_acquire_lock(&lock_path);
assert!(acquired);
assert!(lock_path.exists());
let acquired2 = ahfail_ui::volume::try_acquire_lock(&lock_path);
assert!(!acquired2);
}