add unlock/exit buttons to home screen

This commit is contained in:
jfmonty2 committed 2026-11-18 20:12:22 -05:00
1 parent b2a7e5759a
commit 3c06f7e536
3 files changed
+112 -6

No files matched your search

+21 -1
View File
@@ -4,6 +4,7 @@ use gpui_kit::{
};
use gpui_omarchy::ActiveTheme;
mod assets;
mod components;
mod config;
mod db;
@@ -68,7 +69,7 @@ fn main() {
// Icons are read through the asset source, so register the bundle.
gpui_kit::application()
.with_assets(gpui_kit::assets::Assets)
.with_assets(assets::CreddyAssets)
.run(|app| {
launch(app, app_config, app_session);
app.activate(true);
@@ -204,4 +205,23 @@ mod tests {
assert!(is_unlocked(cx));
assert_eq!(cx.read(|cx| cx.global::<AppConfig>().rehide_ms), 5000);
}
#[gpui_kit::test]
fn test_lock(cx: &mut TestAppContext) {
let env = TestEnv::new().unwrap();
env.db().unwrap();
let window = open_app(&env, cx);
fill(window, "passphrase", TEST_PASSPHRASE, cx);
click(window, "submit", cx);
assert!(is_unlocked(cx));
click(window, "lock", cx);
assert!(cx.read(|cx| matches!(cx.global::<AppSession>(), AppSession::Locked)));
// The unlock screen should be a new one, not the old one with the passphrase still in it.
// The masked input doesn't expose its value, so check by submitting it as-is.
click(window, "submit", cx);
assert_eq!(error_message(window, cx).as_deref(), Some("Passphrase is empty."));
assert!(!is_unlocked(cx));
}
}