Add: states to use all 7 rows

This commit is contained in:
DaZuo0122
2026-02-14 22:15:58 +08:00
parent eddf4b9481
commit c0efb3915b
8 changed files with 283 additions and 20 deletions

View File

@@ -252,7 +252,7 @@ fn default_animation_for_state(state: sprimo_protocol::v1::FrontendState) -> &'s
sprimo_protocol::v1::FrontendState::Active => "active",
sprimo_protocol::v1::FrontendState::Success => "success",
sprimo_protocol::v1::FrontendState::Error => "error",
sprimo_protocol::v1::FrontendState::Dragging => "idle",
sprimo_protocol::v1::FrontendState::Dragging => "dragging",
sprimo_protocol::v1::FrontendState::Hidden => "idle",
}
}
@@ -284,6 +284,22 @@ mod tests {
assert_eq!(snapshot.current_animation, "active");
}
#[test]
fn dragging_state_maps_to_dragging_animation() {
let temp = TempDir::new().expect("tempdir");
let path = temp.path().join("config.toml");
let core = RuntimeCore::new_with_config(path, AppConfig::default(), CapabilityFlags::default())
.expect("core init");
core.apply_command(&FrontendCommand::SetState {
state: FrontendState::Dragging,
ttl_ms: None,
})
.expect("apply");
let snapshot = core.snapshot().read().expect("snapshot lock").clone();
assert_eq!(snapshot.state, FrontendState::Dragging);
assert_eq!(snapshot.current_animation, "dragging");
}
#[test]
fn click_through_flag_is_ignored_and_forced_false() {
let temp = TempDir::new().expect("tempdir");