#![allow(unused)]
use {
super::{
add_one_get, fake_rng,
timeline_mods::{
audio::Audio, clip_slot::ClipSlot, clips::Clips, lanes::Lanes, markers::Markers,
notes::Notes, points::Points, timeline::TimeLine, video::Video, warps::Warps,
},
},
fake::{Dummy, Fake, Faker},
serde::{Deserialize, Serialize},
};
#[derive(Debug, Deserialize, Serialize, Clone, Dummy)]
enum SceneSequenceEnum {
Timeline(TimeLine),
Lanes(Lanes),
Notes(Notes),
Clips(Clips),
ClipSlot(ClipSlot),
Markers(Markers),
Warps(Warps),
Audio(Audio),
Video(Video),
Points(Points),
}
#[derive(Debug, Deserialize, Serialize, Clone, Dummy)]
pub struct Scene {
#[serde(rename = "@id")]
id: Option<String>,
#[serde(rename = "@name")]
name: Option<String>,
#[serde(rename = "@color")]
color: Option<String>,
#[serde(rename = "@comment")]
comment: Option<String>,
#[serde(rename = "$value", default)]
content: Option<SceneSequenceEnum>,
}
impl Scene {
pub fn new_test() -> Self {
Self {
id: Some(format!("id{}", add_one_get())),
name: None,
color: None,
comment: None,
content: None,
}
}
pub fn new_fake() -> Self {
let o: Self = Faker.fake_with_rng(&mut fake_rng());
o
}
}
#[cfg(test)]
mod tests {
use {super::Scene, quick_xml::se::to_string, std::error::Error};
#[test]
pub fn se_test() -> Result<(), Box<dyn Error>> {
let mut o = Scene::new_fake();
match to_string(&o) {
Ok(o) => println!("{}", o),
Err(err) => return Err(err.into()),
}
Ok(())
}
}