#![cfg(feature = "software_renderer")]
use raylib::test_harness::with_headless;
const ANIM_PATH: &str = "raylib-sys/raylib/examples/models/resources/models/iqm/guyanim.iqm";
const MODEL_PATH: &str = "raylib-sys/raylib/examples/models/resources/models/iqm/guy.iqm";
#[test]
fn model_animations_load_and_drop() {
with_headless(64, 64, |rl, thread| {
if std::path::Path::new(ANIM_PATH).exists() {
let anims = rl
.load_model_animations(thread, ANIM_PATH)
.expect("animations load");
assert!(!anims.is_empty(), "expected >= 1 animation");
drop(anims); } else {
eprintln!("SKIP: animation asset not found at {ANIM_PATH}");
}
});
}
#[test]
fn model_animations_partial_index_then_drop() {
with_headless(64, 64, |rl, thread| {
if std::path::Path::new(ANIM_PATH).exists() {
let anims = rl
.load_model_animations(thread, ANIM_PATH)
.expect("animations load");
assert!(!anims.is_empty(), "expected >= 1 animation");
let frame_count = anims[0].keyframeCount;
let _ = frame_count; } else {
eprintln!("SKIP: animation asset not found at {ANIM_PATH}");
}
});
}
#[test]
fn model_animations_slice_views_in_bounds() {
with_headless(64, 64, |rl, thread| {
if std::path::Path::new(ANIM_PATH).exists() {
let mut anims = rl
.load_model_animations(thread, ANIM_PATH)
.expect("animations load");
let count = anims.len();
assert!(count > 0);
assert_eq!(anims.as_slice().len(), count);
for i in 0..count {
let _ = anims[i].keyframeCount; }
assert_eq!(anims.as_mut_slice().len(), count);
drop(anims);
} else {
eprintln!("SKIP: animation asset not found at {ANIM_PATH}");
}
});
}
#[test]
fn model_animations_drop_order_vs_model() {
with_headless(64, 64, |rl, thread| {
let both =
std::path::Path::new(MODEL_PATH).exists() && std::path::Path::new(ANIM_PATH).exists();
if both {
{
let model = rl.load_model(thread, MODEL_PATH).expect("model load");
let anims = rl
.load_model_animations(thread, ANIM_PATH)
.expect("animations load");
assert!(!anims.is_empty(), "expected >= 1 animation");
drop(anims); drop(model);
}
{
let model = rl.load_model(thread, MODEL_PATH).expect("model load");
let anims = rl
.load_model_animations(thread, ANIM_PATH)
.expect("animations load");
assert!(!anims.is_empty(), "expected >= 1 animation");
drop(model); drop(anims);
}
} else {
eprintln!("SKIP: IQM model/anim assets not found");
}
});
}