diff options
author | ByteHamster <info@bytehamster.com> | 2021-02-19 14:16:49 +0100 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2021-02-19 14:21:44 +0100 |
commit | 8fdd034e9ef259fe706303ac92ee9e96c647d301 (patch) | |
tree | 8fe76514cf4015b4f3bcc52c81cf11c81a925e82 /core/src/test | |
parent | e5fc80e0688b7749fa1726820fd5537e3131ab73 (diff) | |
download | AntennaPod-8fdd034e9ef259fe706303ac92ee9e96c647d301.zip |
Added a real file to test chapters with
Thanks to the Sendegate community
https://sendegate.de/t/gesucht-beispieldateien-mit-kapitelmarken/13228
Diffstat (limited to 'core/src/test')
-rw-r--r-- | core/src/test/java/de/danoeh/antennapod/core/util/id3reader/ChapterReaderTest.java | 29 | ||||
-rw-r--r-- | core/src/test/resources/media-parser/ultraschall5.mp3 | bin | 0 -> 5903309 bytes |
2 files changed, 29 insertions, 0 deletions
diff --git a/core/src/test/java/de/danoeh/antennapod/core/util/id3reader/ChapterReaderTest.java b/core/src/test/java/de/danoeh/antennapod/core/util/id3reader/ChapterReaderTest.java index 34580146e..9f846c26d 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/util/id3reader/ChapterReaderTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/util/id3reader/ChapterReaderTest.java @@ -2,12 +2,14 @@ package de.danoeh.antennapod.core.util.id3reader; import de.danoeh.antennapod.core.feed.Chapter; import de.danoeh.antennapod.core.feed.ID3Chapter; +import de.danoeh.antennapod.core.util.EmbeddedChapterImage; import de.danoeh.antennapod.core.util.id3reader.model.FrameHeader; import org.apache.commons.io.input.CountingInputStream; import org.junit.Test; import java.io.ByteArrayInputStream; import java.io.IOException; +import java.util.List; import static de.danoeh.antennapod.core.util.id3reader.Id3ReaderTest.concat; import static de.danoeh.antennapod.core.util.id3reader.Id3ReaderTest.generateFrameHeader; @@ -102,4 +104,31 @@ public class ChapterReaderTest { // Should skip the garbage and point to the next frame assertEquals(titleSubframeContent.length, reader.getPosition()); } + + @Test + public void testRealFileUltraschall() throws IOException, ID3ReaderException { + CountingInputStream inputStream = new CountingInputStream(getClass().getClassLoader() + .getResource("media-parser/ultraschall5.mp3").openStream()); + ChapterReader reader = new ChapterReader(inputStream); + reader.readInputStream(); + List<Chapter> chapters = reader.getChapters(); + + assertEquals(3, chapters.size()); + + assertEquals(0, chapters.get(0).getStart()); + assertEquals(4004, chapters.get(1).getStart()); + assertEquals(7999, chapters.get(2).getStart()); + + assertEquals("Marke 1", chapters.get(0).getTitle()); + assertEquals("Marke 2", chapters.get(1).getTitle()); + assertEquals("Marke 3", chapters.get(2).getTitle()); + + assertEquals("https://example.com", chapters.get(0).getLink()); + assertEquals("https://example.com", chapters.get(1).getLink()); + assertEquals("https://example.com", chapters.get(2).getLink()); + + assertEquals(EmbeddedChapterImage.makeUrl(16073, 2750569), chapters.get(0).getImageUrl()); + assertEquals(EmbeddedChapterImage.makeUrl(2766765, 15740), chapters.get(1).getImageUrl()); + assertEquals(EmbeddedChapterImage.makeUrl(2782628, 2750569), chapters.get(2).getImageUrl()); + } } diff --git a/core/src/test/resources/media-parser/ultraschall5.mp3 b/core/src/test/resources/media-parser/ultraschall5.mp3 Binary files differnew file mode 100644 index 000000000..a73029a54 --- /dev/null +++ b/core/src/test/resources/media-parser/ultraschall5.mp3 |