mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-23 08:28:12 +08:00
Implement multiple clipboards (#425)
* Imeplement multiple Clipboards * Cargo fmt * Fix unit tests * Fix console error caused by the Pen Tool (#432) * Fix error in pen tool * Cleanup * Split make operation and remove preview Co-authored-by: Keavon Chambers <keavon@keavon.com> * Fix line centering (#431) * cargo fmt Co-authored-by: 0HyperCube <78500760+0HyperCube@users.noreply.github.com>
This commit is contained in:
committed by
Keavon Chambers
co-authored by
Keavon Chambers
0HyperCube
parent
e09a606285
commit
1eb83d92c4
@@ -96,7 +96,13 @@ impl Dispatcher {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::{communication::set_uuid_seed, document::DocumentMessageHandler, message_prelude::*, misc::test_utils::EditorTestUtils, Editor};
|
||||
use crate::{
|
||||
communication::set_uuid_seed,
|
||||
document::{Clipboard::*, DocumentMessageHandler},
|
||||
message_prelude::*,
|
||||
misc::test_utils::EditorTestUtils,
|
||||
Editor,
|
||||
};
|
||||
use graphene::{color::Color, Operation};
|
||||
|
||||
fn init_logger() {
|
||||
@@ -131,8 +137,12 @@ mod test {
|
||||
let mut editor = create_editor_with_three_layers();
|
||||
|
||||
let document_before_copy = editor.dispatcher.documents_message_handler.active_document().graphene_document.clone();
|
||||
editor.handle_message(DocumentsMessage::Copy);
|
||||
editor.handle_message(DocumentsMessage::PasteIntoFolder { path: vec![], insert_index: -1 });
|
||||
editor.handle_message(DocumentsMessage::Copy(User));
|
||||
editor.handle_message(DocumentsMessage::PasteIntoFolder {
|
||||
clipboard: User,
|
||||
path: vec![],
|
||||
insert_index: -1,
|
||||
});
|
||||
let document_after_copy = editor.dispatcher.documents_message_handler.active_document().graphene_document.clone();
|
||||
|
||||
let layers_before_copy = document_before_copy.root.as_folder().unwrap().layers();
|
||||
@@ -164,8 +174,12 @@ mod test {
|
||||
let shape_id = document_before_copy.root.as_folder().unwrap().layer_ids[1];
|
||||
|
||||
editor.handle_message(DocumentMessage::SetSelectedLayers(vec![vec![shape_id]]));
|
||||
editor.handle_message(DocumentsMessage::Copy);
|
||||
editor.handle_message(DocumentsMessage::PasteIntoFolder { path: vec![], insert_index: -1 });
|
||||
editor.handle_message(DocumentsMessage::Copy(User));
|
||||
editor.handle_message(DocumentsMessage::PasteIntoFolder {
|
||||
clipboard: User,
|
||||
path: vec![],
|
||||
insert_index: -1,
|
||||
});
|
||||
|
||||
let document_after_copy = editor.dispatcher.documents_message_handler.active_document().graphene_document.clone();
|
||||
|
||||
@@ -223,10 +237,18 @@ mod test {
|
||||
|
||||
let document_before_copy = editor.dispatcher.documents_message_handler.active_document().graphene_document.clone();
|
||||
|
||||
editor.handle_message(DocumentsMessage::Copy);
|
||||
editor.handle_message(DocumentsMessage::Copy(User));
|
||||
editor.handle_message(DocumentMessage::DeleteSelectedLayers);
|
||||
editor.handle_message(DocumentsMessage::PasteIntoFolder { path: vec![], insert_index: -1 });
|
||||
editor.handle_message(DocumentsMessage::PasteIntoFolder { path: vec![], insert_index: -1 });
|
||||
editor.handle_message(DocumentsMessage::PasteIntoFolder {
|
||||
clipboard: User,
|
||||
path: vec![],
|
||||
insert_index: -1,
|
||||
});
|
||||
editor.handle_message(DocumentsMessage::PasteIntoFolder {
|
||||
clipboard: User,
|
||||
path: vec![],
|
||||
insert_index: -1,
|
||||
});
|
||||
|
||||
let document_after_copy = editor.dispatcher.documents_message_handler.active_document().graphene_document.clone();
|
||||
|
||||
@@ -284,11 +306,19 @@ mod test {
|
||||
let ellipse_id = document_before_copy.root.as_folder().unwrap().layer_ids[ELLIPSE_INDEX];
|
||||
|
||||
editor.handle_message(DocumentMessage::SetSelectedLayers(vec![vec![rect_id], vec![ellipse_id]]));
|
||||
editor.handle_message(DocumentsMessage::Copy);
|
||||
editor.handle_message(DocumentsMessage::Copy(User));
|
||||
editor.handle_message(DocumentMessage::DeleteSelectedLayers);
|
||||
editor.draw_rect(0., 800., 12., 200.);
|
||||
editor.handle_message(DocumentsMessage::PasteIntoFolder { path: vec![], insert_index: -1 });
|
||||
editor.handle_message(DocumentsMessage::PasteIntoFolder { path: vec![], insert_index: -1 });
|
||||
editor.handle_message(DocumentsMessage::PasteIntoFolder {
|
||||
clipboard: User,
|
||||
path: vec![],
|
||||
insert_index: -1,
|
||||
});
|
||||
editor.handle_message(DocumentsMessage::PasteIntoFolder {
|
||||
clipboard: User,
|
||||
path: vec![],
|
||||
insert_index: -1,
|
||||
});
|
||||
|
||||
let document_after_copy = editor.dispatcher.documents_message_handler.active_document().graphene_document.clone();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user