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:
Storm Dragon
2026-05-08 01:02:57 -04:00
parent e54600ff4d
commit 6f33caade1
4 changed files with 57 additions and 1 deletions
@@ -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()