diff --git a/source/speech/speech.py b/source/speech/speech.py index e01cc4676dc..a45f0cbcb82 100644 --- a/source/speech/speech.py +++ b/source/speech/speech.py @@ -467,7 +467,9 @@ def _getSpellingSpeechWithoutCharMode( speakCharAs = symbol elif not isNormalized and unicodeNormalization: if (normalized := unicodeNormalize(speakCharAs)) != speakCharAs: - speakCharAs = " ".join(normalized) + speakCharAs = " ".join( + characterProcessing.processSpeechSymbol(locale, normChar) for normChar in normalized + ) isNormalized = True if config.conf['speech']['autoLanguageSwitching']: yield LangChangeCommand(locale) diff --git a/tests/unit/test_speech.py b/tests/unit/test_speech.py index e2ec53d14eb..9d8d209ac25 100644 --- a/tests/unit/test_speech.py +++ b/tests/unit/test_speech.py @@ -10,6 +10,7 @@ import unittest import config +from characterProcessing import processSpeechSymbol from speech import ( _getSpellingCharAddCapNotification, _getSpellingSpeechAddCharMode, @@ -475,6 +476,58 @@ def test_decomposed_normalizeOnReport(self): ) self.assertEqual(repr(list(output)), expected) + def test_normalizedInSymbolDict_normalizeOff(self): + expected = repr([ + '·', + EndUtteranceCommand(), + ]) + output = _getSpellingSpeechWithoutCharMode( + text='·', + locale="en", + useCharacterDescriptions=False, + sayCapForCapitals=False, + capPitchChange=0, + beepForCapitals=False, + unicodeNormalization=False, + reportNormalizedForCharacterNavigation=False, + ) + self.assertEqual(repr(list(output)), expected) + + def test_normalizedInSymbolDict_normalizeOnDontReport(self): + expected = repr([ + processSpeechSymbol("en", "·"), + EndUtteranceCommand(), + ]) + output = _getSpellingSpeechWithoutCharMode( + text='·', + locale="en", + useCharacterDescriptions=False, + sayCapForCapitals=False, + capPitchChange=0, + beepForCapitals=False, + unicodeNormalization=True, + reportNormalizedForCharacterNavigation=False, + ) + self.assertEqual(repr(list(output)), expected) + + def test_normalizedInSymbolDict_normalizeOnReport(self): + expected = repr([ + processSpeechSymbol("en", "·"), + ' normalized', + EndUtteranceCommand(), + ]) + output = _getSpellingSpeechWithoutCharMode( + text='·', + locale="en", + useCharacterDescriptions=False, + sayCapForCapitals=False, + capPitchChange=0, + beepForCapitals=False, + unicodeNormalization=True, + reportNormalizedForCharacterNavigation=True, + ) + self.assertEqual(repr(list(output)), expected) + class SpeechExtensionPoints(unittest.TestCase):