internal static ISpeech GetMockSpeech(string speechText, ISpeechSettings speechSettings) { ISpeech speech = Substitute.For <ISpeech>(); speech.AdditiveSpeech.Returns(true); speech.SpeechText.Returns(speechText); speech.SpeakerName.Returns("Main Character"); speech.SpeechSettings.Returns(speechSettings); return(speech); }
internal static ISpeechSettings GetMockSpeechSettings( float displaySpeed = 5f, IFontSettings fontSettings = null, int fontSize = 45, bool fontOnSpeakerName = false ) { IFontSettings mockFontSettings = Substitute.For <IFontSettings>(); mockFontSettings.FontAsset.Returns(Resources.Load <TMPro.TMP_FontAsset>(Path.Combine("Fonts", "OpenSans SDF"))); ISpeechSettings speechSettings = Substitute.For <ISpeechSettings>(); speechSettings.DisplaySpeed.Returns(displaySpeed); speechSettings.FontSettings.Returns(fontSettings ?? mockFontSettings); speechSettings.FontColor.Returns(Color.white); speechSettings.FontSize.Returns(fontSize); speechSettings.FontOnSpeakerName.Returns(fontOnSpeakerName); return(speechSettings); }
public void ApplySpeechSettings_ShouldChangePropertiesOfSpeechTextDisplay_WhenSpeechSettingsHasValues() { // ARRANGE ISpeechSettings speechSettings = DialogueTestHelpers.GetMockSpeechSettings(); IDialogueSystemElements dialogueSystemElements = new DialogueSystemElements() { DialoguePanel = new GameObject(), DefaultSpeechSettings = DialogueTestHelpers.GetMockSpeechSettings(), SpeechTextDisplay = DialogueTestHelpers.CreateMonoBehaviourObject <TextMeshProUGUI>(), SpeakerNameDisplay = DialogueTestHelpers.CreateMonoBehaviourObject <TextMeshProUGUI>(), }; TextMeshProUGUI speechTextDisplay = (TextMeshProUGUI)dialogueSystemElements.SpeechTextDisplay; // ACT dialogueSystemElements.ApplySpeechSettings(speechSettings); // ASSERT Assert.AreEqual(speechSettings.FontSettings.FontAsset.sourceFontFile, speechTextDisplay.font.sourceFontFile); Assert.AreEqual(speechSettings.FontSize, speechTextDisplay.fontSize); Assert.AreEqual(speechSettings.FontColor, DialogueTestHelpers.GetColor(speechTextDisplay.color)); }
public WaveFormatAdapter(ISpeechSettings speechSettings) { _speechSettings = speechSettings; }
public SystemSource(ISpeechSettings speechSettings, WaveFormatAdapter waveFormatAdapter) { _speechSettings = speechSettings; _waveFormatAdapter = waveFormatAdapter; }
public BingSpeechService(ISpeechSettings speechSettings) { _speechSettings = speechSettings; }