summaryrefslogtreecommitdiff
path: root/app/src/androidTest
diff options
context:
space:
mode:
authorNathan Mascitelli <mascitelli.nathan@gmail.com>2019-02-10 17:59:40 -0500
committerNathan Mascitelli <mascitelli.nathan@gmail.com>2019-02-10 18:00:28 -0500
commit9180be85ba216e501b6ccfac9f9eba20d40d0021 (patch)
treed21a45b33d9f3d1c72b508645c7fb4903fa77592 /app/src/androidTest
parent91987460dbb906a04492fa924b8f7216f3144f50 (diff)
downloadAntennaPod-9180be85ba216e501b6ccfac9f9eba20d40d0021.zip
Update tests to handle minute timestamps
The definition of 'short timestamp' now means minutes and seconds, while 'long timestamp' means hours, minutes, and seconds. The first part of a timestamp may have one or two digits. Tests updated for this new definition.
Diffstat (limited to 'app/src/androidTest')
-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>");