forked from upstream-mirrors/OpenTracks
Bugfix: crash on voice announcement if using imperial with meters
Fixes #1626
This commit is contained in:
committed by
Dennis Guse
parent
a4ec68def6
commit
6dd9630bae
+14
@@ -207,6 +207,20 @@ public class VoiceAnnouncementUtilsTest {
|
|||||||
assertEquals("Total distance 1.1 miles. 1 hour. Average moving speed 1.1 miles per hour.", announcement);
|
assertEquals("Total distance 1.1 miles. 1 hour. Average moving speed 1.1 miles per hour.", announcement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getAnnouncement_imperial_meter_speed_1() {
|
||||||
|
TrackStatistics stats = new TrackStatistics();
|
||||||
|
stats.setTotalDistance(Distance.ofMile(1.1));
|
||||||
|
stats.setTotalTime(Duration.ofHours(2).plusMinutes(5).plusSeconds(10));
|
||||||
|
stats.setMovingTime(Duration.ofHours(1));
|
||||||
|
|
||||||
|
// when
|
||||||
|
String announcement = VoiceAnnouncementUtils.getAnnouncement(context, stats, UnitSystem.IMPERIAL_METER, true, null, null).toString();
|
||||||
|
|
||||||
|
// then
|
||||||
|
assertEquals("Total distance 1.1 miles. 1 hour. Average moving speed 1.1 miles per hour.", announcement);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAnnouncement_metric_speed_1() {
|
public void getAnnouncement_metric_speed_1() {
|
||||||
TrackStatistics stats = new TrackStatistics();
|
TrackStatistics stats = new TrackStatistics();
|
||||||
|
|||||||
+1
-1
@@ -52,7 +52,7 @@ class VoiceAnnouncementUtils {
|
|||||||
unitDistanceTTS = "kilometer";
|
unitDistanceTTS = "kilometer";
|
||||||
unitSpeedTTS = "kilometer per hour";
|
unitSpeedTTS = "kilometer per hour";
|
||||||
}
|
}
|
||||||
case IMPERIAL_FEET -> {
|
case IMPERIAL_FEET, IMPERIAL_METER -> {
|
||||||
perUnitStringId = R.string.voice_per_mile;
|
perUnitStringId = R.string.voice_per_mile;
|
||||||
distanceId = R.string.voiceDistanceMilesPlural;
|
distanceId = R.string.voiceDistanceMilesPlural;
|
||||||
speedId = R.string.voiceSpeedMilesPerHourPlural;
|
speedId = R.string.voiceSpeedMilesPerHourPlural;
|
||||||
|
|||||||
Reference in New Issue
Block a user