|
|
@ -85,6 +85,8 @@ class FakeMatrixRoom( |
|
|
|
private var reportContentResult = Result.success(Unit) |
|
|
|
private var reportContentResult = Result.success(Unit) |
|
|
|
private var sendLocationResult = Result.success(Unit) |
|
|
|
private var sendLocationResult = Result.success(Unit) |
|
|
|
private var createPollResult = Result.success(Unit) |
|
|
|
private var createPollResult = Result.success(Unit) |
|
|
|
|
|
|
|
private var sendPollResponseResult = Result.success(Unit) |
|
|
|
|
|
|
|
private var endPollResult = Result.success(Unit) |
|
|
|
private var progressCallbackValues = emptyList<Pair<Long, Long>>() |
|
|
|
private var progressCallbackValues = emptyList<Pair<Long, Long>>() |
|
|
|
val editMessageCalls = mutableListOf<String>() |
|
|
|
val editMessageCalls = mutableListOf<String>() |
|
|
|
|
|
|
|
|
|
|
@ -109,6 +111,12 @@ class FakeMatrixRoom( |
|
|
|
private val _createPollInvocations = mutableListOf<CreatePollInvocation>() |
|
|
|
private val _createPollInvocations = mutableListOf<CreatePollInvocation>() |
|
|
|
val createPollInvocations: List<CreatePollInvocation> = _createPollInvocations |
|
|
|
val createPollInvocations: List<CreatePollInvocation> = _createPollInvocations |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private val _sendPollResponseInvocations = mutableListOf<SendPollResponseInvocation>() |
|
|
|
|
|
|
|
val sendPollResponseInvocations: List<SendPollResponseInvocation> = _sendPollResponseInvocations |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private val _endPollInvocations = mutableListOf<EndPollInvocation>() |
|
|
|
|
|
|
|
val endPollInvocations: List<EndPollInvocation> = _endPollInvocations |
|
|
|
|
|
|
|
|
|
|
|
var invitedUserId: UserId? = null |
|
|
|
var invitedUserId: UserId? = null |
|
|
|
private set |
|
|
|
private set |
|
|
|
|
|
|
|
|
|
|
@ -320,6 +328,22 @@ class FakeMatrixRoom( |
|
|
|
return createPollResult |
|
|
|
return createPollResult |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override suspend fun sendPollResponse( |
|
|
|
|
|
|
|
pollStartId: EventId, |
|
|
|
|
|
|
|
answers: List<String> |
|
|
|
|
|
|
|
): Result<Unit> = simulateLongTask { |
|
|
|
|
|
|
|
_sendPollResponseInvocations.add(SendPollResponseInvocation(pollStartId, answers)) |
|
|
|
|
|
|
|
return sendPollResponseResult |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override suspend fun endPoll( |
|
|
|
|
|
|
|
pollStartId: EventId, |
|
|
|
|
|
|
|
text: String |
|
|
|
|
|
|
|
): Result<Unit> = simulateLongTask { |
|
|
|
|
|
|
|
_endPollInvocations.add(EndPollInvocation(pollStartId, text)) |
|
|
|
|
|
|
|
return endPollResult |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun givenLeaveRoomError(throwable: Throwable?) { |
|
|
|
fun givenLeaveRoomError(throwable: Throwable?) { |
|
|
|
this.leaveRoomError = throwable |
|
|
|
this.leaveRoomError = throwable |
|
|
|
} |
|
|
|
} |
|
|
@ -416,6 +440,14 @@ class FakeMatrixRoom( |
|
|
|
createPollResult = result |
|
|
|
createPollResult = result |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun givenSendPollResponseResult(result: Result<Unit>) { |
|
|
|
|
|
|
|
sendPollResponseResult = result |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun givenEndPollResult(result: Result<Unit>) { |
|
|
|
|
|
|
|
endPollResult = result |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun givenProgressCallbackValues(values: List<Pair<Long, Long>>) { |
|
|
|
fun givenProgressCallbackValues(values: List<Pair<Long, Long>>) { |
|
|
|
progressCallbackValues = values |
|
|
|
progressCallbackValues = values |
|
|
|
} |
|
|
|
} |
|
|
@ -435,3 +467,13 @@ data class CreatePollInvocation( |
|
|
|
val maxSelections: Int, |
|
|
|
val maxSelections: Int, |
|
|
|
val pollKind: PollKind, |
|
|
|
val pollKind: PollKind, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data class SendPollResponseInvocation( |
|
|
|
|
|
|
|
val pollStartId: EventId, |
|
|
|
|
|
|
|
val answers: List<String>, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data class EndPollInvocation( |
|
|
|
|
|
|
|
val pollStartId: EventId, |
|
|
|
|
|
|
|
val text: String, |
|
|
|
|
|
|
|
) |
|
|
|