use std::collections::HashMap;
use re_types::{
archetypes::TextDocument, components::MediaType, Archetype as _, AsComponents as _,
};
#[test]
fn roundtrip() {
let expected = TextDocument {
text: "This is the contents of the text document.".into(),
media_type: Some(MediaType::markdown()),
};
let arch = TextDocument::new("This is the contents of the text document.")
.with_media_type(MediaType::markdown());
similar_asserts::assert_eq!(expected, arch);
let expected_extensions: HashMap<_, _> = [
("text", vec!["rerun.components.Text"]),
("media_type", vec!["rerun.components.MediaType"]),
]
.into();
eprintln!("arch = {arch:#?}");
let serialized = arch.to_arrow().unwrap();
for (field, array) in &serialized {
eprintln!("{} = {array:#?}", field.name);
if false {
util::assert_extensions(
&**array,
expected_extensions[field.name.as_str()].as_slice(),
);
}
}
let deserialized = TextDocument::from_arrow(serialized).unwrap();
similar_asserts::assert_eq!(expected, deserialized);
}
mod util;