mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
config ping test
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
#![cfg_attr(rustfmt, rustfmt::skip)]
|
||||
use crate::editor::{TestBuilder, TestOp::*};
|
||||
use flowy_collaboration::document::{FlowyDoc, PlainDoc};
|
||||
use flowy_collaboration::document::{NewlineDoc, PlainDoc};
|
||||
use lib_ot::core::{Interval, OperationTransformable, NEW_LINE, WHITESPACE, FlowyStr};
|
||||
use unicode_segmentation::UnicodeSegmentation;
|
||||
use lib_ot::rich_text::RichTextDelta;
|
||||
@ -85,7 +85,7 @@ fn attributes_bold_added_with_new_line() {
|
||||
r#"[{"insert":"123","attributes":{"bold":"true"}},{"insert":"\na\n"},{"insert":"456","attributes":{"bold":"true"}},{"insert":"\n"}]"#,
|
||||
),
|
||||
];
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -128,7 +128,7 @@ fn attributes_bold_added_italic() {
|
||||
r#"[{"insert":"12345678","attributes":{"bold":"true","italic":"true"}},{"insert":"\n"}]"#,
|
||||
),
|
||||
];
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -390,7 +390,7 @@ fn attributes_header_insert_newline_at_middle() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -415,7 +415,7 @@ fn attributes_header_insert_double_newline_at_middle() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -430,7 +430,7 @@ fn attributes_header_insert_newline_at_trailing() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -446,7 +446,7 @@ fn attributes_header_insert_double_newline_at_trailing() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -460,7 +460,7 @@ fn attributes_link_added() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -479,7 +479,7 @@ fn attributes_link_format_with_bold() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -498,7 +498,7 @@ fn attributes_link_insert_char_at_head() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -513,7 +513,7 @@ fn attributes_link_insert_char_at_middle() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -532,7 +532,7 @@ fn attributes_link_insert_char_at_trailing() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -547,7 +547,7 @@ fn attributes_link_insert_newline_at_middle() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -563,7 +563,7 @@ fn attributes_link_auto_format() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -579,7 +579,7 @@ fn attributes_link_auto_format_exist() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -595,7 +595,7 @@ fn attributes_link_auto_format_exist2() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -606,7 +606,7 @@ fn attributes_bullet_added() {
|
||||
AssertDocJson(0, r#"[{"insert":"12"},{"insert":"\n","attributes":{"list":"bullet"}}]"#),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -627,7 +627,7 @@ fn attributes_bullet_added_2() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -644,7 +644,7 @@ fn attributes_bullet_remove_partial() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -660,7 +660,7 @@ fn attributes_bullet_auto_exit() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -700,7 +700,7 @@ fn attributes_preserve_block_when_insert_newline_inside() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -717,7 +717,7 @@ fn attributes_preserve_header_format_on_merge() {
|
||||
AssertDocJson(0, r#"[{"insert":"123456"},{"insert":"\n","attributes":{"header":1}}]"#),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -736,7 +736,7 @@ fn attributes_format_emoji() {
|
||||
r#"[{"insert":"👋 "},{"insert":"\n","attributes":{"header":1}}]"#,
|
||||
),
|
||||
];
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -756,7 +756,7 @@ fn attributes_preserve_list_format_on_merge() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -795,5 +795,5 @@ fn delta_compose() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ mod serde_test;
|
||||
mod undo_redo_test;
|
||||
|
||||
use derive_more::Display;
|
||||
use flowy_collaboration::document::{CustomDocument, Document};
|
||||
use flowy_collaboration::document::{Document, InitialDocumentText};
|
||||
use lib_ot::{
|
||||
core::*,
|
||||
rich_text::{RichTextAttribute, RichTextAttributes, RichTextDelta},
|
||||
@ -266,7 +266,7 @@ impl TestBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run_scripts<C: CustomDocument>(mut self, scripts: Vec<TestOp>) {
|
||||
pub fn run_scripts<C: InitialDocumentText>(mut self, scripts: Vec<TestOp>) {
|
||||
self.documents = vec![Document::new::<C>(), Document::new::<C>()];
|
||||
self.primes = vec![None, None];
|
||||
self.deltas = vec![None, None];
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![allow(clippy::all)]
|
||||
use crate::editor::{Rng, TestBuilder, TestOp::*};
|
||||
use flowy_collaboration::document::{FlowyDoc, PlainDoc};
|
||||
use flowy_collaboration::document::{NewlineDoc, PlainDoc};
|
||||
use lib_ot::{
|
||||
core::*,
|
||||
rich_text::{AttributeBuilder, RichTextAttribute, RichTextAttributes, RichTextDelta},
|
||||
@ -731,5 +731,5 @@ fn delta_compose_with_missing_delta() {
|
||||
AssertDocJson(0, r#"[{"insert":"1234\n"}]"#),
|
||||
AssertStr(1, r#"4\n"#),
|
||||
];
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
use crate::editor::{TestBuilder, TestOp::*};
|
||||
use flowy_collaboration::document::{FlowyDoc, PlainDoc, RECORD_THRESHOLD};
|
||||
use flowy_collaboration::document::{NewlineDoc, PlainDoc, RECORD_THRESHOLD};
|
||||
use lib_ot::core::{Interval, NEW_LINE, WHITESPACE};
|
||||
|
||||
#[test]
|
||||
fn history_insert_undo() {
|
||||
let ops = vec![Insert(0, "123", 0), Undo(0), AssertDocJson(0, r#"[{"insert":"\n"}]"#)];
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -19,7 +19,7 @@ fn history_insert_undo_with_lagging() {
|
||||
Undo(0),
|
||||
AssertDocJson(0, r#"[{"insert":"\n"}]"#),
|
||||
];
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -32,7 +32,7 @@ fn history_insert_redo() {
|
||||
Redo(0),
|
||||
AssertDocJson(0, r#"[{"insert":"123\n"}]"#),
|
||||
];
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -51,7 +51,7 @@ fn history_insert_redo_with_lagging() {
|
||||
Undo(0),
|
||||
AssertDocJson(0, r#"[{"insert":"123\n"}]"#),
|
||||
];
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -62,7 +62,7 @@ fn history_bold_undo() {
|
||||
Undo(0),
|
||||
AssertDocJson(0, r#"[{"insert":"\n"}]"#),
|
||||
];
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -74,7 +74,7 @@ fn history_bold_undo_with_lagging() {
|
||||
Undo(0),
|
||||
AssertDocJson(0, r#"[{"insert":"123\n"}]"#),
|
||||
];
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -87,7 +87,7 @@ fn history_bold_redo() {
|
||||
Redo(0),
|
||||
AssertDocJson(0, r#" [{"insert":"123","attributes":{"bold":"true"}},{"insert":"\n"}]"#),
|
||||
];
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -101,7 +101,7 @@ fn history_bold_redo_with_lagging() {
|
||||
Redo(0),
|
||||
AssertDocJson(0, r#"[{"insert":"123","attributes":{"bold":"true"}},{"insert":"\n"}]"#),
|
||||
];
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -133,7 +133,7 @@ fn history_delete_undo_2() {
|
||||
Undo(0),
|
||||
AssertDocJson(0, r#"[{"insert":"\n"}]"#),
|
||||
];
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -160,7 +160,7 @@ fn history_delete_undo_with_lagging() {
|
||||
"#,
|
||||
),
|
||||
];
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -174,7 +174,7 @@ fn history_delete_redo() {
|
||||
Redo(0),
|
||||
AssertDocJson(0, r#"[{"insert":"\n"}]"#),
|
||||
];
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -193,7 +193,7 @@ fn history_replace_undo() {
|
||||
Undo(0),
|
||||
AssertDocJson(0, r#"[{"insert":"\n"}]"#),
|
||||
];
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -214,7 +214,7 @@ fn history_replace_undo_with_lagging() {
|
||||
Undo(0),
|
||||
AssertDocJson(0, r#"[{"insert":"123","attributes":{"bold":"true"}},{"insert":"\n"}]"#),
|
||||
];
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -233,7 +233,7 @@ fn history_replace_redo() {
|
||||
"#,
|
||||
),
|
||||
];
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -252,7 +252,7 @@ fn history_header_added_undo() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -271,7 +271,7 @@ fn history_link_added_undo() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -290,7 +290,7 @@ fn history_link_auto_format_undo_with_lagging() {
|
||||
AssertDocJson(0, r#"[{"insert":"https://appflowy.io\n"}]"#),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -313,7 +313,7 @@ fn history_bullet_undo() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -341,7 +341,7 @@ fn history_bullet_undo_with_lagging() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -368,5 +368,5 @@ fn history_undo_attribute_on_merge_between_line() {
|
||||
),
|
||||
];
|
||||
|
||||
TestBuilder::new().run_scripts::<FlowyDoc>(ops);
|
||||
TestBuilder::new().run_scripts::<NewlineDoc>(ops);
|
||||
}
|
||||
|
Reference in New Issue
Block a user