fn copy_paste_single_layer_from_middle() {
		init_logger();
		let mut editor = create_editor_with_three_layers();

		let document_before_copy = editor.dispatcher.document_message_handler.active_document().document.clone();
		let shape_id = document_before_copy.root.as_folder().unwrap().layer_ids[1];

		editor.handle_message(Message::Document(DocumentMessage::SelectLayers(vec![vec![shape_id]]))).unwrap();
		editor.handle_message(Message::Document(DocumentMessage::CopySelectedLayers)).unwrap();
		editor.handle_message(Message::Document(DocumentMessage::PasteLayers { path: vec![], insert_index: -1 })).unwrap();

		let document_after_copy = editor.dispatcher.document_message_handler.active_document().document.clone();

		let layers_before_copy = document_before_copy.root.as_folder().unwrap().layers();
		let layers_after_copy = document_after_copy.root.as_folder().unwrap().layers();

		assert_eq!(layers_before_copy.len(), 3);
		assert_eq!(layers_after_copy.len(), 4);

		// Existing layers are unaffected
		for i in 0..=2 {
			assert_eq!(layers_before_copy[i], layers_after_copy[i]);
		}

		// The shape was copied
		assert_eq!(layers_before_copy[1], layers_after_copy[3]);
	}
/// - create rect, shape and ellipse
/// - select shape
/// - copy
/// - paste
/// - assert that shape was copied
create rect, shape and ellipse
select shape
copy
paste
assert that shape was copied
create rect shape and ellipse select shape copy paste assert that shape was copied
fn copy_paste_single_layer_from_middle() {
		init_logger();
		let mut editor = create_editor_with_three_layers();
		let document_before_copy = editor.dispatcher.document_message_handler.active_document().document.clone();
		let shape_id = document_before_copy.root.as_folder().unwrap().layer_ids[1];
		editor.handle_message(Message::Document(DocumentMessage::SelectLayers(vec![vec![shape_id]]))).unwrap();
		editor.handle_message(Message::Document(DocumentMessage::CopySelectedLayers)).unwrap();
		editor.handle_message(Message::Document(DocumentMessage::PasteLayers { path: vec![], insert_index: -1 })).unwrap();
		let document_after_copy = editor.dispatcher.document_message_handler.active_document().document.clone();
		let layers_before_copy = document_before_copy.root.as_folder().unwrap().layers();
		let layers_after_copy = document_after_copy.root.as_folder().unwrap().layers();
		assert_eq!(layers_before_copy.len(), 3);
		assert_eq!(layers_after_copy.len(), 4);
		// Existing layers are unaffected
		for i in 0..=2 {
			assert_eq!(layers_before_copy[i], layers_after_copy[i]);
		}
		// The shape was copied
		assert_eq!(layers_before_copy[1], layers_after_copy[3]);
	}
fn copy_paste_single_layer_from_middle ( ) { init_logger ( ) ; let mut editor = create_editor_with_three_layers ( ) ; let document_before_copy = editor . dispatcher . document_message_handler . active_document ( ) . document . clone ( ) ; let shape_id = document_before_copy . root . as_folder ( ) . unwrap ( ) . layer_ids [ 1 ] ; editor . handle_message ( Message :: Document ( DocumentMessage :: SelectLayers ( vec ! [ vec [ shape_id ] ] ) ) ) . unwrap ( ) ; editor . handle_message ( Message :: Document ( DocumentMessage :: CopySelectedLayers ) ) . unwrap ( ) ; editor . handle_message ( Message :: Document ( DocumentMessage :: PasteLayers { path : vec ! [ ] , insert_index : - 1 } ) ) . unwrap ( ) ; let document_after_copy = editor . dispatcher . document_message_handler . active_document ( ) . document . clone ( ) ; let layers_before_copy = document_before_copy . root . as_folder ( ) . unwrap ( ) . layers ( ) ; let layers_after_copy = document_after_copy . root . as_folder ( ) . unwrap ( ) . layers ( ) ; assert_eq ! ( layers_before_copy len ( ) 3 ) ; assert_eq ! ( layers_after_copy len ( ) 4 ) ; // Existing layers are unaffected for i in 0 ..= 2 { assert_eq ! ( layers_before_copy [ i ] layers_after_copy [ i ] ) ; } // The shape was copied assert_eq ! ( layers_before_copy [ 1 ] layers_after_copy [ 3 ] ) ; }
create rect, shape and ellipse
 select shape
 copy
 paste
 assert that shape was copied
create rect shape and ellipse select shape copy paste assert that shape was copied