1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

DROID-1147 App | Refactoring | Remove or deprecate SmartBlockType (#3104)

This commit is contained in:
Evgenii Kozlov 2023-04-19 17:52:57 +02:00 committed by GitHub
parent f2d0748831
commit eafd87c234
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
110 changed files with 615 additions and 1039 deletions

View file

@ -28,6 +28,7 @@ import com.anytypeio.anytype.test_utils.utils.TestUtils
import com.anytypeio.anytype.ui.editor.EditorFragment
import com.anytypeio.anytype.utils.CoroutinesTestRule
import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule
import kotlin.test.assertEquals
import org.junit.Before
import org.junit.Rule
import org.junit.Test
@ -36,7 +37,6 @@ import org.mockito.kotlin.doReturn
import org.mockito.kotlin.stub
import org.mockito.kotlin.times
import org.mockito.kotlin.verifyBlocking
import kotlin.test.assertEquals
@RunWith(AndroidJUnit4::class)
@LargeTest
@ -130,7 +130,7 @@ class CreateBlockTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id)
)
@ -236,7 +236,7 @@ class CreateBlockTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id)
)

View file

@ -29,6 +29,7 @@ import com.anytypeio.anytype.test_utils.utils.TestUtils.withRecyclerView
import com.anytypeio.anytype.ui.editor.EditorFragment
import com.anytypeio.anytype.utils.CoroutinesTestRule
import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule
import kotlin.test.assertEquals
import org.junit.Before
import org.junit.Rule
import org.junit.Test
@ -37,7 +38,6 @@ import org.mockito.kotlin.doReturn
import org.mockito.kotlin.stub
import org.mockito.kotlin.times
import org.mockito.kotlin.verifyBlocking
import kotlin.test.assertEquals
@RunWith(AndroidJUnit4::class)
@LargeTest
@ -287,7 +287,7 @@ class DeleteBlockTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id, b.id)
)
@ -508,7 +508,7 @@ class DeleteBlockTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id, b.id)
)

View file

@ -74,7 +74,7 @@ class DescriptionTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id)
)
@ -113,7 +113,7 @@ class DescriptionTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id)
)

View file

@ -21,7 +21,6 @@ import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.BlockSplitMode
import com.anytypeio.anytype.core_models.Command
import com.anytypeio.anytype.core_models.Event
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_ui.features.editor.holders.text.Checkbox
import com.anytypeio.anytype.core_ui.features.editor.holders.text.Numbered
import com.anytypeio.anytype.core_ui.features.editor.holders.text.Toggle
@ -99,7 +98,7 @@ class EditorIntegrationTesting : EditorTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = blocks.map { it.id }
)
) + blocks
@ -162,7 +161,7 @@ class EditorIntegrationTesting : EditorTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(
BLOCK_PARAGRAPH_1.id
)
@ -208,7 +207,7 @@ class EditorIntegrationTesting : EditorTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(
BLOCK_PARAGRAPH_1.id
)
@ -256,7 +255,7 @@ class EditorIntegrationTesting : EditorTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(paragraph.id)
),
paragraph
@ -394,7 +393,7 @@ class EditorIntegrationTesting : EditorTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(paragraphBefore.id, paragraphAfter.id)
),
paragraphBefore,
@ -504,7 +503,7 @@ class EditorIntegrationTesting : EditorTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(paragraph1.id, paragraph2.id)
),
paragraph1,
@ -606,7 +605,7 @@ class EditorIntegrationTesting : EditorTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(paragraph.id)
),
paragraph

View file

@ -132,7 +132,7 @@ class FeaturedRelationTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id, block1.id)
)
@ -235,7 +235,7 @@ class FeaturedRelationTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id, block1.id)
)

View file

@ -7,7 +7,6 @@ import com.anytypeio.anytype.R
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.CoverType
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.ext.content
import com.anytypeio.anytype.emojifier.data.DefaultDocumentEmojiIconProvider
import com.anytypeio.anytype.features.editor.base.EditorTestSetup
@ -74,7 +73,7 @@ class LayoutTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -125,7 +124,7 @@ class LayoutTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -171,7 +170,7 @@ class LayoutTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -218,7 +217,7 @@ class LayoutTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -263,7 +262,7 @@ class LayoutTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -310,7 +309,7 @@ class LayoutTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -355,7 +354,7 @@ class LayoutTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)

View file

@ -14,7 +14,6 @@ import com.anytypeio.anytype.core_models.BlockSplitMode
import com.anytypeio.anytype.core_models.Command
import com.anytypeio.anytype.core_models.Event
import com.anytypeio.anytype.core_models.Payload
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.ext.content
import com.anytypeio.anytype.core_ui.widgets.text.TextInputWidget
import com.anytypeio.anytype.domain.base.Either
@ -29,15 +28,14 @@ import com.anytypeio.anytype.presentation.editor.EditorViewModel
import com.anytypeio.anytype.test_utils.utils.TestUtils
import com.anytypeio.anytype.ui.editor.EditorFragment
import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule
import kotlin.test.assertEquals
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.kotlin.doAnswer
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.stub
import org.mockito.kotlin.times
import org.mockito.kotlin.verifyBlocking
import kotlin.test.assertEquals
class ListBlockTesting : EditorTestSetup() {
@ -112,7 +110,7 @@ class ListBlockTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(a.id)
)
@ -273,7 +271,7 @@ class ListBlockTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id, b.id)
)

View file

@ -88,7 +88,7 @@ class MarkupTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id)
)

View file

@ -10,7 +10,6 @@ import com.anytypeio.anytype.R
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.Event
import com.anytypeio.anytype.core_models.Payload
import com.anytypeio.anytype.domain.base.Either
import com.anytypeio.anytype.domain.base.Result
import com.anytypeio.anytype.domain.base.Resultat
import com.anytypeio.anytype.features.editor.base.EditorTestSetup
@ -29,7 +28,6 @@ import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.any
import org.mockito.kotlin.doAnswer
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.stub
@ -103,7 +101,7 @@ class MentionUpdateTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
val document = listOf(page, header, title, block)

View file

@ -27,6 +27,7 @@ import com.anytypeio.anytype.test_utils.utils.TestUtils.withRecyclerView
import com.anytypeio.anytype.ui.editor.EditorFragment
import com.anytypeio.anytype.utils.CoroutinesTestRule
import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule
import kotlin.test.assertEquals
import org.junit.Before
import org.junit.Rule
import org.junit.Test
@ -36,7 +37,6 @@ import org.mockito.kotlin.doReturn
import org.mockito.kotlin.stub
import org.mockito.kotlin.times
import org.mockito.kotlin.verifyBlocking
import kotlin.test.assertEquals
@RunWith(AndroidJUnit4::class)
@LargeTest
@ -214,7 +214,7 @@ class MergeBlockTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id, b.id)
)

View file

@ -9,7 +9,6 @@ import com.anytypeio.anytype.R
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.CoverType
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.ext.content
import com.anytypeio.anytype.features.editor.base.EditorTestSetup
import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent
@ -58,7 +57,7 @@ class ProfileTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id)
)

View file

@ -12,6 +12,7 @@ import androidx.test.filters.LargeTest
import com.anytypeio.anytype.R
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.Relation
import com.anytypeio.anytype.core_models.ThemeColor
import com.anytypeio.anytype.core_models.ext.content
import com.anytypeio.anytype.core_ui.extensions.veryLight
import com.anytypeio.anytype.emojifier.data.DefaultDocumentEmojiIconProvider
@ -19,7 +20,6 @@ import com.anytypeio.anytype.features.editor.base.EditorTestSetup
import com.anytypeio.anytype.features.editor.base.TestEditorFragment
import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent
import com.anytypeio.anytype.presentation.editor.EditorViewModel
import com.anytypeio.anytype.core_models.ThemeColor
import com.anytypeio.anytype.test_utils.MockDataFactory
import com.anytypeio.anytype.test_utils.utils.checkHasBackgroundColor
import com.anytypeio.anytype.test_utils.utils.checkHasNoBackground
@ -114,7 +114,7 @@ class RelationBlockUITesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id, b.id)
)
@ -248,7 +248,7 @@ class RelationBlockUITesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(
header.id,
paragraph.id,
@ -424,7 +424,7 @@ class RelationBlockUITesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(
header.id,
paragraph.id,
@ -514,7 +514,7 @@ class RelationBlockUITesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id, b.id)
)
@ -603,7 +603,7 @@ class RelationBlockUITesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id, b.id)
)
@ -659,7 +659,7 @@ class RelationBlockUITesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id, block.id)
)
@ -725,7 +725,7 @@ class RelationBlockUITesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -857,7 +857,7 @@ class RelationBlockUITesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -939,7 +939,7 @@ class RelationBlockUITesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -1075,7 +1075,7 @@ class RelationBlockUITesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(
header.id,
paragraph.id,

View file

@ -92,7 +92,7 @@ class ScrollAndMoveTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id, b.id)
)

View file

@ -84,7 +84,7 @@ class SlashTextWatcherTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -115,7 +115,7 @@ class SlashTextWatcherTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -148,7 +148,7 @@ class SlashTextWatcherTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -179,7 +179,7 @@ class SlashTextWatcherTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -211,7 +211,7 @@ class SlashTextWatcherTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -244,7 +244,7 @@ class SlashTextWatcherTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -275,7 +275,7 @@ class SlashTextWatcherTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -308,7 +308,7 @@ class SlashTextWatcherTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -347,7 +347,7 @@ class SlashTextWatcherTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id, paragraph2.id)
)

View file

@ -122,7 +122,7 @@ class SlashWidgetTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -163,7 +163,7 @@ class SlashWidgetTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -204,7 +204,7 @@ class SlashWidgetTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -250,7 +250,7 @@ class SlashWidgetTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -296,7 +296,7 @@ class SlashWidgetTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -342,7 +342,7 @@ class SlashWidgetTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -388,7 +388,7 @@ class SlashWidgetTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -472,7 +472,7 @@ class SlashWidgetTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -539,7 +539,7 @@ class SlashWidgetTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id, paragraph2.id)
)
@ -612,7 +612,7 @@ class SlashWidgetTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id, paragraph2.id)
)
@ -691,7 +691,7 @@ class SlashWidgetTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id, paragraph2.id)
)
@ -761,7 +761,7 @@ class SlashWidgetTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id, paragraph2.id)
)
@ -825,7 +825,7 @@ class SlashWidgetTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -873,7 +873,7 @@ class SlashWidgetTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -910,7 +910,7 @@ class SlashWidgetTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)

View file

@ -25,6 +25,7 @@ import com.anytypeio.anytype.test_utils.utils.TestUtils.withRecyclerView
import com.anytypeio.anytype.ui.editor.EditorFragment
import com.anytypeio.anytype.utils.CoroutinesTestRule
import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule
import kotlin.test.assertEquals
import org.junit.Before
import org.junit.Rule
import org.junit.Test
@ -32,7 +33,6 @@ import org.junit.runner.RunWith
import org.mockito.kotlin.any
import org.mockito.kotlin.times
import org.mockito.kotlin.verifyBlocking
import kotlin.test.assertEquals
@RunWith(AndroidJUnit4::class)
@LargeTest
@ -77,7 +77,7 @@ class SplitBlockTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(block.id)
)
@ -220,7 +220,7 @@ class SplitBlockTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(block.id)
)
@ -361,7 +361,7 @@ class SplitBlockTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(block.id)
)
@ -502,7 +502,7 @@ class SplitBlockTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(block.id)
)
@ -643,7 +643,7 @@ class SplitBlockTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(block.id)
)
@ -786,7 +786,7 @@ class SplitBlockTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(block.id)
)
@ -929,7 +929,7 @@ class SplitBlockTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(block.id)
)
@ -1072,7 +1072,7 @@ class SplitBlockTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(block.id)
)
@ -1215,7 +1215,7 @@ class SplitBlockTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(block.id)
)

View file

@ -30,13 +30,13 @@ import com.anytypeio.anytype.test_utils.utils.rVMatcher
import com.anytypeio.anytype.ui.editor.EditorFragment
import com.anytypeio.anytype.utils.CoroutinesTestRule
import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule
import kotlin.test.assertEquals
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.times
import org.mockito.kotlin.verifyBlocking
import kotlin.test.assertEquals
@RunWith(AndroidJUnit4::class)
@LargeTest
@ -104,7 +104,7 @@ class SplitTitleTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
val relation2 = Relation(
@ -214,7 +214,7 @@ class SplitTitleTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
val relation2 = Relation(

View file

@ -8,7 +8,6 @@ import com.anytypeio.anytype.analytics.base.Analytics
import com.anytypeio.anytype.app.DefaultFeatureToggles
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.Command
import com.anytypeio.anytype.core_models.DocumentInfo
import com.anytypeio.anytype.core_models.Event
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.ObjectWrapper
@ -547,12 +546,6 @@ open class EditorTestSetup {
}
}
fun stubGetListPages(pages: List<DocumentInfo>) {
repo.stub {
onBlocking { getListPages() } doReturn pages
}
}
fun stubUpdateTextStyle(
events: List<Event> = emptyList()
) {

View file

@ -91,7 +91,7 @@ class MentionWidgetTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -100,7 +100,6 @@ class MentionWidgetTesting : EditorTestSetup() {
stubInterceptEvents()
stubInterceptThreadStatus()
stubUpdateText()
stubGetListPages(listOf())
stubOpenDocument(document, defaultDetails)
launchFragment(args)
@ -142,7 +141,7 @@ class MentionWidgetTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -151,7 +150,6 @@ class MentionWidgetTesting : EditorTestSetup() {
stubInterceptEvents()
stubInterceptThreadStatus()
stubUpdateText()
stubGetListPages(listOf())
stubOpenDocument(document, defaultDetails)
launchFragment(args)
@ -194,7 +192,7 @@ class MentionWidgetTesting : EditorTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -203,7 +201,6 @@ class MentionWidgetTesting : EditorTestSetup() {
stubInterceptEvents()
stubInterceptThreadStatus()
stubUpdateText()
stubGetListPages(listOf())
stubOpenDocument(document, defaultDetails)
launchFragment(args)

View file

@ -301,7 +301,6 @@ class DisplayRelationObjectValueTest {
layout = ObjectType.Layout.values().random(),
description = "",
isHidden = false,
smartBlockTypes = listOf(),
isArchived = false,
isReadOnly = false
)
@ -314,7 +313,6 @@ class DisplayRelationObjectValueTest {
layout = ObjectType.Layout.values().random(),
description = "",
isHidden = false,
smartBlockTypes = listOf(),
isArchived = false,
isReadOnly = false
)
@ -405,7 +403,6 @@ class DisplayRelationObjectValueTest {
layout = ObjectType.Layout.PROFILE,
description = "",
isHidden = false,
smartBlockTypes = listOf(),
isArchived = false,
isReadOnly = false
)
@ -418,7 +415,6 @@ class DisplayRelationObjectValueTest {
layout = ObjectType.Layout.PROFILE,
description = "",
isHidden = false,
smartBlockTypes = listOf(),
isArchived = false,
isReadOnly = false
)
@ -509,7 +505,6 @@ class DisplayRelationObjectValueTest {
layout = ObjectType.Layout.PROFILE,
description = "",
isHidden = false,
smartBlockTypes = listOf(),
isArchived = false,
isReadOnly = false
)
@ -522,7 +517,6 @@ class DisplayRelationObjectValueTest {
layout = ObjectType.Layout.PROFILE,
description = "",
isHidden = false,
smartBlockTypes = listOf(),
isArchived = false,
isReadOnly = false
)

View file

@ -6,9 +6,7 @@ import androidx.test.filters.LargeTest
import com.anytypeio.anytype.R
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.DVViewerRelation
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.Relation
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent
import com.anytypeio.anytype.test_utils.MockDataFactory
import com.anytypeio.anytype.test_utils.utils.checkHasText
@ -48,19 +46,6 @@ class ObjectSetGridColumnRenderingTest : TestObjectSetSetup() {
@Test
fun shouldRenderAllColumnHeaderNamesBasedOnViewerRelations() {
val type = ObjectType(
url = MockDataFactory.randomUuid(),
name = MockDataFactory.randomString(),
emoji = MockDataFactory.randomString(),
layout = ObjectType.Layout.BASIC,
relationLinks = emptyList(),
description = "",
isHidden = false,
smartBlockTypes = listOf(),
isArchived = false,
isReadOnly = false
)
val relation1 = Relation(
key = MockDataFactory.randomString(),
name = "Description",
@ -139,7 +124,7 @@ class ObjectSetGridColumnRenderingTest : TestObjectSetSetup() {
val root = Block(
id = ctx,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, dataview.id)
)
@ -150,8 +135,7 @@ class ObjectSetGridColumnRenderingTest : TestObjectSetSetup() {
stubOpenObjectSetWithRecord(
set = set,
relations = listOf(relation1, relation2, relation3, relation4, relation5),
details = defaultDetails,
objectTypes = listOf(type)
details = defaultDetails
)
// TESTING

View file

@ -10,7 +10,6 @@ import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.DVViewerRelation
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.Relation
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.emojifier.data.DefaultDocumentEmojiIconProvider
import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
@ -70,7 +69,6 @@ class ObjectSetGridFileCellRenderingTest : TestObjectSetSetup() {
layout = ObjectType.Layout.PROFILE,
description = "",
isHidden = false,
smartBlockTypes = listOf(),
isArchived = false,
isReadOnly = false
)
@ -148,7 +146,7 @@ class ObjectSetGridFileCellRenderingTest : TestObjectSetSetup() {
val root = Block(
id = ctx,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, dataview.id)
)
@ -160,7 +158,6 @@ class ObjectSetGridFileCellRenderingTest : TestObjectSetSetup() {
set = set,
relations = listOf(relation),
details = details,
objectTypes = listOf(objectType)
)
// TESTING

View file

@ -8,7 +8,6 @@ import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.DVViewerRelation
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.Relation
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.emojifier.data.DefaultDocumentEmojiIconProvider
import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
@ -67,7 +66,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
layout = ObjectType.Layout.PROFILE,
description = "",
isHidden = false,
smartBlockTypes = listOf(),
isArchived = false,
isReadOnly = false
)
@ -114,7 +112,7 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
val root = Block(
id = ctx,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, dataview.id)
)
@ -125,7 +123,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
stubOpenObjectSetWithRecord(
set = set,
relations = listOf(relation),
objectTypes = listOf(objectType)
)
// TESTING
@ -163,7 +160,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
layout = ObjectType.Layout.PROFILE,
description = "",
isHidden = false,
smartBlockTypes = listOf(),
isArchived = false,
isReadOnly = false
)
@ -210,7 +206,7 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
val root = Block(
id = ctx,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, dataview.id)
)
@ -221,7 +217,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
stubOpenObjectSetWithRecord(
set = set,
relations = listOf(relation),
objectTypes = listOf(objectType)
)
// TESTING
@ -259,7 +254,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
layout = ObjectType.Layout.PROFILE,
description = "",
isHidden = false,
smartBlockTypes = listOf(),
isArchived = false,
isReadOnly = false
)
@ -306,7 +300,7 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
val root = Block(
id = ctx,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, dataview.id)
)
@ -317,7 +311,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
stubOpenObjectSetWithRecord(
set = set,
relations = listOf(relation),
objectTypes = listOf(objectType)
)
// TESTING
@ -355,7 +348,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
layout = ObjectType.Layout.PROFILE,
description = "",
isHidden = false,
smartBlockTypes = listOf(),
isArchived = false,
isReadOnly = false
)
@ -402,7 +394,7 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
val root = Block(
id = ctx,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, dataview.id)
)
@ -413,7 +405,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
stubOpenObjectSetWithRecord(
set = set,
relations = listOf(relation),
objectTypes = listOf(objectType)
)
// TESTING
@ -451,7 +442,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
layout = ObjectType.Layout.PROFILE,
description = "",
isHidden = false,
smartBlockTypes = listOf(),
isArchived = false,
isReadOnly = false
)
@ -498,7 +488,7 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
val root = Block(
id = ctx,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, dataview.id)
)
@ -509,7 +499,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
stubOpenObjectSetWithRecord(
set = set,
relations = listOf(relation),
objectTypes = listOf(objectType)
)
// TESTING
@ -547,7 +536,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
layout = ObjectType.Layout.PROFILE,
description = "",
isHidden = false,
smartBlockTypes = listOf(),
isArchived = false,
isReadOnly = false
)
@ -594,7 +582,7 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
val root = Block(
id = ctx,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, dataview.id)
)
@ -605,7 +593,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() {
stubOpenObjectSetWithRecord(
set = set,
relations = listOf(relation),
objectTypes = listOf(objectType)
)
// TESTING

View file

@ -11,7 +11,6 @@ import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.DVViewerRelation
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.Relation
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.emojifier.data.DefaultDocumentEmojiIconProvider
import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
@ -61,19 +60,6 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() {
val object2Name = "Jean-Pierre Léaud"
val object2Id = MockDataFactory.randomUuid()
val objectType = ObjectType(
url = MockDataFactory.randomUuid(),
name = "Movie",
relationLinks = emptyList(),
emoji = MockDataFactory.randomString(),
layout = ObjectType.Layout.PROFILE,
description = "",
isHidden = false,
smartBlockTypes = listOf(),
isArchived = false,
isReadOnly = false
)
val relationId = MockDataFactory.randomUuid()
val record1Id = MockDataFactory.randomUuid()
val record2Id = MockDataFactory.randomUuid()
@ -82,7 +68,6 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() {
ObjectSetConfig.ID_KEY to record1Id,
ObjectSetConfig.NAME_KEY to "The Great Dictator",
ObjectSetConfig.EMOJI_KEY to DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random(),
ObjectSetConfig.TYPE_KEY to objectType.url,
relationId to object1Id
)
@ -90,7 +75,6 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() {
ObjectSetConfig.ID_KEY to record2Id,
ObjectSetConfig.NAME_KEY to "Les Quatre Cents Coups",
ObjectSetConfig.EMOJI_KEY to DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random(),
ObjectSetConfig.TYPE_KEY to objectType.url,
relationId to object2Id
)
@ -130,14 +114,12 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() {
object1Id to Block.Fields(
mapOf(
ObjectSetConfig.NAME_KEY to object1Name,
ObjectSetConfig.TYPE_KEY to objectType.url,
"iconEmoji" to "👤"
)
),
object2Id to Block.Fields(
mapOf(
ObjectSetConfig.NAME_KEY to object2Name,
ObjectSetConfig.TYPE_KEY to objectType.url,
"iconEmoji" to "👤"
)
)
@ -147,7 +129,7 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() {
val root = Block(
id = ctx,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, dataview.id)
)
@ -158,8 +140,7 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() {
stubOpenObjectSetWithRecord(
set = set,
relations = listOf(relation),
details = details,
objectTypes = listOf(objectType)
details = details
)
// TESTING
@ -194,7 +175,6 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() {
layout = ObjectType.Layout.PROFILE,
description = "",
isHidden = false,
smartBlockTypes = listOf(),
isArchived = false,
isReadOnly = false
)
@ -263,7 +243,7 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() {
val root = Block(
id = ctx,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, dataview.id)
)
@ -275,7 +255,6 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() {
set = set,
relations = listOf(relation),
details = details,
objectTypes = listOf(objectType)
)
// TESTING

View file

@ -6,9 +6,7 @@ import androidx.test.filters.LargeTest
import com.anytypeio.anytype.R
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.DVViewerRelation
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.Relation
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.emojifier.data.DefaultDocumentEmojiIconProvider
import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
@ -52,19 +50,6 @@ class ObjectSetGridPrimitiveRelationTest : TestObjectSetSetup() {
@Test
fun shouldRenderAllObjectPrimitiveRelationsValuesFromTwoRecords() {
val type = ObjectType(
url = MockDataFactory.randomUuid(),
name = MockDataFactory.randomString(),
emoji = MockDataFactory.randomString(),
layout = ObjectType.Layout.BASIC,
relationLinks = emptyList(),
description = "",
isHidden = false,
smartBlockTypes = listOf(),
isArchived = false,
isReadOnly = false
)
val relation1 = Relation(
key = MockDataFactory.randomString(),
name = "Description",
@ -114,7 +99,6 @@ class ObjectSetGridPrimitiveRelationTest : TestObjectSetSetup() {
val record1 = mapOf(
ObjectSetConfig.ID_KEY to MockDataFactory.randomUuid(),
ObjectSetConfig.TYPE_KEY to type.url,
ObjectSetConfig.NAME_KEY to "Anytype",
"iconEmoji" to DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random(),
relation1.key to object1value1,
@ -126,7 +110,6 @@ class ObjectSetGridPrimitiveRelationTest : TestObjectSetSetup() {
val record2 = mapOf(
ObjectSetConfig.ID_KEY to MockDataFactory.randomUuid(),
ObjectSetConfig.TYPE_KEY to type.url,
ObjectSetConfig.NAME_KEY to "IPFS",
"iconEmoji" to DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random(),
relation1.key to object2value1,
@ -179,7 +162,7 @@ class ObjectSetGridPrimitiveRelationTest : TestObjectSetSetup() {
val root = Block(
id = ctx,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, dataview.id)
)
@ -191,7 +174,6 @@ class ObjectSetGridPrimitiveRelationTest : TestObjectSetSetup() {
set = set,
relations = listOf(relation1, relation2, relation3, relation4, relation5),
details = defaultDetails,
objectTypes = listOf(type)
)
// TESTING

View file

@ -8,9 +8,7 @@ import androidx.test.filters.LargeTest
import com.anytypeio.anytype.R
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.DVViewerRelation
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.Relation
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.emojifier.data.DefaultDocumentEmojiIconProvider
import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
@ -63,19 +61,6 @@ class ObjectSetGridTagCellRenderingTest : TestObjectSetSetup() {
val tag3Name = "Director"
val tag3Id = MockDataFactory.randomUuid()
val objectType = ObjectType(
url = MockDataFactory.randomUuid(),
name = "Film",
relationLinks = emptyList(),
emoji = MockDataFactory.randomString(),
layout = ObjectType.Layout.BASIC ,
description = "",
isHidden = false,
smartBlockTypes = listOf(),
isArchived = false,
isReadOnly = false
)
val relationId = MockDataFactory.randomUuid()
val record1Id = MockDataFactory.randomUuid()
val record2Id = MockDataFactory.randomUuid()
@ -84,7 +69,6 @@ class ObjectSetGridTagCellRenderingTest : TestObjectSetSetup() {
ObjectSetConfig.ID_KEY to record1Id,
ObjectSetConfig.NAME_KEY to "The Face on the Bar Room Floor",
ObjectSetConfig.EMOJI_KEY to DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random(),
ObjectSetConfig.TYPE_KEY to objectType.url,
relationId to listOf(tag1Id, tag3Id)
)
@ -92,7 +76,6 @@ class ObjectSetGridTagCellRenderingTest : TestObjectSetSetup() {
ObjectSetConfig.ID_KEY to record2Id,
ObjectSetConfig.NAME_KEY to "The Great Dictator",
ObjectSetConfig.EMOJI_KEY to DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random(),
ObjectSetConfig.TYPE_KEY to objectType.url,
relationId to listOf(tag2Id, tag3Id)
)
@ -142,7 +125,7 @@ class ObjectSetGridTagCellRenderingTest : TestObjectSetSetup() {
val root = Block(
id = ctx,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, dataview.id)
)
@ -153,8 +136,7 @@ class ObjectSetGridTagCellRenderingTest : TestObjectSetSetup() {
stubOpenObjectSetWithRecord(
set = set,
relations = listOf(relation),
details = details,
objectTypes = listOf(objectType)
details = details
)
// TESTING

View file

@ -7,7 +7,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import com.anytypeio.anytype.R
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.ext.content
import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent
import com.anytypeio.anytype.test_utils.MockDataFactory
@ -69,7 +68,7 @@ class ObjectSetHeaderTest : TestObjectSetSetup() {
val root = Block(
id = ctx,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, dataview.id)
)

View file

@ -8,12 +8,10 @@ import com.anytypeio.anytype.analytics.base.Analytics
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.Event
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.Payload
import com.anytypeio.anytype.core_models.Relation
import com.anytypeio.anytype.core_models.SearchResult
import com.anytypeio.anytype.core_models.SubscriptionEvent
import com.anytypeio.anytype.domain.`object`.UpdateDetail
import com.anytypeio.anytype.domain.auth.repo.AuthRepository
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
import com.anytypeio.anytype.domain.base.Result
@ -30,6 +28,7 @@ import com.anytypeio.anytype.domain.event.interactor.InterceptEvents
import com.anytypeio.anytype.domain.launch.GetDefaultPageType
import com.anytypeio.anytype.domain.misc.UrlBuilder
import com.anytypeio.anytype.domain.`object`.ConvertObjectToCollection
import com.anytypeio.anytype.domain.`object`.UpdateDetail
import com.anytypeio.anytype.domain.objects.DefaultObjectStore
import com.anytypeio.anytype.domain.objects.DefaultStoreOfRelations
import com.anytypeio.anytype.domain.objects.ObjectStore
@ -280,8 +279,7 @@ abstract class TestObjectSetSetup {
fun stubOpenObjectSetWithRecord(
set: List<Block>,
details: Block.Details = Block.Details(),
relations: List<Relation> = emptyList(),
objectTypes: List<ObjectType>
relations: List<Relation> = emptyList()
) {
repo.stub {
onBlocking { openObjectSet(ctx) } doReturn Result.Success(
@ -294,7 +292,6 @@ abstract class TestObjectSetSetup {
details = details,
blocks = set,
relations = relations,
objectTypes = objectTypes
)
)
)

View file

@ -12,20 +12,11 @@ class DefaultFeatureToggles @Inject constructor(
@TogglePrefs private val prefs: SharedPreferences
) : FeatureToggles {
override val isLogFromMiddlewareLibrary =
BuildConfig.LOG_FROM_MW_LIBRARY && isDebug
override val isLogMiddlewareInteraction =
BuildConfig.LOG_MW_INTERACTION && isDebug
override val isLogDashboardReducer =
BuildConfig.LOG_DASHBOARD_REDUCER && isDebug
override val isLogEditorViewModelEvents =
BuildConfig.LOG_EDITOR_VIEWMODEL_EVENTS && isDebug
override val isLogEditorControlPanelMachine =
BuildConfig.LOG_EDITOR_CONTROL_PANEL && isDebug
override val isLogFromMiddlewareLibrary = BuildConfig.LOG_FROM_MW_LIBRARY && isDebug
override val isLogMiddlewareInteraction = BuildConfig.LOG_DASHBOARD_REDUCER && isDebug
override val isLogDashboardReducer = BuildConfig.LOG_DASHBOARD_REDUCER && isDebug
override val isLogEditorViewModelEvents = BuildConfig.LOG_EDITOR_VIEWMODEL_EVENTS && isDebug
override val isLogEditorControlPanelMachine = BuildConfig.LOG_EDITOR_CONTROL_PANEL && isDebug
override val isTroubleshootingMode
get() = prefs.getBoolean(context.getString(R.string.trouble_mode), BuildConfig.DEBUG)

View file

@ -88,7 +88,7 @@ data class Block(
/**
* Smart block.
*/
data class Smart(val type: SmartBlockType = SmartBlockType.PAGE) : Content()
object Smart : Content()
/**
* Textual block.

View file

@ -23,8 +23,6 @@ sealed class Event {
val root: Id,
val details: Block.Details = Block.Details(emptyMap()),
val blocks: List<Block>,
val type: SmartBlockType = SmartBlockType.PAGE,
val objectTypes: List<ObjectType> = emptyList(),
val relations: List<Relation> = emptyList(),
val relationLinks: List<RelationLink> = emptyList(),
val objectRestrictions: List<ObjectRestriction> = emptyList(),

View file

@ -27,9 +27,7 @@ data class ObjectType(
@Deprecated("Will be deprecated. Object type will be treated as object")
val isArchived: Boolean,
@Deprecated("Will be deprecated. Object type will be treated as object")
val isReadOnly: Boolean,
@Deprecated("Will be deprecated. Object type will be treated as object")
val smartBlockTypes: List<SmartBlockType>
val isReadOnly: Boolean
) {
enum class Layout(val code: Int) {
BASIC(0),

View file

@ -7,7 +7,6 @@ data class ObjectView(
val root: Id,
val blocks: List<Block>,
val details: Map<Id, Struct>,
val type: SmartBlockType,
val relations: List<RelationLink>,
val objectRestrictions: List<ObjectRestriction>,
val dataViewRestrictions: List<DataViewRestrictions>

View file

@ -150,16 +150,6 @@ sealed class ObjectWrapper {
val isArchived: Boolean? by default
val iconEmoji: String? by default
val isDeleted: Boolean? by default
val smartBlockTypes: List<SmartBlockType>
get() = when (val value = map[Relations.SMARTBLOCKTYPES]) {
is Double -> buildList {
SmartBlockType.values().firstOrNull { it.code == value.toInt() }
}
is List<*> -> value.typeOf<Double>().mapNotNull { code ->
SmartBlockType.values().firstOrNull { it.code == code.toInt() }
}
else -> emptyList()
}
}
data class Relation(override val map: Struct) : ObjectWrapper() {

View file

@ -1,23 +0,0 @@
package com.anytypeio.anytype.core_models
/**
* @property id document id
* @property fields document fields
* @property snippet text from first child block of the document
* @property hasInboundLinks does this page has inbound pages
*/
data class DocumentInfo(
val id: String,
val obj: ObjectWrapper.Basic,
val snippet: String?,
val hasInboundLinks: Boolean,
val smartBlockType: SmartBlockType
)
data class ObjectLinks(val inbound: List<DocumentInfo>, val outbound: List<DocumentInfo>)
data class ObjectInfoWithLinks(
val id: String,
val documentInfo: DocumentInfo,
val links: ObjectLinks
)

View file

@ -53,6 +53,8 @@ object Relations {
const val FILE_EXT = "fileExt"
const val FILE_MIME_TYPE = "fileMimeType"
const val RECOMMENDED_LAYOUT = "recommendedLayout"
val systemRelationKeys = listOf(
"id",
"name",

View file

@ -1,5 +1,6 @@
package com.anytypeio.anytype.core_models
@Deprecated("To be removed")
enum class SmartBlockType(val code: Int) {
ACCOUNT_OLD(code = 0),
PAGE(code = 16),

View file

@ -8,11 +8,9 @@ import com.anytypeio.anytype.core_models.DVFilter
import com.anytypeio.anytype.core_models.DVSort
import com.anytypeio.anytype.core_models.DVViewer
import com.anytypeio.anytype.core_models.DVViewerType
import com.anytypeio.anytype.core_models.DocumentInfo
import com.anytypeio.anytype.core_models.Hash
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.Key
import com.anytypeio.anytype.core_models.ObjectInfoWithLinks
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.ObjectView
import com.anytypeio.anytype.core_models.ObjectWrapper
@ -249,12 +247,6 @@ class BlockDataRepository(
command: Command.DownloadFile
): String = remote.downloadFile(command)
override suspend fun getObjectInfoWithLinks(
pageId: String
): ObjectInfoWithLinks = remote.getObjectInfoWithLinks(pageId)
override suspend fun getListPages(): List<DocumentInfo> = remote.getListPages()
override suspend fun setRelationKey(command: Command.SetRelationKey): Payload =
remote.setRelationKey(command)

View file

@ -8,10 +8,8 @@ import com.anytypeio.anytype.core_models.DVFilter
import com.anytypeio.anytype.core_models.DVSort
import com.anytypeio.anytype.core_models.DVViewer
import com.anytypeio.anytype.core_models.DVViewerType
import com.anytypeio.anytype.core_models.DocumentInfo
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.Key
import com.anytypeio.anytype.core_models.ObjectInfoWithLinks
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.ObjectView
import com.anytypeio.anytype.core_models.ObjectWrapper
@ -82,10 +80,6 @@ interface BlockDataStore {
suspend fun uploadFile(command: Command.UploadFile): String
suspend fun downloadFile(command: Command.DownloadFile): String
suspend fun getObjectInfoWithLinks(pageId: String): ObjectInfoWithLinks
suspend fun getListPages(): List<DocumentInfo>
suspend fun updateDivider(command: Command.UpdateDivider): Payload
suspend fun setFields(command: Command.SetFields): Payload

View file

@ -8,10 +8,8 @@ import com.anytypeio.anytype.core_models.DVFilter
import com.anytypeio.anytype.core_models.DVSort
import com.anytypeio.anytype.core_models.DVViewer
import com.anytypeio.anytype.core_models.DVViewerType
import com.anytypeio.anytype.core_models.DocumentInfo
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.Key
import com.anytypeio.anytype.core_models.ObjectInfoWithLinks
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.ObjectView
import com.anytypeio.anytype.core_models.ObjectWrapper
@ -81,10 +79,6 @@ interface BlockRemote {
suspend fun uploadFile(command: Command.UploadFile): String
suspend fun downloadFile(command: Command.DownloadFile): String
suspend fun getObjectInfoWithLinks(pageId: String): ObjectInfoWithLinks
suspend fun getListPages(): List<DocumentInfo>
suspend fun setRelationKey(command: Command.SetRelationKey): Payload
suspend fun updateDivider(command: Command.UpdateDivider): Payload

View file

@ -8,10 +8,8 @@ import com.anytypeio.anytype.core_models.DVFilter
import com.anytypeio.anytype.core_models.DVSort
import com.anytypeio.anytype.core_models.DVViewer
import com.anytypeio.anytype.core_models.DVViewerType
import com.anytypeio.anytype.core_models.DocumentInfo
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.Key
import com.anytypeio.anytype.core_models.ObjectInfoWithLinks
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.ObjectView
import com.anytypeio.anytype.core_models.ObjectWrapper
@ -193,11 +191,6 @@ class BlockRemoteDataStore(private val remote: BlockRemote) : BlockDataStore {
command: Command.DownloadFile
): String = remote.downloadFile(command)
override suspend fun getObjectInfoWithLinks(pageId: String): ObjectInfoWithLinks =
remote.getObjectInfoWithLinks(pageId)
override suspend fun getListPages(): List<DocumentInfo> = remote.getListPages()
override suspend fun setRelationKey(command: Command.SetRelationKey): Payload =
remote.setRelationKey(command)

View file

@ -8,11 +8,9 @@ import com.anytypeio.anytype.core_models.DVFilter
import com.anytypeio.anytype.core_models.DVSort
import com.anytypeio.anytype.core_models.DVViewer
import com.anytypeio.anytype.core_models.DVViewerType
import com.anytypeio.anytype.core_models.DocumentInfo
import com.anytypeio.anytype.core_models.Hash
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.Key
import com.anytypeio.anytype.core_models.ObjectInfoWithLinks
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.ObjectView
import com.anytypeio.anytype.core_models.ObjectWrapper
@ -135,9 +133,6 @@ interface BlockRepository {
suspend fun copy(command: Command.Copy): Response.Clipboard.Copy
suspend fun paste(command: Command.Paste): Response.Clipboard.Paste
suspend fun getObjectInfoWithLinks(pageId: String): ObjectInfoWithLinks
suspend fun getListPages(): List<DocumentInfo>
suspend fun updateDivider(command: Command.UpdateDivider): Payload
suspend fun setFields(command: Command.SetFields): Payload

View file

@ -1,7 +1,6 @@
package com.anytypeio.anytype.domain.ext
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.ext.asMap
import com.anytypeio.anytype.core_models.ext.asRender
import com.anytypeio.anytype.core_models.ext.getChildrenIdsList
@ -37,7 +36,7 @@ class BlockExtensionTest {
val root = Block(
id = MockDataFactory.randomUuid(),
fields = Block.Fields.empty(),
content = Block.Content.Smart(type = SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(child.id)
)
@ -95,7 +94,7 @@ class BlockExtensionTest {
val root = Block(
id = MockDataFactory.randomUuid(),
fields = Block.Fields.empty(),
content = Block.Content.Smart(type = SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(children[1].id, children[0].id, children[2].id)
)
@ -147,7 +146,7 @@ class BlockExtensionTest {
val root = Block(
id = MockDataFactory.randomUuid(),
fields = Block.Fields.empty(),
content = Block.Content.Smart(type = SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(parent.id)
)
@ -204,7 +203,7 @@ class BlockExtensionTest {
val root = Block(
id = MockDataFactory.randomUuid(),
fields = Block.Fields.empty(),
content = Block.Content.Smart(type = SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(parent.id)
)
@ -287,7 +286,7 @@ class BlockExtensionTest {
val root = Block(
id = MockDataFactory.randomUuid(),
fields = Block.Fields.empty(),
content = Block.Content.Smart(type = SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(parent.id)
)
@ -406,7 +405,7 @@ class BlockExtensionTest {
val root = Block(
id = MockDataFactory.randomUuid(),
fields = Block.Fields.empty(),
content = Block.Content.Smart(type = SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(row.id, lastBlock.id)
)
@ -485,7 +484,7 @@ class BlockExtensionTest {
val block = Block(
id = MockDataFactory.randomUuid(),
fields = Block.Fields.empty(),
content = Block.Content.Smart(type = SmartBlockType.PAGE),
content = Block.Content.Smart,
children = emptyList()
)
val range = IntRange(0, 44)
@ -931,7 +930,7 @@ class BlockExtensionTest {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id)
)
@ -972,7 +971,7 @@ class BlockExtensionTest {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id)
)
@ -1002,7 +1001,7 @@ class BlockExtensionTest {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id)
)

View file

@ -9,10 +9,8 @@ import com.anytypeio.anytype.core_models.DVFilter
import com.anytypeio.anytype.core_models.DVSort
import com.anytypeio.anytype.core_models.DVViewer
import com.anytypeio.anytype.core_models.DVViewerType
import com.anytypeio.anytype.core_models.DocumentInfo
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.Key
import com.anytypeio.anytype.core_models.ObjectInfoWithLinks
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.ObjectView
import com.anytypeio.anytype.core_models.ObjectWrapper
@ -26,7 +24,6 @@ import com.anytypeio.anytype.core_models.Url
import com.anytypeio.anytype.core_models.WidgetLayout
import com.anytypeio.anytype.data.auth.repo.block.BlockRemote
import com.anytypeio.anytype.middleware.interactor.Middleware
import com.anytypeio.anytype.middleware.mappers.toCoreModel
import com.anytypeio.anytype.middleware.mappers.toMiddlewareModel
class BlockMiddleware(
@ -216,14 +213,6 @@ class BlockMiddleware(
command: Command.DownloadFile
): String = middleware.fileDownload(command).localPath
override suspend fun getObjectInfoWithLinks(pageId: String): ObjectInfoWithLinks {
return middleware.navigationGetObjectInfoWithLinks(pageId).toCoreModel()
}
override suspend fun getListPages(): List<DocumentInfo> {
return middleware.navigationListObjects().map { it.toCoreModel() }
}
override suspend fun setRelationKey(command: Command.SetRelationKey): Payload {
return middleware.blockRelationSetKey(command)
}

View file

@ -2,8 +2,6 @@ package com.anytypeio.anytype.middleware.interactor
import anytype.Rpc
import anytype.model.Block
import anytype.model.ObjectInfo
import anytype.model.ObjectInfoWithLinks
import anytype.model.Range
import com.anytypeio.anytype.core_models.AccountSetup
import com.anytypeio.anytype.core_models.AccountStatus
@ -787,32 +785,6 @@ class Middleware(
return response
}
@Throws(Exception::class)
fun navigationGetObjectInfoWithLinks(pageId: String): ObjectInfoWithLinks {
val request = Rpc.Navigation.GetObjectInfoWithLinks.Request(
objectId = pageId
)
if (BuildConfig.DEBUG) logRequest(request)
val response = service.navigationGetObjectInfoWithLinks(request)
if (BuildConfig.DEBUG) logResponse(response)
val info = response.object_
checkNotNull(info) { "Empty result" }
return info
}
@Throws(Exception::class)
fun navigationListObjects(): List<ObjectInfo> {
val request = Rpc.Navigation.ListObjects.Request()
if (BuildConfig.DEBUG) logRequest(request)
val response = service.navigationListObjects(request)
if (BuildConfig.DEBUG) logResponse(response)
return response.objects
}
@Throws(Exception::class)
fun objectApplyTemplate(
ctx: Id,

View file

@ -2,11 +2,31 @@ package com.anytypeio.anytype.middleware.mappers
import anytype.ResponseEvent
import anytype.Rpc
import anytype.model.ObjectInfo
import anytype.model.ObjectInfoWithLinks
import anytype.model.ObjectLinksInfo
import anytype.model.Restrictions
import com.anytypeio.anytype.core_models.*
import com.anytypeio.anytype.core_models.AccountStatus
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.CreateBlockLinkWithObjectResult
import com.anytypeio.anytype.core_models.CreateObjectResult
import com.anytypeio.anytype.core_models.DVDateFormat
import com.anytypeio.anytype.core_models.DVFilter
import com.anytypeio.anytype.core_models.DVFilterCondition
import com.anytypeio.anytype.core_models.DVFilterOperator
import com.anytypeio.anytype.core_models.DVFilterQuickOption
import com.anytypeio.anytype.core_models.DVSort
import com.anytypeio.anytype.core_models.DVSortType
import com.anytypeio.anytype.core_models.DVTimeFormat
import com.anytypeio.anytype.core_models.DVViewer
import com.anytypeio.anytype.core_models.DVViewerCardSize
import com.anytypeio.anytype.core_models.DVViewerRelation
import com.anytypeio.anytype.core_models.DVViewerType
import com.anytypeio.anytype.core_models.Event
import com.anytypeio.anytype.core_models.ObjectOrder
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.ObjectView
import com.anytypeio.anytype.core_models.Payload
import com.anytypeio.anytype.core_models.Relation
import com.anytypeio.anytype.core_models.RelationFormat
import com.anytypeio.anytype.core_models.RelationLink
import com.anytypeio.anytype.core_models.restrictions.DataViewRestriction
import com.anytypeio.anytype.core_models.restrictions.DataViewRestrictions
import com.anytypeio.anytype.core_models.restrictions.ObjectRestriction
@ -24,22 +44,18 @@ fun ResponseEvent?.toPayload(): Payload {
}
fun MObjectView.toPayload(): Payload {
val type = type.toCoreModel()
return Payload(
context = rootId,
events = listOf(
Event.Command.ShowObject(
context = rootId,
root = rootId,
blocks = blocks.toCoreModels(
types = mapOf(rootId to type)
),
blocks = blocks.toCoreModels(),
details = Block.Details(
details.associate { details ->
details.id to details.details.toCoreModel()
}
),
type = type,
relationLinks = relationLinks.map { it.toCoreModels() },
objectRestrictions = restrictions?.object_?.map { it.toCoreModel() }.orEmpty(),
dataViewRestrictions = restrictions?.dataview?.map { it.toCoreModel() }.orEmpty()
@ -49,23 +65,19 @@ fun MObjectView.toPayload(): Payload {
}
fun MObjectView.toCore(): ObjectView {
val type = type.toCoreModel()
return ObjectView(
root = rootId,
blocks = blocks.toCoreModels(types = mapOf(rootId to type)),
blocks = blocks.toCoreModels(),
details = details.associate { d -> d.id to d.details.orEmpty() },
relations = relationLinks.map { it.toCoreModels() },
objectRestrictions = restrictions?.object_?.map { it.toCoreModel() }.orEmpty(),
dataViewRestrictions = restrictions?.dataview?.map { it.toCoreModel() }.orEmpty(),
type = type
)
}
// ---------------------- BLOCKS ------------------------
fun List<MBlock>.toCoreModels(
types: Map<String, SmartBlockType> = emptyMap()
): List<Block> = mapNotNull { block ->
fun List<MBlock>.toCoreModels(): List<Block> = mapNotNull { block ->
when {
block.text != null -> {
Block(
@ -133,9 +145,7 @@ fun List<MBlock>.toCoreModels(
id = block.id,
fields = block.toCoreModelsFields(),
children = block.childrenIds,
content = Block.Content.Smart(
type = types[block.id] ?: throw IllegalStateException("Type missing")
)
content = Block.Content.Smart
)
}
block.dataview != null -> {
@ -595,19 +605,6 @@ fun MRelation.toCoreModels(): Relation = Relation(
format = format.format()
)
fun MObjectType.toCoreModels(): ObjectType = ObjectType(
url = url,
name = name,
emoji = iconEmoji,
description = description,
isHidden = hidden,
relationLinks = relationLinks.map { it.toCoreModels() },
layout = layout.toCoreModels(),
smartBlockTypes = types.map { it.toCoreModel() },
isArchived = isArchived,
isReadOnly = readonly
)
fun MOTypeLayout.toCoreModels(): ObjectType.Layout = when (this) {
MOTypeLayout.basic -> ObjectType.Layout.BASIC
MOTypeLayout.profile -> ObjectType.Layout.PROFILE
@ -662,49 +659,6 @@ fun MRelationLink.toCoreModels() = RelationLink(
format = format.format()
)
// ---------------------- NAVIGATION & SEARCH ------------------------
fun ObjectInfoWithLinks.toCoreModel(): com.anytypeio.anytype.core_models.ObjectInfoWithLinks {
val i = info
checkNotNull(i)
return ObjectInfoWithLinks(
id = id,
links = links?.toCoreModel() ?: ObjectLinks(emptyList(), emptyList()),
documentInfo = i.toCoreModel()
)
}
fun ObjectLinksInfo.toCoreModel(): ObjectLinks = ObjectLinks(
inbound = inbound.map { it.toCoreModel() },
outbound = outbound.map { it.toCoreModel() }
)
fun ObjectInfo.toCoreModel(): DocumentInfo = DocumentInfo(
id = id,
obj = ObjectWrapper.Basic(details?.toMap() ?: mapOf()),
snippet = snippet,
hasInboundLinks = hasInboundLinks,
smartBlockType = objectType.toCoreModel()
)
fun MSmartBlockType.toCoreModel(): SmartBlockType = when (this) {
MSmartBlockType.Page -> SmartBlockType.PAGE
MSmartBlockType.ProfilePage -> SmartBlockType.PROFILE_PAGE
MSmartBlockType.Home -> SmartBlockType.HOME
MSmartBlockType.Archive -> SmartBlockType.ARCHIVE
MSmartBlockType.File -> SmartBlockType.FILE
MSmartBlockType.Template -> SmartBlockType.TEMPLATE
MSmartBlockType.BundledRelation -> SmartBlockType.BUNDLED_RELATION
MSmartBlockType.SubObject -> SmartBlockType.SUB_OBJECT
MSmartBlockType.BundledObjectType -> SmartBlockType.BUNDLED_OBJECT_TYPE
MSmartBlockType.AnytypeProfile -> SmartBlockType.ANYTYPE_PROFILE
MSmartBlockType.BundledTemplate -> SmartBlockType.BUNDLED_TEMPLATE
MSmartBlockType.Date -> SmartBlockType.DATE
MSmartBlockType.Workspace -> SmartBlockType.WORKSPACE
MSmartBlockType.AccountOld -> SmartBlockType.ACCOUNT_OLD
MSmartBlockType.Widget -> SmartBlockType.WIDGET
MSmartBlockType.MissingObject -> SmartBlockType.MISSING_OBJECT
}
// ---------------------- RESTRICTIONS ------------------------
fun MObjectRestriction.toCoreModel(): ObjectRestriction = when (this) {
MObjectRestriction.Delete -> ObjectRestriction.DELETE

View file

@ -1,20 +1,10 @@
package com.anytypeio.anytype.middleware.mappers
import org.junit.Test
import kotlin.test.assertEquals
import org.junit.Test
class ToCoreModelMappersTest {
@Test
fun `should convert middleware smart block types models to core models`() {
MSmartBlockType.values().forEach { mwModel ->
val coreModel = mwModel.toCoreModel()
assertEquals(
expected = coreModel.code, actual = mwModel.value
)
}
}
@Test
fun `should convert middleware relation type models to core models`() {
MRelationFormat.values().forEach { mwModel ->

View file

@ -103,7 +103,6 @@ interface Editor {
@Deprecated("legacy")
val relations: Store.Relations = Store.Relations()
val objectTypes: Store.ObjectTypes = Store.ObjectTypes()
val textSelection: Store<Editor.TextSelection> = Store.TextSelection()
val objectRestrictions: Store.ObjectRestrictions = Store.ObjectRestrictions()
val relationLinks: Store.RelationLinks = Store.RelationLinks()

View file

@ -26,7 +26,6 @@ import com.anytypeio.anytype.core_models.Position
import com.anytypeio.anytype.core_models.Relation
import com.anytypeio.anytype.core_models.RelationFormat
import com.anytypeio.anytype.core_models.Relations
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.SyncStatus
import com.anytypeio.anytype.core_models.TextBlock
import com.anytypeio.anytype.core_models.ThemeColor
@ -521,7 +520,6 @@ class EditorViewModel(
when (event) {
is Event.Command.ShowObject -> {
orchestrator.stores.details.update(event.details)
orchestrator.stores.objectTypes.update(event.objectTypes)
orchestrator.stores.relationLinks.update(event.relationLinks)
orchestrator.stores.objectRestrictions.update(event.objectRestrictions)
@ -969,11 +967,9 @@ class EditorViewModel(
session.value = Session.OPEN
onStartFocusing(result.data)
orchestrator.proxies.payloads.send(result.data)
// Temporarily hiding sync status for file objects.
// TODO Remove when sync status for files is ready.
result.data.events.forEach { event ->
if (event is Event.Command.ShowObject) {
if (event.type == SmartBlockType.FILE) {
if (event.details.details[context]?.type?.contains(ObjectTypeIds.FILE) == true) {
isSyncStatusVisible.value = false
}
val block = event.blocks.firstOrNull { it.id == context }
@ -1459,50 +1455,17 @@ class EditorViewModel(
sendToast("Your object is not initialized. Please, try again later.")
return
}
blocks.find { it.id == context }?.let { root ->
val content = root.content
check(content is Content.Smart)
when (content.type) {
SmartBlockType.PROFILE_PAGE -> {
val details = orchestrator.stores.details.current().details
dispatch(
command = Command.OpenProfileMenu(
isFavorite = details[context]?.isFavorite ?: false,
isLocked = mode == EditorMode.Locked
)
)
}
SmartBlockType.PAGE -> {
val details = orchestrator.stores.details.current().details
controlPanelInteractor.onEvent(ControlPanelMachine.Event.OnDocumentMenuClicked)
dispatch(
command = Command.OpenDocumentMenu(
isArchived = details[context]?.isArchived ?: false,
isFavorite = details[context]?.isFavorite ?: false,
isLocked = mode == EditorMode.Locked,
fromName = ObjectWrapper.Basic(details[context]?.map ?: emptyMap())
.getProperObjectName() ?: ""
)
)
}
SmartBlockType.FILE -> {
val details = orchestrator.stores.details.current().details
controlPanelInteractor.onEvent(ControlPanelMachine.Event.OnDocumentMenuClicked)
dispatch(
command = Command.OpenDocumentMenu(
isArchived = details[context]?.isArchived ?: false,
isFavorite = details[context]?.isFavorite ?: false,
isLocked = mode == EditorMode.Locked,
fromName = ObjectWrapper.Basic(details[context]?.map ?: emptyMap())
.getProperObjectName() ?: ""
)
)
}
else -> {
Timber.e("Trying to open menu for unexpected smart content: ${content.type}")
}
}
}
controlPanelInteractor.onEvent(ControlPanelMachine.Event.OnDocumentMenuClicked)
val details = orchestrator.stores.details.current().details
val wrapper = ObjectWrapper.Basic(details[context]?.map.orEmpty())
dispatch(
command = Command.OpenDocumentMenu(
isArchived = details[context]?.isArchived ?: false,
isFavorite = details[context]?.isFavorite ?: false,
isLocked = mode == EditorMode.Locked,
fromName = wrapper.getProperObjectName().orEmpty()
)
)
}
fun onEmptyBlockBackspaceClicked(id: String) {

View file

@ -9,7 +9,6 @@ import com.anytypeio.anytype.core_models.ObjectTypeIds.BOOKMARK
import com.anytypeio.anytype.core_models.ObjectWrapper
import com.anytypeio.anytype.core_models.RelationLink
import com.anytypeio.anytype.core_models.Relations
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.ThemeColor
import com.anytypeio.anytype.core_models.ext.parseThemeTextColor
import com.anytypeio.anytype.core_models.ext.textColor
@ -71,20 +70,6 @@ class DefaultBlockViewRenderer @Inject constructor(
val result = mutableListOf<BlockView>()
if (anchor == root.id) {
root.content.let { cnt ->
if (cnt is Content.Smart && cnt.type == SmartBlockType.ARCHIVE) {
result.add(
BlockView.Title.Archive(
mode = BlockView.Mode.READ,
id = anchor,
text = details.details[root.id]?.name.orEmpty()
)
)
}
}
}
var mCounter = count
var isPreviousBlockMedia = false
@ -1473,17 +1458,9 @@ class DefaultBlockViewRenderer @Inject constructor(
val layoutCode = details.details[root.id]?.layout?.toInt()
var layout = ObjectType.Layout.values().find { it.code == layoutCode }
if (layout == null) {
// Retrieving layout based on smart block type:
layout = if (rootContent.type == SmartBlockType.PROFILE_PAGE)
ObjectType.Layout.PROFILE
else {
// Falling back to default layout if layout is not defined
ObjectType.Layout.BASIC
}
}
val layout = ObjectType.Layout.values().find {
it.code == layoutCode
} ?: ObjectType.Layout.BASIC
val blockMode = if (restrictions.contains(ObjectRestriction.DETAILS)) {
BlockView.Mode.READ

View file

@ -3,7 +3,6 @@ package com.anytypeio.anytype.presentation.mapper
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.DVFilterCondition
import com.anytypeio.anytype.core_models.DVFilterOperator
import com.anytypeio.anytype.core_models.DocumentInfo
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.ObjectWrapper
@ -18,8 +17,6 @@ import com.anytypeio.anytype.presentation.editor.editor.mention.createMentionMar
import com.anytypeio.anytype.presentation.editor.editor.model.Alignment
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
import com.anytypeio.anytype.presentation.editor.editor.model.UiBlock
import com.anytypeio.anytype.presentation.navigation.ObjectView
import com.anytypeio.anytype.presentation.objects.ObjectIcon
import com.anytypeio.anytype.presentation.objects.ObjectLayoutView
import com.anytypeio.anytype.presentation.objects.ObjectTypeView
import com.anytypeio.anytype.presentation.objects.getProperName
@ -337,24 +334,6 @@ fun UiBlock.style(): Block.Content.Text.Style = when (this) {
fun DebugSettings.toView(): EditorSettings =
EditorSettings(customContextMenu = this.isAnytypeContextMenuEnabled)
fun DocumentInfo.toView(
urlBuilder: UrlBuilder,
objectTypes: List<ObjectType>
): ObjectView {
val typeId = obj.type.firstOrNull()
val type = objectTypes.find { it.url == typeId }
return ObjectView(
id = id,
title = obj.name.orEmpty(),
subtitle = type?.name.orEmpty(),
icon = ObjectIcon.from(
obj = obj,
layout = obj.layout,
builder = urlBuilder
)
)
}
fun Block.Fields.getName(): String =
this.name.let { name ->
if (name.isNullOrBlank()) Relations.RELATION_NAME_EMPTY else name

View file

@ -3,9 +3,11 @@ package com.anytypeio.anytype.presentation.moving
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.anytypeio.anytype.analytics.base.Analytics
import com.anytypeio.anytype.core_models.DVFilter
import com.anytypeio.anytype.core_models.DVFilterCondition
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.ObjectWrapper
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.Relations
import com.anytypeio.anytype.core_utils.ui.TextInputDialogBottomBehaviorApplier
import com.anytypeio.anytype.domain.base.Resultat
import com.anytypeio.anytype.domain.base.fold
@ -123,9 +125,22 @@ class MoveToViewModel(
viewModelScope.launch {
val params = GetObjectTypes.Params(
sorts = emptyList(),
filters = ObjectSearchConstants.filterObjectTypeLibrary(
workspaceId = workspaceManager.getCurrentWorkspace()
),
filters = buildList {
addAll(
ObjectSearchConstants.filterObjectTypeLibrary(
workspaceId = workspaceManager.getCurrentWorkspace()
)
)
add(
DVFilter(
relation = Relations.RECOMMENDED_LAYOUT,
condition = DVFilterCondition.IN,
value = SupportedLayouts.editorLayouts.map {
it.code.toDouble()
}
)
)
},
keys = ObjectSearchConstants.defaultKeysObjectType
)
getObjectTypes.execute(params).fold(
@ -139,10 +154,7 @@ class MoveToViewModel(
}
private suspend fun getSearchObjectsParams(ctx: Id): SearchObjects.Params {
val filteredTypes = types.value.getOrDefault(emptyList())
.filter { objectType -> objectType.smartBlockTypes.contains(SmartBlockType.PAGE) }
.map { objectType -> objectType.id }
val filteredTypes = types.value.getOrDefault(emptyList()).map { objectType -> objectType.id }
return SearchObjects.Params(
limit = SEARCH_LIMIT,

View file

@ -223,6 +223,15 @@ class ObjectTypeChangeViewModel(
)
)
}
add(
DVFilter(
relation = Relations.RECOMMENDED_LAYOUT,
condition = DVFilterCondition.IN,
value = SupportedLayouts.editorLayouts.map {
it.code.toDouble()
}
)
)
},
sorts = ObjectSearchConstants.defaultObjectSearchSorts(),
query = query,
@ -242,6 +251,15 @@ class ObjectTypeChangeViewModel(
workspaceId = workspaceManager.getCurrentWorkspace()
)
)
add(
DVFilter(
relation = Relations.RECOMMENDED_LAYOUT,
condition = DVFilterCondition.IN,
value = SupportedLayouts.editorLayouts.map {
it.code.toDouble()
}
)
)
},
sorts = ObjectSearchConstants.defaultObjectSearchSorts(),
query = query,

View file

@ -4,7 +4,6 @@ import com.anytypeio.anytype.core_models.ObjectTypeIds.BOOKMARK
import com.anytypeio.anytype.core_models.ObjectTypeIds.COLLECTION
import com.anytypeio.anytype.core_models.ObjectTypeIds.SET
import com.anytypeio.anytype.core_models.ObjectWrapper
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.presentation.mapper.toObjectTypeView
/**
@ -45,11 +44,9 @@ fun List<ObjectWrapper.Type>.getObjectTypeViewsForSBPage(
if (excludeTypes.contains(obj.id)) {
return@forEach
}
if (obj.smartBlockTypes.contains(SmartBlockType.PAGE)) {
val objTypeView = obj.toObjectTypeView(selectedTypes)
result.add(objTypeView)
return@forEach
}
val objTypeView = obj.toObjectTypeView(selectedTypes)
result.add(objTypeView)
return@forEach
}
return result.sortedWith(ObjectTypeViewComparator())
}

View file

@ -14,6 +14,18 @@ object SupportedLayouts {
ObjectType.Layout.NOTE,
ObjectType.Layout.BOOKMARK
)
val editorLayouts = listOf(
ObjectType.Layout.BASIC,
ObjectType.Layout.PROFILE,
ObjectType.Layout.TODO,
ObjectType.Layout.NOTE,
ObjectType.Layout.BOOKMARK
)
val fileLayouts = listOf(
ObjectType.Layout.FILE,
ObjectType.Layout.IMAGE,
)
fun isSupported(layout: ObjectType.Layout?) : Boolean {
return layouts.contains(layout)
}

View file

@ -584,7 +584,8 @@ object ObjectSearchConstants {
Relations.IS_ARCHIVED,
Relations.IS_DELETED,
Relations.SMARTBLOCKTYPES,
Relations.SOURCE_OBJECT
Relations.SOURCE_OBJECT,
Relations.RECOMMENDED_LAYOUT
)
//endregion

View file

@ -9,7 +9,6 @@ import com.anytypeio.anytype.analytics.base.EventsPropertiesKey
import com.anytypeio.anytype.analytics.event.EventAnalytics
import com.anytypeio.anytype.analytics.props.Props
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.domain.base.BaseUseCase
import com.anytypeio.anytype.domain.base.Interactor
import com.anytypeio.anytype.domain.base.fold
@ -123,10 +122,6 @@ class OtherSettingsViewModel(
object Exit : Command()
}
companion object {
private val DEFAULT_SETTINGS_SMART_BLOCK_TYPE = SmartBlockType.PAGE
}
class Factory(
private val getDefaultPageType: GetDefaultPageType,
private val setDefaultEditorType: SetDefaultEditorType,

View file

@ -48,7 +48,7 @@ object MockTypicalDocumentFactory {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, a.id)
)
return listOf(page, header, title, a)
@ -58,7 +58,7 @@ object MockTypicalDocumentFactory {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PROFILE_PAGE),
content = Block.Content.Smart,
children = listOf(header.id, a.id)
)
return listOf(page, header, title, a)

View file

@ -14,6 +14,7 @@ import com.anytypeio.anytype.presentation.editor.render.parseThemeBackgroundColo
import com.anytypeio.anytype.presentation.util.TXT
import com.anytypeio.anytype.test_utils.MockDataFactory
import com.jraska.livedata.test
import kotlin.test.assertEquals
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
@ -21,7 +22,6 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
import kotlin.test.assertEquals
@Config(sdk = [Build.VERSION_CODES.P])
@RunWith(RobolectricTestRunner::class)
@ -54,7 +54,7 @@ class BlockReadModeTest : EditorViewModelTest() {
Block(
id = root,
fields = Block.Fields.empty(),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id) + blocks.map { it.id }
)
) + listOf(header, title) + blocks

View file

@ -60,7 +60,7 @@ class DataViewBlockTargetObjectSetTest : EditorPresentationTestSetup() {
id = root,
fields = Block.Fields.empty(),
children = listOf(header.id, block.id, dv.id),
content = Block.Content.Smart()
content = Block.Content.Smart
)
stubOpenDocument(document = listOf(page, header, title, block, dv))
@ -114,7 +114,7 @@ class DataViewBlockTargetObjectSetTest : EditorPresentationTestSetup() {
id = root,
fields = Block.Fields.empty(),
children = listOf(header.id, block.id, dv.id),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val objectDetails = Block.Fields(
mapOf(
@ -177,7 +177,7 @@ class DataViewBlockTargetObjectSetTest : EditorPresentationTestSetup() {
id = root,
fields = Block.Fields.empty(),
children = listOf(header.id, block.id, dv.id),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val objectDetails = Block.Fields(
mapOf(
@ -240,7 +240,7 @@ class DataViewBlockTargetObjectSetTest : EditorPresentationTestSetup() {
id = root,
fields = Block.Fields.empty(),
children = listOf(header.id, block.id, dv.id),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val objectDetails = Block.Fields(
mapOf(
@ -303,7 +303,7 @@ class DataViewBlockTargetObjectSetTest : EditorPresentationTestSetup() {
id = root,
fields = Block.Fields.empty(),
children = listOf(header.id, block.id, dv.id),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val objectDetails = Block.Fields(
mapOf(
@ -365,7 +365,7 @@ class DataViewBlockTargetObjectSetTest : EditorPresentationTestSetup() {
id = root,
fields = Block.Fields.empty(),
children = listOf(header.id, block.id, dv.id),
content = Block.Content.Smart()
content = Block.Content.Smart
)
stubOpenDocument(document = listOf(page, header, title, block, dv))
@ -426,7 +426,7 @@ class DataViewBlockTargetObjectSetTest : EditorPresentationTestSetup() {
id = root,
fields = Block.Fields.empty(),
children = listOf(header.id, block.id, dv.id),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val events = flow<List<Event>> {

View file

@ -6,7 +6,6 @@ import com.anytypeio.anytype.core_models.Block.Content.Link
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.Relations
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.StubBookmark
import com.anytypeio.anytype.core_models.StubCallout
import com.anytypeio.anytype.core_models.StubFile
@ -178,7 +177,7 @@ class DefaultBlockViewRendererTest {
id = MockDataFactory.randomUuid(),
children = listOf(header.id, paragraph.id, toggle.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val blocks = listOf(page, header, title, paragraph, toggle, checkbox)
@ -317,7 +316,7 @@ class DefaultBlockViewRendererTest {
id = MockDataFactory.randomUuid(),
children = listOf(header.id, paragraph.id, toggle.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val blocks = listOf(page, header, title, paragraph, toggle, checkbox)
@ -453,7 +452,7 @@ class DefaultBlockViewRendererTest {
id = MockDataFactory.randomUuid(),
children = listOf(header.id, paragraph.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val blocks = listOf(page, header, title, paragraph)
@ -544,7 +543,7 @@ class DefaultBlockViewRendererTest {
id = MockDataFactory.randomUuid(),
children = listOf(header.id, paragraph.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val blocks = listOf(page, header, title, paragraph)
@ -597,7 +596,7 @@ class DefaultBlockViewRendererTest {
}
@Test
fun `should add profile title when smart block is profile`() {
fun `should add profile title when layout is profile`() {
val title = Block(
id = MockDataFactory.randomUuid(),
@ -636,8 +635,10 @@ class DefaultBlockViewRendererTest {
val pageId = MockDataFactory.randomUuid()
val fields = Block.Fields(
map = mapOf(
"name" to name,
"iconImage" to imageName
Relations.ID to pageId,
Relations.NAME to name,
Relations.ICON_IMAGE to imageName,
Relations.LAYOUT to ObjectType.Layout.PROFILE.code.toDouble()
)
)
val details = mapOf(pageId to fields)
@ -646,7 +647,7 @@ class DefaultBlockViewRendererTest {
id = pageId,
children = listOf(header.id, paragraph.id),
fields = fields,
content = Block.Content.Smart(SmartBlockType.PROFILE_PAGE)
content = Block.Content.Smart
)
val blocks = listOf(page, header, title, paragraph)
@ -699,7 +700,7 @@ class DefaultBlockViewRendererTest {
}
@Test
fun `should add title when smart block is page`() {
fun `should fallback to basic title when layout is not defined`() {
val title = Block(
id = MockDataFactory.randomUuid(),
@ -748,7 +749,7 @@ class DefaultBlockViewRendererTest {
id = pageId,
children = listOf(header.id, paragraph.id),
fields = fields,
content = Block.Content.Smart()
content = Block.Content.Smart
)
val blocks = listOf(page, header, title, paragraph)
@ -865,7 +866,7 @@ class DefaultBlockViewRendererTest {
id = MockDataFactory.randomUuid(),
children = listOf(header.id, a.id),
fields = fields,
content = Block.Content.Smart()
content = Block.Content.Smart
)
val details = mapOf(page.id to fields)
@ -1032,7 +1033,7 @@ class DefaultBlockViewRendererTest {
id = MockDataFactory.randomUuid(),
children = listOf(header.id, a.id),
fields = fields,
content = Block.Content.Smart()
content = Block.Content.Smart
)
val details = mapOf(page.id to fields)
@ -1196,7 +1197,7 @@ class DefaultBlockViewRendererTest {
id = MockDataFactory.randomUuid(),
children = listOf(header.id, a.id),
fields = fields,
content = Block.Content.Smart()
content = Block.Content.Smart
)
val details = mapOf(page.id to fields)
@ -1324,7 +1325,7 @@ class DefaultBlockViewRendererTest {
id = MockDataFactory.randomUuid(),
children = listOf(header.id),
fields = fields,
content = Block.Content.Smart()
content = Block.Content.Smart
)
val details = mapOf(page.id to fields)
@ -1392,7 +1393,7 @@ class DefaultBlockViewRendererTest {
id = MockDataFactory.randomUuid(),
children = listOf(header.id),
fields = fields,
content = Block.Content.Smart()
content = Block.Content.Smart
)
val details = mapOf(page.id to fields)
@ -1505,7 +1506,7 @@ class DefaultBlockViewRendererTest {
id = MockDataFactory.randomUuid(),
children = listOf(header.id, a.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val randomEmoji1 = DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random()
@ -1694,7 +1695,7 @@ class DefaultBlockViewRendererTest {
id = MockDataFactory.randomUuid(),
children = listOf(header.id, a.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val randomEmoji1 = DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random()
@ -1883,7 +1884,7 @@ class DefaultBlockViewRendererTest {
id = MockDataFactory.randomUuid(),
children = listOf(header.id, a.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val randomEmoji1 = DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random()
@ -2069,7 +2070,7 @@ class DefaultBlockViewRendererTest {
id = MockDataFactory.randomUuid(),
children = listOf(header.id, a.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val randomEmoji1 = DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random()
@ -2242,7 +2243,7 @@ class DefaultBlockViewRendererTest {
id = MockDataFactory.randomUuid(),
children = listOf(header.id, a.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val randomEmoji1 = DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random()
@ -2379,7 +2380,7 @@ class DefaultBlockViewRendererTest {
id = MockDataFactory.randomUuid(),
children = listOf(header.id, a.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val fieldsUpdated1 = Block.Fields(mapOf(Relations.NAME to mentionText2))
@ -2520,7 +2521,7 @@ class DefaultBlockViewRendererTest {
id = MockDataFactory.randomUuid(),
children = listOf(header.id, a.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val randomEmoji1 = DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random()
@ -2654,7 +2655,7 @@ class DefaultBlockViewRendererTest {
id = MockDataFactory.randomUuid(),
children = listOf(header.id, a.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val blocks = listOf(page, header, title, a)
@ -2805,7 +2806,7 @@ class DefaultBlockViewRendererTest {
id = MockDataFactory.randomUuid(),
children = listOf(header.id, a.id),
fields = fields,
content = Block.Content.Smart()
content = Block.Content.Smart
)
val details = mapOf(page.id to fields)
@ -3043,7 +3044,7 @@ class DefaultBlockViewRendererTest {
id = "objectId",
children = listOf(header.id, a1.id, a2.id, a3.id, a4.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val details = mapOf(page.id to Block.Fields.empty())
@ -3308,7 +3309,7 @@ class DefaultBlockViewRendererTest {
id = "objectId",
children = listOf(header.id, a1.id, a2.id, a3.id, a4.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val details = mapOf(page.id to Block.Fields.empty())
@ -3525,7 +3526,7 @@ class DefaultBlockViewRendererTest {
id = "root",
children = listOf(header.id) + listOf(div1.id, div2.id, div3.id, div4.id),
fields = fields,
content = Block.Content.Smart()
content = Block.Content.Smart
)
val details = mapOf(page.id to fields)
@ -3664,7 +3665,7 @@ class DefaultBlockViewRendererTest {
div4.id
) + numbered.subList(20, 25).map { it.id },
fields = fields,
content = Block.Content.Smart()
content = Block.Content.Smart
)
val details = mapOf(page.id to fields)
@ -3854,7 +3855,7 @@ class DefaultBlockViewRendererTest {
div2.id
) + listOf(afterDiv2Num1.id, afterDiv2Num2.id),
fields = fields,
content = Block.Content.Smart()
content = Block.Content.Smart
)
val details = mapOf(page.id to fields)
@ -4164,7 +4165,7 @@ class DefaultBlockViewRendererTest {
id = "objectId",
children = listOf(header.id, a1.id, a2.id, a3.id, a4.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val details = mapOf(page.id to Block.Fields.empty())
@ -4436,7 +4437,7 @@ class DefaultBlockViewRendererTest {
id = "objectId",
children = listOf(quote.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val details = mapOf(page.id to Block.Fields.empty())
@ -4543,7 +4544,7 @@ class DefaultBlockViewRendererTest {
id = "objectId",
children = listOf(quote1.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val details = mapOf(page.id to Block.Fields.empty())
@ -4666,7 +4667,7 @@ class DefaultBlockViewRendererTest {
id = "objectId",
children = listOf(quote1.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val details = mapOf(page.id to Block.Fields.empty())
@ -4828,7 +4829,7 @@ class DefaultBlockViewRendererTest {
id = "objectId",
children = listOf(quote1.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val details = mapOf(page.id to Block.Fields.empty())
@ -5016,7 +5017,7 @@ class DefaultBlockViewRendererTest {
id = "objectId",
children = listOf(paragraph.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val details = mapOf(page.id to Block.Fields.empty())

View file

@ -3,7 +3,6 @@ package com.anytypeio.anytype.presentation.editor
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.Block.Content.Link.IconSize
import com.anytypeio.anytype.core_models.Event
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.StubBookmark
import com.anytypeio.anytype.core_models.ext.content
import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubLinkContent
@ -39,7 +38,7 @@ class DocumentExternalEventReducerTest {
id = MockDataFactory.randomUuid(),
fields = Block.Fields.empty(),
children = listOf(title.id, bookmark.id),
content = Block.Content.Smart(type = SmartBlockType.PAGE)
content = Block.Content.Smart
)
val state = listOf(page, title, bookmark)
@ -169,7 +168,7 @@ class DocumentExternalEventReducerTest {
id = MockDataFactory.randomUuid(),
fields = Block.Fields.empty(),
children = listOf(title.id, bookmark.id),
content = Block.Content.Smart(type = SmartBlockType.PAGE)
content = Block.Content.Smart
)
val state = listOf(page, title, bookmark)
@ -214,7 +213,7 @@ class DocumentExternalEventReducerTest {
id = MockDataFactory.randomUuid(),
fields = Block.Fields.empty(),
children = listOf(title.id, link.id),
content = Block.Content.Smart(type = SmartBlockType.PAGE)
content = Block.Content.Smart
)
val state = listOf(page, title, link)

View file

@ -11,7 +11,6 @@ import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.Payload
import com.anytypeio.anytype.core_models.Position
import com.anytypeio.anytype.core_models.Relation
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.StubFile
import com.anytypeio.anytype.core_models.StubNumbered
import com.anytypeio.anytype.core_models.StubParagraph
@ -418,7 +417,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, child)
),
header,
@ -622,7 +621,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, child)
),
header,
@ -722,7 +721,7 @@ open class EditorViewModelTest {
val smart = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, child)
)
@ -775,7 +774,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, child)
),
header,
@ -888,7 +887,7 @@ open class EditorViewModelTest {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, child)
)
@ -1050,7 +1049,7 @@ open class EditorViewModelTest {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, child)
)
@ -1204,7 +1203,7 @@ open class EditorViewModelTest {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, child)
)
@ -1284,7 +1283,7 @@ open class EditorViewModelTest {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, child)
)
@ -1387,7 +1386,7 @@ open class EditorViewModelTest {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, child)
)
@ -1477,7 +1476,7 @@ open class EditorViewModelTest {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(child)
)
@ -1589,7 +1588,7 @@ open class EditorViewModelTest {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, child)
)
@ -1791,7 +1790,7 @@ open class EditorViewModelTest {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, child.id)
)
@ -1860,7 +1859,7 @@ open class EditorViewModelTest {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, firstChild.id, secondChild.id)
)
@ -1999,7 +1998,7 @@ open class EditorViewModelTest {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, child.id)
)
@ -2104,7 +2103,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, child)
),
header,
@ -2231,7 +2230,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, child)
),
header,
@ -2374,7 +2373,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
),
header,
@ -2476,7 +2475,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
),
header,
@ -2577,7 +2576,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(title.id, file.id)
),
title,
@ -2634,7 +2633,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(title.id, file.id)
),
title,
@ -2695,7 +2694,7 @@ open class EditorViewModelTest {
fields = Block.Fields(
map = mapOf("icon" to "")
),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(title.id, paragraph.id)
),
title,
@ -2760,7 +2759,7 @@ open class EditorViewModelTest {
fields = Block.Fields(
map = mapOf("icon" to "")
),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(title.id, paragraph.id)
),
title,
@ -2825,7 +2824,7 @@ open class EditorViewModelTest {
fields = Block.Fields(
map = mapOf("icon" to "")
),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(title.id)
),
title
@ -2879,7 +2878,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields.empty(),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(title.id, paragraph.id)
),
title,
@ -2949,7 +2948,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields.empty(),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(title.id, numbered.id)
),
title,
@ -3022,7 +3021,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields.empty(),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(title.id, paragraph.id)
),
title,
@ -3083,7 +3082,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields.empty(),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(paragraph.id)
),
paragraph
@ -3179,7 +3178,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields.empty(),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id) + paragraphs.map { it.id }
)
) + listOf(header, title) + paragraphs
@ -3362,7 +3361,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields.empty(),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id) + paragraphs.map { it.id }
)
) + listOf(header, title) + paragraphs
@ -3471,7 +3470,7 @@ open class EditorViewModelTest {
fields = Block.Fields(
mapOf(Block.Fields.IS_LOCKED_KEY to false)
),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, picture.id)
),
header,
@ -3550,7 +3549,7 @@ open class EditorViewModelTest {
fields = Block.Fields(
mapOf(Block.Fields.IS_LOCKED_KEY to false)
),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, video.id)
),
header,
@ -3624,7 +3623,7 @@ open class EditorViewModelTest {
fields = Block.Fields(
mapOf(Block.Fields.IS_LOCKED_KEY to false)
),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, file.id)
),
header,
@ -4001,7 +4000,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields.empty(),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id) + paragraphs.map { it.id }
)
) + listOf(header, title) + paragraphs
@ -4116,7 +4115,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields.empty(),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id) + paragraphs.map { it.id }
)
) + listOf(header, title) + paragraphs
@ -4235,7 +4234,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields.empty(),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id) + paragraphs.map { it.id }
)
) + listOf(header, title) + paragraphs
@ -4388,7 +4387,7 @@ open class EditorViewModelTest {
Block(
id = root,
fields = Block.Fields.empty(),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = blocks.map { it.id }
)
) + blocks

View file

@ -32,6 +32,7 @@ import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.presentation.util.TXT
import com.anytypeio.anytype.test_utils.MockDataFactory
import com.jraska.livedata.test
import kotlin.test.assertEquals
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Rule
@ -40,7 +41,6 @@ import org.mockito.MockitoAnnotations
import org.mockito.kotlin.times
import org.mockito.kotlin.verifyBlocking
import org.mockito.kotlin.verifyNoInteractions
import kotlin.test.assertEquals
class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
@ -98,7 +98,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, parent.id)
)
@ -221,7 +221,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, parent.id)
)
@ -362,7 +362,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, parent.id)
)
@ -474,7 +474,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, bookmark.id, paragraph.id)
)
@ -576,7 +576,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, bookmark.id, paragraph.id)
)
@ -672,7 +672,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, checkbox.id)
)
@ -717,7 +717,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, bulleted.id)
)
@ -762,7 +762,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, numbered.id)
)
@ -807,7 +807,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, toggle.id)
)
@ -852,7 +852,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, quote.id)
)
@ -902,7 +902,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, checkbox.id)
)
@ -986,7 +986,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, bulleted.id)
)
@ -1069,7 +1069,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, quote.id)
)
@ -1152,7 +1152,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, toggle.id)
)
@ -1235,7 +1235,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, numbered.id)
)
@ -1342,7 +1342,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id),
)
@ -1417,7 +1417,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id),
)
@ -1484,7 +1484,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id),
)
@ -1567,7 +1567,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id),
)

View file

@ -7,13 +7,13 @@ import com.anytypeio.anytype.presentation.MockBlockFactory
import com.anytypeio.anytype.presentation.editor.editor.actions.ActionItemType
import com.anytypeio.anytype.presentation.editor.editor.listener.ListenerType
import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import kotlin.test.assertContains
import kotlin.test.assertFalse
import kotlin.test.assertTrue
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.MockitoAnnotations
import kotlin.test.assertContains
import kotlin.test.assertFalse
import kotlin.test.assertTrue
class EditorBlockActionsTest : EditorPresentationTestSetup() {
@ -39,7 +39,7 @@ class EditorBlockActionsTest : EditorPresentationTestSetup() {
val smart = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, link.id)
)
@ -79,7 +79,7 @@ class EditorBlockActionsTest : EditorPresentationTestSetup() {
val smart = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, p1.id, divider.id, p2.id)
)
@ -121,7 +121,7 @@ class EditorBlockActionsTest : EditorPresentationTestSetup() {
val smart = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, p1.id, divider.id, p2.id)
)
@ -170,7 +170,7 @@ class EditorBlockActionsTest : EditorPresentationTestSetup() {
val smart = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, p1.id, divider.id, p2.id)
)

View file

@ -3,7 +3,6 @@ package com.anytypeio.anytype.presentation.editor.editor
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.Payload
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.ext.content
import com.anytypeio.anytype.domain.base.Either
import com.anytypeio.anytype.domain.block.interactor.UpdateCheckbox
@ -63,7 +62,7 @@ class EditorCheckboxTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(type = SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(child)
),
checkbox
@ -123,7 +122,7 @@ class EditorCheckboxTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(type = SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(child)
),
checkbox

View file

@ -45,7 +45,7 @@ class EditorCreateBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id)
)

View file

@ -15,13 +15,13 @@ import com.anytypeio.anytype.presentation.editor.render.parseThemeBackgroundColo
import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.test_utils.MockDataFactory
import com.jraska.livedata.test
import kotlin.test.assertTrue
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.MockitoAnnotations
import org.mockito.kotlin.times
import org.mockito.kotlin.verifyBlocking
import kotlin.test.assertTrue
class EditorDuplicateTest : EditorPresentationTestSetup() {
@ -59,7 +59,7 @@ class EditorDuplicateTest : EditorPresentationTestSetup() {
val smart = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id, b.id, c.id)
)
@ -120,7 +120,7 @@ class EditorDuplicateTest : EditorPresentationTestSetup() {
val smart = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id, b.id, c.id)
)
@ -312,7 +312,7 @@ class EditorDuplicateTest : EditorPresentationTestSetup() {
val smart = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id, c.id)
)

View file

@ -3,7 +3,6 @@ package com.anytypeio.anytype.presentation.editor.editor
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.Position
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.StubHeader
import com.anytypeio.anytype.core_models.StubLinkToObjectBlock
import com.anytypeio.anytype.core_models.StubSmartBlock
@ -73,7 +72,7 @@ class EditorEmptySpaceInteractionTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id)
)
@ -126,7 +125,7 @@ class EditorEmptySpaceInteractionTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
@ -241,7 +240,7 @@ class EditorEmptySpaceInteractionTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(type = SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(pic.id, txt.id)
),
pic,
@ -323,7 +322,7 @@ class EditorEmptySpaceInteractionTest : EditorPresentationTestSetup() {
id = root,
children = listOf(header.id) + listOf(table.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val document = listOf(page, header, title, table)

View file

@ -2,7 +2,6 @@ package com.anytypeio.anytype.presentation.editor.editor
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.domain.base.Either
import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.test_utils.MockDataFactory
@ -50,7 +49,7 @@ class EditorErrorMessageTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(file.id)
),
file

View file

@ -45,7 +45,7 @@ class EditorEventSubscriptionTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id)
)

View file

@ -5,7 +5,6 @@ import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.Relation
import com.anytypeio.anytype.core_models.Relations
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.StubObjectType
import com.anytypeio.anytype.core_models.StubRelationObject
import com.anytypeio.anytype.core_models.ext.content
@ -19,6 +18,7 @@ import com.anytypeio.anytype.presentation.relations.ObjectRelationView
import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.test_utils.MockDataFactory
import com.jraska.livedata.test
import kotlin.test.assertEquals
import kotlinx.coroutines.test.runTest
import net.lachlanmckee.timberjunit.TimberTestRule
import org.junit.After
@ -26,7 +26,6 @@ import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.MockitoAnnotations
import kotlin.test.assertEquals
class EditorFeaturedRelationsTest : EditorPresentationTestSetup() {
@ -70,7 +69,7 @@ class EditorFeaturedRelationsTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, featuredBlock.id, block.id)
)
@ -201,7 +200,7 @@ class EditorFeaturedRelationsTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
@ -313,7 +312,7 @@ class EditorFeaturedRelationsTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, featuredBlock.id, block.id)
)
@ -423,7 +422,7 @@ class EditorFeaturedRelationsTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, featuredBlock.id, block.id)
)
@ -552,7 +551,7 @@ class EditorFeaturedRelationsTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, featuredBlock.id, block.id)
)
@ -687,7 +686,7 @@ class EditorFeaturedRelationsTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, featuredBlock.id, block.id)
)
@ -808,7 +807,7 @@ class EditorFeaturedRelationsTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, featuredBlock.id, block.id)
)

View file

@ -18,12 +18,12 @@ import com.anytypeio.anytype.presentation.editor.editor.model.Focusable
import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.test_utils.MockDataFactory
import com.jraska.livedata.test
import kotlin.test.assertEquals
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.MockitoAnnotations
import org.mockito.kotlin.verifyNoInteractions
import kotlin.test.assertEquals
class EditorFocusTest : EditorPresentationTestSetup() {
@ -80,7 +80,7 @@ class EditorFocusTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
),
header,
@ -130,7 +130,7 @@ class EditorFocusTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id)
),
header,
@ -173,7 +173,7 @@ class EditorFocusTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id)
),
header,
@ -229,7 +229,7 @@ class EditorFocusTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
),
header,
@ -301,7 +301,7 @@ class EditorFocusTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
val document = listOf(page, header, title, paragraph)
@ -343,7 +343,7 @@ class EditorFocusTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, first.id)
)
val doc = listOf(page, header, title, first)
@ -395,7 +395,7 @@ class EditorFocusTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, first.id)
)
val doc = listOf(page, header, title, first)
@ -453,7 +453,7 @@ class EditorFocusTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, table.id, paragraph.id) + listOf(table.id) + listOf(
paragraph.id
)

View file

@ -73,7 +73,7 @@ class EditorGranularChangeTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, checkbox.id)
),
header,

View file

@ -66,7 +66,7 @@ class EditorLatexBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, latex.id)
)
@ -125,7 +125,7 @@ class EditorLatexBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, p.id)
)

View file

@ -3,7 +3,6 @@ package com.anytypeio.anytype.presentation.editor.editor
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.Event
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.StubTitle
import com.anytypeio.anytype.core_models.ThemeColor
import com.anytypeio.anytype.core_models.ext.content
@ -61,7 +60,7 @@ class EditorListBlockTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, child)
),
header,
@ -130,7 +129,7 @@ class EditorListBlockTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, child)
),
header,
@ -199,7 +198,7 @@ class EditorListBlockTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, child)
),
header,
@ -266,7 +265,7 @@ class EditorListBlockTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, child)
),
header,
@ -344,7 +343,7 @@ class EditorListBlockTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, child)
),
header,
@ -479,7 +478,7 @@ class EditorListBlockTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, child)
),
header,
@ -633,7 +632,7 @@ class EditorListBlockTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, child)
),
header,
@ -768,7 +767,7 @@ class EditorListBlockTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, child)
),
header,

View file

@ -4,7 +4,6 @@ import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.Relations
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.StubBookmark
import com.anytypeio.anytype.core_models.StubTitle
import com.anytypeio.anytype.core_models.ThemeColor
@ -21,11 +20,11 @@ import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.presentation.util.TXT
import com.anytypeio.anytype.test_utils.MockDataFactory
import com.jraska.livedata.test
import kotlin.test.assertEquals
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.MockitoAnnotations
import kotlin.test.assertEquals
class EditorLockPageTest : EditorPresentationTestSetup() {
@ -73,7 +72,7 @@ class EditorLockPageTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields.empty(),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, child.id)
),
header,
@ -142,7 +141,7 @@ class EditorLockPageTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields.empty(),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, child.id)
),
header,
@ -211,7 +210,7 @@ class EditorLockPageTest : EditorPresentationTestSetup() {
fields = Block.Fields(
mapOf(Block.Fields.IS_LOCKED_KEY to true)
),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, child.id)
),
header,
@ -268,7 +267,7 @@ class EditorLockPageTest : EditorPresentationTestSetup() {
fields = Block.Fields(
mapOf(Block.Fields.IS_LOCKED_KEY to true)
),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, link.id)
),
header,
@ -374,7 +373,7 @@ class EditorLockPageTest : EditorPresentationTestSetup() {
fields = Block.Fields(
mapOf(Block.Fields.IS_LOCKED_KEY to true)
),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
),
header,
@ -483,7 +482,7 @@ class EditorLockPageTest : EditorPresentationTestSetup() {
fields = Block.Fields(
mapOf(Block.Fields.IS_LOCKED_KEY to true)
),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, bookmark.id)
),
header,
@ -589,7 +588,7 @@ class EditorLockPageTest : EditorPresentationTestSetup() {
fields = Block.Fields(
mapOf(Block.Fields.IS_LOCKED_KEY to true)
),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, file.id)
),
header,
@ -682,7 +681,7 @@ class EditorLockPageTest : EditorPresentationTestSetup() {
fields = Block.Fields(
mapOf(Block.Fields.IS_LOCKED_KEY to true)
),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, picture.id)
),
header,

View file

@ -4,7 +4,6 @@ import android.util.Log
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.ObjectTypeIds.PAGE
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.ext.content
import com.anytypeio.anytype.presentation.BuildConfig
import com.anytypeio.anytype.presentation.MockTypicalDocumentFactory
@ -15,13 +14,13 @@ import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.presentation.util.TXT
import com.anytypeio.anytype.test_utils.MockDataFactory
import com.jraska.livedata.test
import kotlin.test.assertEquals
import net.lachlanmckee.timberjunit.TimberTestRule
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.MockitoAnnotations
import kotlin.test.assertEquals
class EditorMarkupObjectTest : EditorPresentationTestSetup() {
@ -67,7 +66,7 @@ class EditorMarkupObjectTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
@ -218,7 +217,7 @@ class EditorMarkupObjectTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
@ -386,7 +385,7 @@ class EditorMarkupObjectTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)

View file

@ -25,6 +25,8 @@ import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.presentation.util.TXT
import com.anytypeio.anytype.test_utils.MockDataFactory
import com.jraska.livedata.test
import kotlin.test.assertEquals
import kotlin.time.ExperimentalTime
import kotlinx.coroutines.runBlocking
import net.lachlanmckee.timberjunit.TimberTestRule
import org.junit.Before
@ -40,8 +42,6 @@ import org.mockito.kotlin.times
import org.mockito.kotlin.verify
import org.mockito.kotlin.verifyBlocking
import org.mockito.kotlin.verifyNoInteractions
import kotlin.test.assertEquals
import kotlin.time.ExperimentalTime
class EditorMentionTest : EditorPresentationTestSetup() {
@ -152,7 +152,7 @@ class EditorMentionTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id)
)
@ -302,7 +302,7 @@ class EditorMentionTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id)
)
@ -470,7 +470,7 @@ class EditorMentionTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id)
)
@ -606,7 +606,7 @@ class EditorMentionTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id)
)
@ -714,7 +714,7 @@ class EditorMentionTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id)
)
@ -863,7 +863,7 @@ class EditorMentionTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id)
)
@ -1010,7 +1010,7 @@ class EditorMentionTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id)
)

View file

@ -24,33 +24,6 @@ class EditorMenuTest : EditorPresentationTestSetup() {
MockitoAnnotations.openMocks(this)
}
@Test
fun `should dispatch command for opening profile menu if document is started`() {
// SETUP
val doc = profile(root)
stubInterceptEvents()
stubOpenDocument(document = doc)
val vm = buildViewModel()
// TESTING
vm.onStart(root)
val observer = vm.commands.test()
observer.assertNoValue()
vm.onDocumentMenuClicked()
observer.assertValue { value ->
value.peekContent() == Command.OpenProfileMenu(isFavorite = false, isLocked = false)
}
}
@Test
fun `should not dispatch command for opening profile menu if document is not started`() {

View file

@ -2,7 +2,6 @@ package com.anytypeio.anytype.presentation.editor.editor
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.StubHeader
import com.anytypeio.anytype.core_models.StubParagraph
import com.anytypeio.anytype.core_models.StubTitle
@ -47,7 +46,7 @@ class EditorMergeTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, first.id, second.id)
)
@ -162,7 +161,7 @@ class EditorMergeTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(div1.id, div2.id)
)
@ -269,7 +268,7 @@ class EditorMergeTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(div1.id, div2.id)
)
@ -332,7 +331,7 @@ class EditorMergeTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(a.id, b.id)
)

View file

@ -3,19 +3,15 @@ package com.anytypeio.anytype.presentation.editor.editor
import android.os.Build
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.StubTitle
import com.anytypeio.anytype.core_models.ThemeColor
import com.anytypeio.anytype.core_models.StubHeader
import com.anytypeio.anytype.core_models.StubLayoutColumns
import com.anytypeio.anytype.core_models.StubLayoutRows
import com.anytypeio.anytype.core_models.StubParagraph
import com.anytypeio.anytype.core_models.StubTable
import com.anytypeio.anytype.core_models.StubTableCells
import com.anytypeio.anytype.core_models.StubTableColumn
import com.anytypeio.anytype.core_models.StubTableColumns
import com.anytypeio.anytype.core_models.StubTableRow
import com.anytypeio.anytype.core_models.StubTableRows
import com.anytypeio.anytype.core_models.StubTitle
import com.anytypeio.anytype.core_models.ThemeColor
import com.anytypeio.anytype.core_models.ext.content
import com.anytypeio.anytype.domain.block.interactor.UnlinkBlocks
import com.anytypeio.anytype.domain.clipboard.Copy
@ -36,6 +32,7 @@ import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.presentation.util.TXT
import com.anytypeio.anytype.test_utils.MockDataFactory
import com.jraska.livedata.test
import kotlin.test.assertEquals
import org.junit.Before
import org.junit.Rule
import org.junit.Test
@ -45,7 +42,6 @@ import org.mockito.kotlin.times
import org.mockito.kotlin.verifyBlocking
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
import kotlin.test.assertEquals
@Config(sdk = [Build.VERSION_CODES.P])
@RunWith(RobolectricTestRunner::class)
@ -156,7 +152,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, parent.id)
)
@ -435,7 +431,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, parent.id)
)
@ -672,7 +668,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, parent.id)
)
@ -759,7 +755,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id)
)
@ -835,7 +831,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() {
val smart = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id, b.id, c.id)
)
@ -910,7 +906,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() {
val smart = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id, b.id, c.id)
)
@ -1066,7 +1062,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id, b.id, c.id)
)
@ -1139,7 +1135,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id, b.id, c.id)
)
@ -1187,7 +1183,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id, b.id, c.id)
)
@ -1236,7 +1232,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id, b.id, c.id)
)
@ -1284,7 +1280,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id, b.id, c.id)
)
@ -1364,7 +1360,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block1.id, block2.id, block3.id)
)
@ -1415,7 +1411,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() {
id = root,
children = listOf(header.id) + listOf(table.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val document =
@ -1453,7 +1449,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() {
id = root,
children = listOf(header.id) + listOf(table.id),
fields = Block.Fields.empty(),
content = Block.Content.Smart()
content = Block.Content.Smart
)
val document =

View file

@ -7,7 +7,6 @@ import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.RelationLink
import com.anytypeio.anytype.core_models.Relations
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.StubObjectType
import com.anytypeio.anytype.core_models.StubRelationObject
import com.anytypeio.anytype.presentation.editor.EditorViewModel
@ -17,6 +16,8 @@ import com.anytypeio.anytype.presentation.relations.ObjectRelationView
import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.test_utils.MockDataFactory
import com.jraska.livedata.test
import kotlin.test.assertEquals
import kotlin.time.ExperimentalTime
import kotlinx.coroutines.runBlocking
import net.lachlanmckee.timberjunit.TimberTestRule
import org.junit.After
@ -24,8 +25,6 @@ import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.MockitoAnnotations
import kotlin.test.assertEquals
import kotlin.time.ExperimentalTime
class EditorNoteLayoutTest : EditorPresentationTestSetup() {
@ -76,7 +75,7 @@ class EditorNoteLayoutTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id)
)
@ -193,7 +192,7 @@ class EditorNoteLayoutTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id)
)

View file

@ -3,23 +3,21 @@ package com.anytypeio.anytype.presentation.editor.editor
import android.util.Log
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.InternalFlags
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.ObjectTypeIds
import com.anytypeio.anytype.core_models.Relations
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.presentation.editor.EditorViewModel
import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.test_utils.MockDataFactory
import kotlin.test.assertFalse
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
import net.lachlanmckee.timberjunit.TimberTestRule
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.MockitoAnnotations
import kotlin.test.assertFalse
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
class EditorObjectTypeChangeWidgetTest : EditorPresentationTestSetup() {
@ -80,7 +78,7 @@ class EditorObjectTypeChangeWidgetTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)
@ -151,7 +149,7 @@ class EditorObjectTypeChangeWidgetTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, paragraph.id)
)

View file

@ -13,11 +13,11 @@ import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.presentation.util.TXT
import com.anytypeio.anytype.test_utils.MockDataFactory
import com.jraska.livedata.test
import kotlin.test.assertEquals
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.MockitoAnnotations
import kotlin.test.assertEquals
class EditorQuickStartingScrollAndMoveTest : EditorPresentationTestSetup() {
@ -82,7 +82,7 @@ class EditorQuickStartingScrollAndMoveTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id, b.id)
)
@ -205,7 +205,7 @@ class EditorQuickStartingScrollAndMoveTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id, b.id)
)

View file

@ -4,7 +4,6 @@ import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.Relation
import com.anytypeio.anytype.core_models.Relations
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.StubRelationObject
import com.anytypeio.anytype.core_models.StubTitle
import com.anytypeio.anytype.core_models.ext.content
@ -17,12 +16,12 @@ import com.anytypeio.anytype.presentation.relations.ObjectRelationView
import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.presentation.util.TXT
import com.anytypeio.anytype.test_utils.MockDataFactory
import kotlin.test.assertEquals
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.MockitoAnnotations
import kotlin.test.assertEquals
class EditorRelationBlockTest : EditorPresentationTestSetup() {
@ -84,7 +83,7 @@ class EditorRelationBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id, b.id)
)
@ -175,7 +174,7 @@ class EditorRelationBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, block.id, relationBlock.id)
)
@ -316,7 +315,7 @@ class EditorRelationBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, block.id, relationBlock.id)
)
@ -437,7 +436,7 @@ class EditorRelationBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(header.id, block.id, relationBlock.id)
)

View file

@ -101,7 +101,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id, b.id, c.id)
)
@ -178,7 +178,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id, b.id, c.id)
)
@ -234,7 +234,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id)
)
@ -340,7 +340,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id, b.id, c.id)
)
@ -409,7 +409,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id, b.id)
)
@ -480,7 +480,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id, b.id)
)
@ -542,7 +542,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id, b.id)
)
@ -615,7 +615,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, parent.id)
)
@ -710,7 +710,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(parent.id, block.id)
)
@ -839,7 +839,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(a.id, b.id, c.id, d.id, e.id, f.id)
)

View file

@ -15,6 +15,9 @@ import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem
import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.test_utils.MockDataFactory
import com.jraska.livedata.test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotNull
import org.junit.After
import org.junit.Before
import org.junit.Rule
@ -23,9 +26,6 @@ import org.mockito.MockitoAnnotations
import org.mockito.kotlin.times
import org.mockito.kotlin.verifyBlocking
import org.mockito.kotlin.verifyNoMoreInteractions
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotNull
class EditorSlashWidgetActionsTest : EditorPresentationTestSetup() {
@ -594,7 +594,7 @@ class EditorSlashWidgetActionsTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)

View file

@ -17,13 +17,13 @@ import com.anytypeio.anytype.presentation.objects.ObjectTypeView
import com.anytypeio.anytype.presentation.relations.ObjectRelationView
import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.test_utils.MockDataFactory
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.MockitoAnnotations
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
class EditorSlashWidgetClicksTest: EditorPresentationTestSetup() {
@ -278,7 +278,7 @@ class EditorSlashWidgetClicksTest: EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
@ -442,7 +442,7 @@ class EditorSlashWidgetClicksTest: EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id, b.id)
)

View file

@ -15,6 +15,9 @@ import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashWidgetState
import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.test_utils.MockDataFactory
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotNull
import org.junit.After
import org.junit.Before
import org.junit.Rule
@ -25,9 +28,6 @@ import org.mockito.kotlin.times
import org.mockito.kotlin.verifyBlocking
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotNull
@Config(sdk = [Build.VERSION_CODES.P])
@RunWith(RobolectricTestRunner::class)
@ -73,7 +73,7 @@ class EditorSlashWidgetColorTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
@ -158,7 +158,7 @@ class EditorSlashWidgetColorTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
@ -243,7 +243,7 @@ class EditorSlashWidgetColorTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
@ -453,7 +453,7 @@ class EditorSlashWidgetColorTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
@ -540,7 +540,7 @@ class EditorSlashWidgetColorTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
@ -627,7 +627,7 @@ class EditorSlashWidgetColorTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)

View file

@ -138,7 +138,7 @@ class EditorSlashWidgetCutFilterTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)

View file

@ -13,6 +13,9 @@ import com.anytypeio.anytype.presentation.editor.editor.slash.SlashEvent
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem
import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.test_utils.MockDataFactory
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotNull
import net.lachlanmckee.timberjunit.TimberTestRule
import org.junit.After
import org.junit.Before
@ -21,9 +24,6 @@ import org.junit.Test
import org.mockito.MockitoAnnotations
import org.mockito.kotlin.times
import org.mockito.kotlin.verifyBlocking
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotNull
class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() {
@ -131,7 +131,7 @@ class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
@ -283,7 +283,7 @@ class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id, block2.id, block3.id)
)
@ -380,7 +380,7 @@ class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id, block2.id, block3.id)
)
@ -540,7 +540,7 @@ class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id, block2.id, block3.id)
)
@ -621,7 +621,7 @@ class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id, block2.id)
)
@ -773,7 +773,7 @@ class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id, block2.id, block3.id)
)
@ -854,7 +854,7 @@ class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id, block2.id)
)
@ -1012,7 +1012,7 @@ class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id, block2.id, block3.id)
)
@ -1093,7 +1093,7 @@ class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id, block2.id)
)

View file

@ -21,6 +21,7 @@ import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.presentation.util.TXT
import com.anytypeio.anytype.test_utils.MockDataFactory
import com.jraska.livedata.test
import kotlin.test.assertEquals
import kotlinx.coroutines.test.runTest
import net.lachlanmckee.timberjunit.TimberTestRule
import org.junit.After
@ -30,7 +31,6 @@ import org.junit.Test
import org.mockito.MockitoAnnotations
import org.mockito.kotlin.times
import org.mockito.kotlin.verifyBlocking
import kotlin.test.assertEquals
class EditorSlashWidgetRelationsTest: EditorPresentationTestSetup() {
@ -164,7 +164,7 @@ class EditorSlashWidgetRelationsTest: EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id)
)
@ -280,7 +280,7 @@ class EditorSlashWidgetRelationsTest: EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, a.id)
)

View file

@ -11,6 +11,9 @@ import com.anytypeio.anytype.presentation.editor.editor.slash.SlashEvent
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem
import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.test_utils.MockDataFactory
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotNull
import net.lachlanmckee.timberjunit.TimberTestRule
import org.junit.After
import org.junit.Before
@ -19,9 +22,6 @@ import org.junit.Test
import org.mockito.MockitoAnnotations
import org.mockito.kotlin.times
import org.mockito.kotlin.verifyBlocking
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotNull
class EditorSlashWidgetStyleTypeTest : EditorPresentationTestSetup() {
@ -79,7 +79,7 @@ class EditorSlashWidgetStyleTypeTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id, block2.id)
)
@ -213,7 +213,7 @@ class EditorSlashWidgetStyleTypeTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id, block2.id, block3.id)
)

View file

@ -14,6 +14,7 @@ import com.anytypeio.anytype.domain.block.interactor.UpdateText
import com.anytypeio.anytype.presentation.editor.EditorViewModel
import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.test_utils.MockDataFactory
import kotlin.test.assertEquals
import net.lachlanmckee.timberjunit.TimberTestRule
import org.junit.After
import org.junit.Before
@ -24,7 +25,6 @@ import org.mockito.kotlin.eq
import org.mockito.kotlin.times
import org.mockito.kotlin.verifyBlocking
import org.mockito.kotlin.verifyNoInteractions
import kotlin.test.assertEquals
class EditorSplitTest : EditorPresentationTestSetup() {
@ -176,7 +176,7 @@ class EditorSplitTest : EditorPresentationTestSetup() {
fun createPage(root: Id, children: List<String>) = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = children
)

View file

@ -31,7 +31,7 @@ class EditorStartupTest : EditorPresentationTestSetup() {
Block(
id = "some id",
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = emptyList()
)
)

View file

@ -3,7 +3,6 @@ package com.anytypeio.anytype.presentation.editor.editor
import android.util.Log
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.SmartBlockType
import com.anytypeio.anytype.core_models.ext.content
import com.anytypeio.anytype.presentation.BuildConfig
import com.anytypeio.anytype.presentation.MockTypicalDocumentFactory
@ -14,13 +13,13 @@ import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.presentation.util.TXT
import com.anytypeio.anytype.test_utils.MockDataFactory
import com.jraska.livedata.test
import kotlin.test.assertEquals
import net.lachlanmckee.timberjunit.TimberTestRule
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.MockitoAnnotations
import kotlin.test.assertEquals
class EditorTableOfContentsBlockTest : EditorPresentationTestSetup() {
@ -184,7 +183,7 @@ class EditorTableOfContentsBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(
header.id,
blockToC.id,
@ -520,7 +519,7 @@ class EditorTableOfContentsBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(
header.id,
blockToC.id,
@ -879,7 +878,7 @@ class EditorTableOfContentsBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(
header.id,
blockToC.id,
@ -1127,7 +1126,7 @@ class EditorTableOfContentsBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(SmartBlockType.PAGE),
content = Block.Content.Smart,
children = listOf(
header.id,
div1.id,

View file

@ -4,7 +4,6 @@ import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.ext.content
import com.anytypeio.anytype.domain.block.interactor.UpdateText
import com.anytypeio.anytype.domain.page.CloseBlock
import com.anytypeio.anytype.presentation.editor.EditorViewModel
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
@ -72,7 +71,7 @@ class EditorTextUpdateTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
@ -144,7 +143,7 @@ class EditorTextUpdateTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
@ -217,7 +216,7 @@ class EditorTextUpdateTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
@ -291,7 +290,7 @@ class EditorTextUpdateTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)

View file

@ -59,7 +59,7 @@ class EditorTitleAddBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id)
)
@ -114,7 +114,7 @@ class EditorTitleAddBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
@ -158,7 +158,7 @@ class EditorTitleAddBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id)
)
@ -217,7 +217,7 @@ class EditorTitleAddBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
@ -265,7 +265,7 @@ class EditorTitleAddBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id)
)
@ -317,7 +317,7 @@ class EditorTitleAddBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
@ -358,7 +358,7 @@ class EditorTitleAddBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id)
)
@ -410,7 +410,7 @@ class EditorTitleAddBlockTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)

View file

@ -16,6 +16,7 @@ import com.anytypeio.anytype.presentation.editor.render.parseThemeBackgroundColo
import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
import com.anytypeio.anytype.test_utils.MockDataFactory
import com.jraska.livedata.test
import kotlin.test.assertEquals
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.launch
@ -30,7 +31,6 @@ import org.mockito.kotlin.eq
import org.mockito.kotlin.times
import org.mockito.kotlin.verifyBlocking
import org.mockito.kotlin.verifyNoMoreInteractions
import kotlin.test.assertEquals
class EditorTitleTest : EditorPresentationTestSetup() {
@ -86,7 +86,7 @@ class EditorTitleTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id)
)
@ -136,7 +136,7 @@ class EditorTitleTest : EditorPresentationTestSetup() {
Block(
id = root,
fields = Block.Fields.empty(),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id)
),
header,
@ -180,7 +180,7 @@ class EditorTitleTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id)
)
@ -292,7 +292,7 @@ class EditorTitleTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)
@ -417,7 +417,7 @@ class EditorTitleTest : EditorPresentationTestSetup() {
val page = Block(
id = root,
fields = Block.Fields(emptyMap()),
content = Block.Content.Smart(),
content = Block.Content.Smart,
children = listOf(header.id, block.id)
)

Some files were not shown because too many files have changed in this diff Show more