Automatically include all demo artwork in test
This commit is contained in:
parent
9edd9233db
commit
1bf62d92c2
|
|
@ -469,13 +469,15 @@ mod test {
|
|||
init_logger();
|
||||
let mut editor = Editor::create();
|
||||
|
||||
let test_files = [
|
||||
("Just a Potted Cactus", include_str!("../../demo-artwork/just-a-potted-cactus.graphite")),
|
||||
("Valley of Spires", include_str!("../../demo-artwork/procedural-string-lights.graphite")),
|
||||
("Valley of Spires", include_str!("../../demo-artwork/valley-of-spires.graphite")),
|
||||
];
|
||||
for (document_name, _, file_name) in crate::messages::dialog::simple_dialogs::ARTWORK {
|
||||
let document_serialized_content = std::fs::read_to_string(format!("../demo-artwork/{file_name}")).unwrap();
|
||||
|
||||
assert_eq!(
|
||||
document_serialized_content.lines().count(),
|
||||
1,
|
||||
"Demo artwork '{document_name}' has more than 1 line (remember to open and re-save it in Graphite)",
|
||||
);
|
||||
|
||||
for (document_name, document_serialized_content) in test_files {
|
||||
let responses = editor.handle_message(PortfolioMessage::OpenDocumentFile {
|
||||
document_name: document_name.into(),
|
||||
document_serialized_content: document_serialized_content.into(),
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use crate::messages::prelude::*;
|
|||
pub struct DemoArtworkDialog;
|
||||
|
||||
/// `(name, thumbnail, filename)`
|
||||
const ARTWORK: [(&str, &str, &str); 4] = [
|
||||
pub const ARTWORK: [(&str, &str, &str); 4] = [
|
||||
("Valley of Spires", "ThumbnailValleyOfSpires", "valley-of-spires.graphite"),
|
||||
("Red Dress", "ThumbnailRedDress", "red-dress.graphite"),
|
||||
("Just a Potted Cactus", "ThumbnailJustAPottedCactus", "just-a-potted-cactus.graphite"),
|
||||
|
|
|
|||
|
|
@ -13,3 +13,5 @@ pub use coming_soon_dialog::ComingSoonDialog;
|
|||
pub use demo_artwork_dialog::DemoArtworkDialog;
|
||||
pub use error_dialog::ErrorDialog;
|
||||
pub use licenses_dialog::LicensesDialog;
|
||||
|
||||
pub use demo_artwork_dialog::ARTWORK;
|
||||
|
|
|
|||
Loading…
Reference in New Issue