mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Test TimelineController
This commit is contained in:
+8
-2
@@ -215,8 +215,14 @@ class FakeMatrixRoom(
|
||||
|
||||
override val syncUpdateFlow: StateFlow<Long> = MutableStateFlow(0L)
|
||||
|
||||
override suspend fun timelineFocusedOnEvent(eventId: EventId): Result<Timeline> {
|
||||
return Result.success(FakeTimeline())
|
||||
private var timelineFocusedOnEventResult: Result<Timeline> = Result.success(FakeTimeline())
|
||||
|
||||
fun givenTimelineFocusedOnEventResult(result: Result<Timeline>) {
|
||||
timelineFocusedOnEventResult = result
|
||||
}
|
||||
|
||||
override suspend fun timelineFocusedOnEvent(eventId: EventId): Result<Timeline> = simulateLongTask {
|
||||
timelineFocusedOnEventResult
|
||||
}
|
||||
|
||||
override suspend fun subscribeToSync() = Unit
|
||||
|
||||
+9
-1
@@ -39,6 +39,7 @@ import kotlinx.coroutines.flow.StateFlow
|
||||
import java.io.File
|
||||
|
||||
class FakeTimeline(
|
||||
private val name: String = "FakeTimeline",
|
||||
override val timelineItems: Flow<List<MatrixTimelineItem>> = MutableStateFlow(emptyList()),
|
||||
private val backwardPaginationStatus: MutableStateFlow<Timeline.PaginationStatus> = MutableStateFlow(
|
||||
Timeline.PaginationStatus(
|
||||
@@ -360,5 +361,12 @@ class FakeTimeline(
|
||||
}
|
||||
}
|
||||
|
||||
override fun close() = Unit
|
||||
var closeCounter = 0
|
||||
private set
|
||||
|
||||
override fun close() {
|
||||
closeCounter++
|
||||
}
|
||||
|
||||
override fun toString() = "FakeTimeline: $name"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user