use oxiui_theme::{elevation_to_shadow, ShadowSpec};
#[test]
fn test_shadow_spec_to_pixel_color() {
let spec = ShadowSpec::new(0.0, 0.0, 0.0, [255, 0, 0, 128]);
assert_eq!(spec.to_pixel_color(), 0x80FF_0000);
}
#[test]
fn test_shadow_spec_to_pixel_color_transparent() {
let spec = ShadowSpec::new(0.0, 0.0, 0.0, [0, 0, 0, 0]);
assert_eq!(spec.to_pixel_color(), 0x0000_0000);
}
#[test]
fn test_shadow_spec_to_pixel_color_white() {
let spec = ShadowSpec::new(0.0, 0.0, 0.0, [255, 255, 255, 255]);
assert_eq!(spec.to_pixel_color(), 0xFFFF_FFFF);
}
#[test]
fn test_elevation_to_shadow_scale() {
let s2 = elevation_to_shadow(2.0);
let s8 = elevation_to_shadow(8.0);
assert!(
s8.blur > s2.blur,
"elevation 8 blur ({}) must exceed elevation 2 blur ({})",
s8.blur,
s2.blur,
);
}
#[test]
fn test_elevation_to_shadow_zero_is_invisible() {
let s = elevation_to_shadow(0.0);
assert!(
s.is_invisible(),
"elevation 0 shadow must be invisible (alpha=0)"
);
}
#[test]
fn test_elevation_to_shadow_negative_clamped() {
let s = elevation_to_shadow(-5.0);
assert!(
s.is_invisible(),
"negative elevation must yield invisible shadow"
);
}