From e94e4bc3d03d2e6d5122700fd3161bfa63dc4371 Mon Sep 17 00:00:00 2001 From: Nathan Mascitelli Date: Wed, 13 Feb 2019 21:06:19 -0500 Subject: Use a single format for short timecodes It is unlikely that multiple formats for short timecodes would be used in one document. Therefor we will parse all the short timecodes to see if they are all less then the duration as HH:MM. If they are we will use that, otherwise we will parse them as MM:SS. --- .../java/de/test/antennapod/util/playback/TimelineTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/src/androidTest/java') diff --git a/app/src/androidTest/java/de/test/antennapod/util/playback/TimelineTest.java b/app/src/androidTest/java/de/test/antennapod/util/playback/TimelineTest.java index 157773595..e6b11a4b0 100644 --- a/app/src/androidTest/java/de/test/antennapod/util/playback/TimelineTest.java +++ b/app/src/androidTest/java/de/test/antennapod/util/playback/TimelineTest.java @@ -110,12 +110,14 @@ public class TimelineTest extends InstrumentationTestCase { } public void testProcessShownotesAddTimecodeMultipleShortFormatNoChapters() throws Exception { + + // One of these timecodes fits as HH:MM and one does not so both should be parsed as MM:SS. final String[] timeStrings = new String[]{ "10:12", "2:12" }; Playable p = newTestPlayable(null, "

Some test text with a timecode " + timeStrings[0] + " here. Hey look another one " + timeStrings[1] + " here!

", 3 * 60 * 60 * 1000); Timeline t = new Timeline(context, p); String res = t.processShownotes(true); - checkLinkCorrect(res, new long[]{ 10 * 60 * 1000 + 12 * 1000, 2 * 60 * 60 * 1000 + 12 * 60 * 1000 }, timeStrings); + checkLinkCorrect(res, new long[]{ 10 * 60 * 1000 + 12 * 1000, 2 * 60 * 1000 + 12 * 1000 }, timeStrings); } public void testProcessShownotesAddTimecodeParentheses() throws Exception { -- cgit v1.2.3