diff --git a/editor/src/dispatcher.rs b/editor/src/dispatcher.rs index 0712d386..ae75feb4 100644 --- a/editor/src/dispatcher.rs +++ b/editor/src/dispatcher.rs @@ -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(), diff --git a/editor/src/messages/dialog/simple_dialogs/demo_artwork_dialog.rs b/editor/src/messages/dialog/simple_dialogs/demo_artwork_dialog.rs index fda27600..5c036ea9 100644 --- a/editor/src/messages/dialog/simple_dialogs/demo_artwork_dialog.rs +++ b/editor/src/messages/dialog/simple_dialogs/demo_artwork_dialog.rs @@ -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"), diff --git a/editor/src/messages/dialog/simple_dialogs/mod.rs b/editor/src/messages/dialog/simple_dialogs/mod.rs index 31cb5706..fad483ef 100644 --- a/editor/src/messages/dialog/simple_dialogs/mod.rs +++ b/editor/src/messages/dialog/simple_dialogs/mod.rs @@ -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;