Sound should now stop when speech stops. This means no more interrupting speech just to have the link sounds on a page continue to play.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import sys
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
|
||||
|
||||
from cthulhu import speech
|
||||
|
||||
|
||||
class PresentationInterruptSoundRegressionTests(unittest.TestCase):
|
||||
def test_speech_stop_also_stops_sound_playback(self):
|
||||
speechServer = mock.Mock()
|
||||
echoServer = mock.Mock()
|
||||
soundPlayer = mock.Mock()
|
||||
|
||||
with (
|
||||
mock.patch.object(speech, "_speechserver", speechServer),
|
||||
mock.patch.object(speech, "_echoSpeechserver", echoServer),
|
||||
mock.patch.object(speech.sound, "getPlayer", return_value=soundPlayer),
|
||||
):
|
||||
speech.stop()
|
||||
|
||||
speechServer.stop.assert_called_once_with()
|
||||
echoServer.stop.assert_called_once_with()
|
||||
soundPlayer.stop.assert_called_once_with()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user