solver conflicts

This commit is contained in:
appflowy
2022-01-24 17:32:40 +08:00
426 changed files with 22160 additions and 16593 deletions

View File

@ -1,5 +1,5 @@
use flowy_collaboration::entities::revision::RevisionState;
use flowy_document::core::{edit::ClientDocumentEditor, SYNC_INTERVAL_IN_MILLIS};
use flowy_document::core::{ClientDocumentEditor, DOCUMENT_SYNC_INTERVAL_IN_MILLIS};
use flowy_test::{helper::ViewTest, FlowySDKTest};
use lib_ot::{core::Interval, rich_text::RichTextDelta};
use std::sync::Arc;
@ -26,7 +26,7 @@ impl EditorTest {
let sdk = FlowySDKTest::default();
let _ = sdk.init_user().await;
let test = ViewTest::new(&sdk).await;
let editor = sdk.document_ctx.controller.open_document(&test.view.id).await.unwrap();
let editor = sdk.document_manager.open_document(&test.view.id).await.unwrap();
Self { sdk, editor }
}
@ -79,6 +79,6 @@ impl EditorTest {
assert_eq!(expected_delta, delta);
}
}
sleep(Duration::from_millis(SYNC_INTERVAL_IN_MILLIS)).await;
sleep(Duration::from_millis(DOCUMENT_SYNC_INTERVAL_IN_MILLIS)).await;
}
}

View File

@ -1,6 +1,6 @@
#![cfg_attr(rustfmt, rustfmt::skip)]
use crate::editor::{TestBuilder, TestOp::*};
use flowy_collaboration::document::{NewlineDoc, PlainDoc};
use flowy_collaboration::client_document::{NewlineDoc, PlainDoc};
use lib_ot::core::{Interval, OperationTransformable, NEW_LINE, WHITESPACE, FlowyStr};
use unicode_segmentation::UnicodeSegmentation;
use lib_ot::rich_text::RichTextDelta;

View File

@ -5,7 +5,7 @@ mod serde_test;
mod undo_redo_test;
use derive_more::Display;
use flowy_collaboration::document::{Document, InitialDocumentText};
use flowy_collaboration::client_document::{ClientDocument, InitialDocumentText};
use lib_ot::{
core::*,
rich_text::{RichTextAttribute, RichTextAttributes, RichTextDelta},
@ -82,7 +82,7 @@ pub enum TestOp {
}
pub struct TestBuilder {
documents: Vec<Document>,
documents: Vec<ClientDocument>,
deltas: Vec<Option<RichTextDelta>>,
primes: Vec<Option<RichTextDelta>>,
}
@ -91,9 +91,8 @@ impl TestBuilder {
pub fn new() -> Self {
static INIT: Once = Once::new();
INIT.call_once(|| {
color_eyre::install().unwrap();
let _ = color_eyre::install();
std::env::set_var("RUST_LOG", LEVEL);
env_logger::init();
});
Self {
@ -267,7 +266,7 @@ impl TestBuilder {
}
pub fn run_scripts<C: InitialDocumentText>(mut self, scripts: Vec<TestOp>) {
self.documents = vec![Document::new::<C>(), Document::new::<C>()];
self.documents = vec![ClientDocument::new::<C>(), ClientDocument::new::<C>()];
self.primes = vec![None, None];
self.deltas = vec![None, None];
for (_i, op) in scripts.iter().enumerate() {

View File

@ -1,6 +1,6 @@
#![allow(clippy::all)]
use crate::editor::{Rng, TestBuilder, TestOp::*};
use flowy_collaboration::document::{NewlineDoc, PlainDoc};
use flowy_collaboration::client_document::{NewlineDoc, PlainDoc};
use lib_ot::{
core::*,
rich_text::{AttributeBuilder, RichTextAttribute, RichTextAttributes, RichTextDelta},

View File

@ -1,8 +1,9 @@
use flowy_collaboration::document::{Document, PlainDoc};
use flowy_collaboration::client_document::{ClientDocument, PlainDoc};
use lib_ot::{
core::*,
rich_text::{AttributeBuilder, RichTextAttribute, RichTextAttributeValue, RichTextDelta},
};
use lib_ot::rich_text::RichTextOperation;
#[test]
fn operation_insert_serialize_test() {
@ -104,10 +105,13 @@ fn delta_serde_null_test() {
#[test]
fn document_insert_serde_test() {
let mut document = Document::new::<PlainDoc>();
let mut document = ClientDocument::new::<PlainDoc>();
document.insert(0, "\n").unwrap();
document.insert(0, "123").unwrap();
let json = document.to_json();
assert_eq!(r#"[{"insert":"123\n"}]"#, json);
assert_eq!(r#"[{"insert":"123\n"}]"#, Document::from_json(&json).unwrap().to_json());
assert_eq!(
r#"[{"insert":"123\n"}]"#,
ClientDocument::from_json(&json).unwrap().to_json()
);
}

View File

@ -1,5 +1,5 @@
use crate::editor::{TestBuilder, TestOp::*};
use flowy_collaboration::document::{NewlineDoc, PlainDoc, RECORD_THRESHOLD};
use flowy_collaboration::client_document::{NewlineDoc, PlainDoc, RECORD_THRESHOLD};
use lib_ot::core::{Interval, NEW_LINE, WHITESPACE};
#[test]