mnemonics are now spoken without surrounding punctuation e.g. les or greater.
This commit is contained in:
1 parent
1f8420ab4b
commit
90f1411405
2 files changed
+21
-1
No files matched your search
@@ -166,7 +166,7 @@ func FocusSpeechWithOptions(snapshot atspi.Snapshot, options Options) Speech {
|
||||
fields = append(fields, fmt.Sprintf("%d of %d", snapshot.PositionInSet, snapshot.SetSize))
|
||||
}
|
||||
if reading.EnableMnemonicSpeaking && snapshot.Mnemonic != "" {
|
||||
fields = append(fields, snapshot.Mnemonic)
|
||||
fields = append(fields, spokenMnemonic(snapshot.Mnemonic))
|
||||
}
|
||||
if reading.EnableTutorialMessages {
|
||||
fields = append(fields, control_tutorial(snapshot))
|
||||
@@ -185,6 +185,12 @@ func FocusSpeechWithOptions(snapshot atspi.Snapshot, options Options) Speech {
|
||||
return SpeechWithOptions(parts, options)
|
||||
}
|
||||
|
||||
func spokenMnemonic(value string) string {
|
||||
value = strings.ReplaceAll(value, "<", "")
|
||||
value = strings.ReplaceAll(value, ">", " ")
|
||||
return strings.Join(strings.Fields(value), " ")
|
||||
}
|
||||
|
||||
func removeReplacedState(states []string) []string {
|
||||
for index, state := range states {
|
||||
switch state {
|
||||
|
||||
@@ -48,6 +48,20 @@ func TestReadingPreferencesChangeControlOutput(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMnemonicSpeechFiltersAngleBracketsWithoutChangingNames(t *testing.T) {
|
||||
settings := config.DefaultSettings()
|
||||
settings.Reading.EnableMnemonicSpeaking = true
|
||||
options := DefaultOptions()
|
||||
options.Reading = &settings.Reading
|
||||
snapshot := atspi.Snapshot{Name: "<Alt>o", Role: "button", Mnemonic: "<Alt>o"}
|
||||
want := "<Alt>o, button, Alt o"
|
||||
for settings.VerbalizePunctuationStyle = 0; settings.VerbalizePunctuationStyle <= 3; settings.VerbalizePunctuationStyle++ {
|
||||
if got := FocusTextWithOptions(snapshot, options); got != want {
|
||||
t.Fatalf("punctuation style %d = %q, want %q", settings.VerbalizePunctuationStyle, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDocumentAndSpreadsheetFullRowsUseIndependentFlags(t *testing.T) {
|
||||
reading := config.DefaultSettings().Reading
|
||||
options := DefaultOptions()
|
||||
|
||||
Reference in new issue
Block a user