Files
Marcos Paulo cd43ea488e
ci / ci (macos-latest) (push) Has been cancelled
ci / ci (ubuntu-latest) (push) Has been cancelled
ci / ci (windows-latest) (push) Has been cancelled
feat: notescraft-lottie player crate, egui lottie_icon painter, icon_sheet review example, first icon animation set
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 19:42:57 -03:00

35 lines
1.2 KiB
Rust

//! Public metadata and input contract.
use notescraft_lottie::Animation;
const STROKE: &str = include_str!("fixtures/stroke.json");
fn near(actual: f32, expected: f32) {
assert!((actual - expected).abs() < 0.001, "{actual} != {expected}");
}
#[test]
fn composition_metadata_is_available_without_sampling() {
let animation = Animation::parse(STROKE).expect("valid handwritten fixture");
near(animation.size().0, 24.0);
near(animation.size().1, 24.0);
near(animation.frame_rate(), 10.0);
near(animation.first_frame(), 0.0);
near(animation.last_frame(), 10.0);
near(animation.duration_secs(), 1.0);
}
#[test]
fn markers_preserve_names_absolute_frames_and_durations() {
let animation = Animation::parse(include_str!("fixtures/markers.json")).expect("fixture");
near(animation.first_frame(), 10.0);
near(animation.last_frame(), 30.0);
near(animation.duration_secs(), 2.0);
let marker = animation.marker("unlock").expect("named marker");
assert_eq!(marker.name, "unlock");
near(marker.frame, 12.0);
near(marker.duration, 5.0);
near(animation.marker("locked").expect("zero duration marker").duration, 0.0);
assert!(animation.marker("missing").is_none());
}