Added auphonic files to chapter marks tests
We currently don't have a parser for the m4a file but I just committed the file for later.
This commit is contained in:
parent
d6b6a0691d
commit
6add59819a
|
@ -131,4 +131,35 @@ public class ChapterReaderTest {
|
|||
assertEquals(EmbeddedChapterImage.makeUrl(2766765, 15740), chapters.get(1).getImageUrl());
|
||||
assertEquals(EmbeddedChapterImage.makeUrl(2782628, 2750569), chapters.get(2).getImageUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRealFileAuphonic() throws IOException, ID3ReaderException {
|
||||
CountingInputStream inputStream = new CountingInputStream(getClass().getClassLoader()
|
||||
.getResource("media-parser/auphonic.mp3").openStream());
|
||||
ChapterReader reader = new ChapterReader(inputStream);
|
||||
reader.readInputStream();
|
||||
List<Chapter> chapters = reader.getChapters();
|
||||
|
||||
assertEquals(4, chapters.size());
|
||||
|
||||
assertEquals(0, chapters.get(0).getStart());
|
||||
assertEquals(3000, chapters.get(1).getStart());
|
||||
assertEquals(6000, chapters.get(2).getStart());
|
||||
assertEquals(9000, chapters.get(3).getStart());
|
||||
|
||||
assertEquals("Chapter 1 - ❤️😊", chapters.get(0).getTitle());
|
||||
assertEquals("Chapter 2 - ßöÄ", chapters.get(1).getTitle());
|
||||
assertEquals("Chapter 3 - 爱", chapters.get(2).getTitle());
|
||||
assertEquals("Chapter 4", chapters.get(3).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("https://example.com", chapters.get(3).getLink());
|
||||
|
||||
assertEquals(EmbeddedChapterImage.makeUrl(765, 308), chapters.get(0).getImageUrl());
|
||||
assertEquals(EmbeddedChapterImage.makeUrl(1271, 308), chapters.get(1).getImageUrl());
|
||||
assertEquals(EmbeddedChapterImage.makeUrl(1771, 308), chapters.get(2).getImageUrl());
|
||||
assertEquals(EmbeddedChapterImage.makeUrl(2259, 308), chapters.get(3).getImageUrl());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package de.danoeh.antennapod.core.util.vorbiscommentreader;
|
||||
|
||||
import de.danoeh.antennapod.core.feed.Chapter;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class VorbisCommentChapterReaderTest {
|
||||
|
||||
@Test
|
||||
public void testRealFilesAuphonic() throws IOException, VorbisCommentReaderException {
|
||||
testRealFileAuphonic("media-parser/auphonic.ogg");
|
||||
testRealFileAuphonic("media-parser/auphonic.opus");
|
||||
}
|
||||
|
||||
public void testRealFileAuphonic(String filename) throws IOException, VorbisCommentReaderException {
|
||||
InputStream inputStream = getClass().getClassLoader()
|
||||
.getResource(filename).openStream();
|
||||
VorbisCommentChapterReader reader = new VorbisCommentChapterReader();
|
||||
reader.readInputStream(inputStream);
|
||||
List<Chapter> chapters = reader.getChapters();
|
||||
|
||||
assertEquals(4, chapters.size());
|
||||
|
||||
assertEquals(0, chapters.get(0).getStart());
|
||||
assertEquals(3000, chapters.get(1).getStart());
|
||||
assertEquals(6000, chapters.get(2).getStart());
|
||||
assertEquals(9000, chapters.get(3).getStart());
|
||||
|
||||
assertEquals("Chapter 1 - ❤️😊", chapters.get(0).getTitle());
|
||||
assertEquals("Chapter 2 - ßöÄ", chapters.get(1).getTitle());
|
||||
assertEquals("Chapter 3 - 爱", chapters.get(2).getTitle());
|
||||
assertEquals("Chapter 4", chapters.get(3).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("https://example.com", chapters.get(3).getLink());
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue