Test TimelineController
This commit is contained in:
parent
5f1c1dcd23
commit
16f0d9d446
3 changed files with 234 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue