Skip to content

A fast file manager for Windows and macOS that never freezes: tabs, dual panes, archives as folders, Quick Look-style previews. A File Explorer and Finder alternative written in Rust.

A by-hand test of auto-hide and the sign-in task on a real desktop

gelenmedya646117b28742
diff --git a/crates/rf-win/src/taskbar_autohide.rs b/crates/rf-win/src/taskbar_autohide.rs
index 7acfc38d..e4dec805 100644
--- a/crates/rf-win/src/taskbar_autohide.rs
+++ b/crates/rf-win/src/taskbar_autohide.rs
@@ -85,3 +85,36 @@ mod tests {
let _ = std::fs::remove_dir_all(&dir);
}
}
+
+#[cfg(test)]
+mod live {
+ /// By hand, on a real desktop (it changes the taskbar's auto-hide for a moment and puts it back; makes the sign-in task and
+ /// removes it): `cargo test -p rf-win --lib taskbar_autohide::live -- --ignored --nocapture`.
+ #[test]
+ #[ignore]
+ fn engage_and_release_put_the_users_value_back_and_the_sign_in_task_comes_and_goes() {
+ let dir = std::env::temp_dir().join(format!("rf-autohide-live-{}", std::process::id()));
+ std::fs::create_dir_all(&dir).unwrap();
+ let before = super::get().expect("Explorer's taskbar");
+ super::engage(&dir);
+ assert_eq!(super::get(), Some(true), "auto-hide on while the hide is wanted");
+ assert_eq!(super::noted(&dir), Some(before), "the user's value noted");
+ super::engage(&dir);
+ assert_eq!(super::noted(&dir), Some(before), "a second engage keeps the first note");
+ super::release(&dir);
+ assert_eq!(super::get(), Some(before), "the user's value is back");
+ assert_eq!(super::noted(&dir), None, "and the note is gone");
+ let _ = std::fs::remove_dir_all(&dir);
+
+ let exe = std::env::current_exe().unwrap();
+ let name = format!("rustyfiles start ({})", std::env::var("USERNAME").unwrap_or_default());
+ let query = || std::process::Command::new("schtasks").args(["/Query", "/TN", &name]).output().map(|o| o.status.success()).unwrap_or(false);
+ crate::dialogs::set_sign_in_task(&exe, true).expect("made without administrator rights");
+ assert!(query(), "the task is there");
+ let xml = std::process::Command::new("schtasks").args(["/Query", "/TN", &name, "/XML"]).output().unwrap();
+ let xml = String::from_utf8_lossy(&xml.stdout).into_owned();
+ eprintln!("{}", xml.lines().filter(|l| l.contains("LogonTrigger") || l.contains("Priority") || l.contains("Command") || l.contains("Arguments") || l.contains("RunLevel")).collect::<Vec<_>>().join("\n"));
+ crate::dialogs::set_sign_in_task(&exe, false).unwrap();
+ assert!(!query(), "and gone");
+ }
+}