Skip to content

Commit 3f625e9

Browse files
committed
Cover the stored modification format with the demo artwork that leans on it
1 parent c94aebc commit 3f625e9

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

‎editor/src/messages/portfolio/document/storage_tests/round_trip_tests.rs‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,38 @@ async fn demo_artwork_edit_autosaves_and_round_trips() {
716716
editor.active_document_mut().commit_storage_snapshot(&byte_store, true);
717717
}
718718

719+
/// Manual edits ride a saved document as a folded `VectorModification`, so opening the artworks carrying the most
720+
/// of them is what proves the stored format still reads and applies. Each layer edited through a Path node must
721+
/// surface anchors, which catches a single modification that deserialized into nothing.
722+
#[tokio::test]
723+
async fn demo_artwork_vector_modifications_still_apply() {
724+
for name in ["red-dress", "isometric-fountain", "valley-of-spires"] {
725+
let mut editor = EditorTestUtils::create();
726+
727+
let data = std::fs::read(format!("../demo-artwork/{name}.graphite")).expect("read demo artwork");
728+
editor
729+
.handle_message(IngestMessage::Ingest {
730+
data,
731+
action: IngestAction::Open,
732+
mime_type: String::new(),
733+
path: Some(format!("{name}.graphite").into()),
734+
})
735+
.await;
736+
737+
let document = editor.active_document();
738+
let path_layers: Vec<_> = document
739+
.metadata()
740+
.all_layers()
741+
.filter_map(|layer| Some((layer, document.network_interface.upstream_path_node_vector(layer)?)))
742+
.collect();
743+
assert!(!path_layers.is_empty(), "{name} has no layers edited through a Path node");
744+
745+
for (layer, geometry) in path_layers {
746+
assert!(geometry.anchor_points().next().is_some(), "{name} layer {layer:?} surfaced no anchors from its stored modification");
747+
}
748+
}
749+
}
750+
719751
/// The document's single Fill node, as `(network_path, node_id)`.
720752
fn find_fill_node(document: &DocumentMessageHandler) -> (Vec<graph_craft::document::NodeId>, graph_craft::document::NodeId) {
721753
node_paths(&document.network_interface)

0 commit comments

Comments
 (0)