use bone_ui::Theme;

#[test]
fn light_theme_default_snapshot() {
    insta::assert_ron_snapshot!("theme_light", Theme::light());
}

#[test]
fn dark_theme_default_snapshot() {
    insta::assert_ron_snapshot!("theme_dark", Theme::dark());
}

#[test]
fn round_trip_light_through_ron_is_stable() {
    assert_round_trip_stable(&Theme::light());
}

#[test]
fn round_trip_dark_through_ron_is_stable() {
    assert_round_trip_stable(&Theme::dark());
}

fn assert_round_trip_stable(theme: &Theme) {
    let Ok(first) = ron::ser::to_string(theme) else {
        panic!("first serialize failed");
    };
    let Ok(parsed) = ron::de::from_str::<Theme>(&first) else {
        panic!("deserialize failed");
    };
    let Ok(second) = ron::ser::to_string(&parsed) else {
        panic!("second serialize failed");
    };
    assert_eq!(first, second);
}
