@@ -716,6 +716,57 @@ 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. Their Path nodes sit on pen-drawn layers, so
721+ /// each layer's geometry, curves included, comes from its stored modification alone.
722+ #[ tokio:: test]
723+ async fn demo_artwork_vector_modifications_still_apply ( ) {
724+ use graph_craft:: document:: value:: TaggedValue ;
725+
726+ for name in [ "red-dress" , "isometric-fountain" , "valley-of-spires" ] {
727+ let mut editor = EditorTestUtils :: create ( ) ;
728+
729+ let data = std:: fs:: read ( format ! ( "../demo-artwork/{name}.graphite" ) ) . expect ( "read demo artwork" ) ;
730+ editor
731+ . handle_message ( IngestMessage :: Ingest {
732+ data,
733+ action : IngestAction :: Open ,
734+ mime_type : String :: new ( ) ,
735+ path : Some ( format ! ( "{name}.graphite" ) . into ( ) ) ,
736+ } )
737+ . await ;
738+
739+ let document = editor. active_document ( ) ;
740+ let network = & document. network_interface ;
741+ let path_definition = DefinitionIdentifier :: Network ( "Path" . into ( ) ) ;
742+ let mut path_layers = 0 ;
743+ let mut any_curve = false ;
744+
745+ for layer in document. metadata ( ) . all_layers ( ) {
746+ let Some ( path_node) = NodeGraphLayer :: new ( layer, network) . upstream_visible_node_id_from_name_in_layer ( & path_definition) else {
747+ continue ;
748+ } ;
749+ path_layers += 1 ;
750+
751+ let stored = network. document_network ( ) . nodes . get ( & path_node) . and_then ( |node| node. inputs . get ( 1 ) ) . and_then ( |input| input. as_value ( ) ) ;
752+ let Some ( TaggedValue :: VectorModification ( modification) ) = stored else {
753+ panic ! ( "{name} layer {layer:?} has a Path node without a stored modification" ) ;
754+ } ;
755+ assert ! ( !modification. is_empty( ) , "{name} layer {layer:?} stored a modification that changes nothing" ) ;
756+
757+ let upstream = document. metadata ( ) . vector_modify . get ( & path_node) . expect ( "the graph run should capture what reaches the Path node" ) ;
758+ assert ! ( upstream. anchor_points( ) . next( ) . is_none( ) , "{name} layer {layer:?} has geometry upstream of its Path node" ) ;
759+
760+ let geometry = network. compute_modified_vector ( layer) . expect ( "a layer with a Path node should have a vector" ) ;
761+ assert ! ( geometry. anchor_points( ) . next( ) . is_some( ) , "{name} layer {layer:?} surfaced no anchors from its stored modification" ) ;
762+ any_curve |= geometry. segment_iter ( ) . any ( |( _, segment, ..) | !matches ! ( segment, kurbo:: PathSeg :: Line ( _) ) ) ;
763+ }
764+
765+ assert ! ( path_layers > 0 , "{name} has no layers edited through a Path node" ) ;
766+ assert ! ( any_curve, "{name} drew no curves from its stored modifications" ) ;
767+ }
768+ }
769+
719770/// The document's single Fill node, as `(network_path, node_id)`.
720771fn find_fill_node ( document : & DocumentMessageHandler ) -> ( Vec < graph_craft:: document:: NodeId > , graph_craft:: document:: NodeId ) {
721772 node_paths ( & document. network_interface )
0 commit comments