|
|
@@ -55,6 +55,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase |
|
|
|
assertThat(settings.getRate(), is(synth.Rate.getDefaultValue())); |
|
|
|
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue())); |
|
|
|
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue())); |
|
|
|
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue())); |
|
|
|
} |
|
|
|
|
|
|
|
// Old Settings |
|
|
@@ -73,6 +74,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase |
|
|
|
assertThat(settings.getRate(), is(synth.Rate.getDefaultValue())); |
|
|
|
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue())); |
|
|
|
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue())); |
|
|
|
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue())); |
|
|
|
} |
|
|
|
|
|
|
|
public void testDefaultGenderFemale() |
|
|
@@ -89,6 +91,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase |
|
|
|
assertThat(settings.getRate(), is(synth.Rate.getDefaultValue())); |
|
|
|
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue())); |
|
|
|
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue())); |
|
|
|
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue())); |
|
|
|
} |
|
|
|
|
|
|
|
public void defaultRateTest(int prefValue, int settingValue, SpeechSynthesis synth) |
|
|
@@ -104,6 +107,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase |
|
|
|
assertThat(settings.getRate(), is(settingValue)); |
|
|
|
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue())); |
|
|
|
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue())); |
|
|
|
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue())); |
|
|
|
} |
|
|
|
|
|
|
|
public void testDefaultRate() |
|
|
@@ -129,6 +133,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase |
|
|
|
assertThat(settings.getRate(), is(synth.Rate.getDefaultValue())); |
|
|
|
assertThat(settings.getPitch(), is(settingValue)); |
|
|
|
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue())); |
|
|
|
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue())); |
|
|
|
} |
|
|
|
|
|
|
|
public void testDefaultPitch() |
|
|
@@ -158,6 +163,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase |
|
|
|
assertThat(settings.getRate(), is(synth.Rate.getDefaultValue())); |
|
|
|
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue())); |
|
|
|
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue())); |
|
|
|
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue())); |
|
|
|
} |
|
|
|
|
|
|
|
public void espeakRateTest(int prefValue, int settingValue, SpeechSynthesis synth) |
|
|
@@ -173,6 +179,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase |
|
|
|
assertThat(settings.getRate(), is(settingValue)); |
|
|
|
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue())); |
|
|
|
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue())); |
|
|
|
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue())); |
|
|
|
} |
|
|
|
|
|
|
|
public void testEspeakRate() |
|
|
@@ -199,6 +206,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase |
|
|
|
assertThat(settings.getRate(), is(synth.Rate.getDefaultValue())); |
|
|
|
assertThat(settings.getPitch(), is(settingValue)); |
|
|
|
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue())); |
|
|
|
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue())); |
|
|
|
} |
|
|
|
|
|
|
|
public void testEspeakPitch() |
|
|
@@ -224,6 +232,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase |
|
|
|
assertThat(settings.getRate(), is(synth.Rate.getDefaultValue())); |
|
|
|
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue())); |
|
|
|
assertThat(settings.getPitchRange(), is(settingValue)); |
|
|
|
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue())); |
|
|
|
} |
|
|
|
|
|
|
|
public void testEspeakPitchRange() |
|
|
@@ -236,6 +245,32 @@ public class VoiceSettingsTest extends TextToSpeechTestCase |
|
|
|
espeakPitchRangeTest( -5, 0, synth); // clamped to minimum value |
|
|
|
} |
|
|
|
|
|
|
|
public void espeakVolumeTest(int prefValue, int settingValue, SpeechSynthesis synth) |
|
|
|
{ |
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); |
|
|
|
SharedPreferences.Editor editor = prefs.edit(); |
|
|
|
editor.clear(); |
|
|
|
editor.putString("espeak_volume", Integer.toString(prefValue)); |
|
|
|
editor.commit(); |
|
|
|
|
|
|
|
VoiceSettings settings = new VoiceSettings(prefs, synth); |
|
|
|
assertThat(settings.getVoiceVariant().toString(), is("male")); |
|
|
|
assertThat(settings.getRate(), is(synth.Rate.getDefaultValue())); |
|
|
|
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue())); |
|
|
|
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue())); |
|
|
|
assertThat(settings.getVolume(), is(settingValue)); |
|
|
|
} |
|
|
|
|
|
|
|
public void testEspeakVolume() |
|
|
|
{ |
|
|
|
SpeechSynthesis synth = new SpeechSynthesis(getContext(), mCallback); |
|
|
|
espeakVolumeTest(210, 200, synth); // clamped to maximum value |
|
|
|
espeakVolumeTest(150, 150, synth); |
|
|
|
espeakVolumeTest(100, 100, synth); // default value |
|
|
|
espeakVolumeTest( 50, 50, synth); |
|
|
|
espeakVolumeTest( -5, 0, synth); // clamped to minimum value |
|
|
|
} |
|
|
|
|
|
|
|
// Mixed (Old and New) Settings |
|
|
|
|
|
|
|
public void testEspeakVariantWithDefaultGenderFemale() |
|
|
@@ -253,6 +288,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase |
|
|
|
assertThat(settings.getRate(), is(synth.Rate.getDefaultValue())); |
|
|
|
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue())); |
|
|
|
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue())); |
|
|
|
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue())); |
|
|
|
} |
|
|
|
|
|
|
|
public void testEspeakRateWithDefaultRate() |
|
|
@@ -270,5 +306,6 @@ public class VoiceSettingsTest extends TextToSpeechTestCase |
|
|
|
assertThat(settings.getRate(), is(200)); |
|
|
|
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue())); |
|
|
|
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue())); |
|
|
|
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue())); |
|
|
|
} |
|
|
|
} |