forked from AntennaPod/AntennaPod
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add testcase for Nero M4A chapters (AntennaPod#4311)
This commit adds testcases that verify whether the application correctly parses Nero type M4A chapters.
- Loading branch information
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
parser/media/src/test/java/de/danoeh/antennapod/parser/media/m4a/M4AChapterReaderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package de.danoeh.antennapod.parser.media.m4a; | ||
|
||
import de.danoeh.antennapod.model.feed.Chapter; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.robolectric.RobolectricTestRunner; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.List; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
@RunWith(RobolectricTestRunner.class) | ||
public class M4AChapterReaderTest { | ||
|
||
@Test | ||
public void testRealFilesAuphonic() throws IOException { | ||
testRealFileAuphonic("nero-chapters.m4a"); | ||
} | ||
|
||
public void testRealFileAuphonic(String filename) throws IOException { | ||
InputStream inputStream = getClass().getClassLoader() | ||
.getResource(filename).openStream(); | ||
M4AChapterReader reader = new M4AChapterReader(inputStream); | ||
reader.readInputStream(); | ||
List<Chapter> chapters = reader.getChapters(); | ||
|
||
assertEquals(3, chapters.size()); | ||
|
||
assertEquals(0, chapters.get(0).getStart()); | ||
assertEquals(23000, chapters.get(1).getStart()); | ||
assertEquals(67000, chapters.get(2).getStart()); | ||
|
||
assertEquals("An intro to video chapters", chapters.get(0).getTitle()); | ||
assertEquals("How to set up video chapters", chapters.get(1).getTitle()); | ||
assertEquals("See video chapters in action", chapters.get(2).getTitle()); | ||
} | ||
} |
File renamed without changes.
Binary file not shown.