summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/androidTest/java/de/test/antennapod/util/ConverterTest.java4
-rw-r--r--app/src/androidTest/java/de/test/antennapod/util/playback/TimelineTest.java30
2 files changed, 27 insertions, 7 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/util/ConverterTest.java b/app/src/androidTest/java/de/test/antennapod/util/ConverterTest.java
index 47fca41ba..c7ed7d812 100644
--- a/app/src/androidTest/java/de/test/antennapod/util/ConverterTest.java
+++ b/app/src/androidTest/java/de/test/antennapod/util/ConverterTest.java
@@ -17,7 +17,7 @@ public class ConverterTest extends AndroidTestCase {
public void testGetDurationStringShort() throws Exception {
String expected = "13:05";
- int input = 47110000;
+ int input = 785000;
assertEquals(expected, Converter.getDurationStringShort(input));
}
@@ -29,7 +29,7 @@ public class ConverterTest extends AndroidTestCase {
public void testDurationStringShortToMs() throws Exception {
String input = "8:30";
- long expected = 30600000;
+ long expected = 510000;
assertEquals(expected, Converter.durationStringShortToMs(input));
}
}
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 7e535e12c..40e6605d7 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
@@ -50,9 +50,29 @@ public class TimelineTest extends InstrumentationTestCase {
checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
}
- public void testProcessShownotesAddTimecodeHHMMNoChapters() throws Exception {
+ public void testProcessShownotesAddTimecodeHMMSSNoChapters() throws Exception {
+ final String timeStr = "2:11:12";
+ final long time = 2 * 60 * 60 * 1000 + 11 * 60 * 1000 + 12 * 1000;
+
+ Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStr + " here.</p>");
+ Timeline t = new Timeline(context, p);
+ String res = t.processShownotes(true);
+ checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
+ }
+
+ public void testProcessShownotesAddTimecodeMSSNoChapters() throws Exception {
+ final String timeStr = "1:12";
+ final long time = 60 * 1000 + 12 * 1000;
+
+ Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStr + " here.</p>");
+ Timeline t = new Timeline(context, p);
+ String res = t.processShownotes(true);
+ checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
+ }
+
+ public void testProcessShownotesAddTimecodeMMSSNoChapters() throws Exception {
final String timeStr = "10:11";
- final long time = 3600 * 1000 * 10 + 60 * 1000 * 11;
+ final long time = 60 * 1000 * 10 + 1000 * 11;
Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStr + " here.</p>");
Timeline t = new Timeline(context, p);
@@ -61,7 +81,7 @@ public class TimelineTest extends InstrumentationTestCase {
}
public void testProcessShownotesAddTimecodeParentheses() throws Exception {
- final String timeStr = "10:11";
+ final String timeStr = "10:11:00";
final long time = 3600 * 1000 * 10 + 60 * 1000 * 11;
Playable p = newTestPlayable(null, "<p> Some test text with a timecode (" + timeStr + ") here.</p>");
@@ -71,7 +91,7 @@ public class TimelineTest extends InstrumentationTestCase {
}
public void testProcessShownotesAddTimecodeBrackets() throws Exception {
- final String timeStr = "10:11";
+ final String timeStr = "10:11:00";
final long time = 3600 * 1000 * 10 + 60 * 1000 * 11;
Playable p = newTestPlayable(null, "<p> Some test text with a timecode [" + timeStr + "] here.</p>");
@@ -81,7 +101,7 @@ public class TimelineTest extends InstrumentationTestCase {
}
public void testProcessShownotesAddTimecodeAngleBrackets() throws Exception {
- final String timeStr = "10:11";
+ final String timeStr = "10:11:00";
final long time = 3600 * 1000 * 10 + 60 * 1000 * 11;
Playable p = newTestPlayable(null, "<p> Some test text with a timecode <" + timeStr + "> here.</p>");