FakeSpeechSynthesizer

class FakeSpeechSynthesizer(var script: List<SpeechSynthesisEvent> = listOf(SpeechSynthesisEvent.Started, SpeechSynthesisEvent.Finished), var voicesToReturn: List<SpeechVoice> = emptyList(), var error: SpeechSynthesisException? = null) : SpeechSynthesizing

Scripted SpeechSynthesizing for consumer tests.

Each collected speak records its request, emits script in order, then throws error if set, otherwise completes.

Constructors

Link copied to clipboard
constructor(script: List<SpeechSynthesisEvent> = listOf(SpeechSynthesisEvent.Started, SpeechSynthesisEvent.Finished), voicesToReturn: List<SpeechVoice> = emptyList(), error: SpeechSynthesisException? = null)

Properties

Link copied to clipboard

An exception thrown after the script, or null to complete normally.

Link copied to clipboard

The events every request emits.

Link copied to clipboard

Every request spoken, in order.

Link copied to clipboard

How many times stop was called.

Link copied to clipboard

The voices voices returns.

Functions

Link copied to clipboard
open override fun speak(request: SpeechSynthesisRequest): Flow<SpeechSynthesisEvent>
Link copied to clipboard
open override fun stop()
Link copied to clipboard
open suspend override fun voices(): List<SpeechVoice>