mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-02 08:25:02 -04:00
+ MediaInfoTest
This commit is contained in:
parent
993319c4cc
commit
84ac74ca1a
@ -8,6 +8,7 @@ import net.filebot.format.ExpressionFormatTest;
|
|||||||
import net.filebot.hash.VerificationFormatTest;
|
import net.filebot.hash.VerificationFormatTest;
|
||||||
import net.filebot.media.MediaDetectionTest;
|
import net.filebot.media.MediaDetectionTest;
|
||||||
import net.filebot.media.ReleaseInfoTest;
|
import net.filebot.media.ReleaseInfoTest;
|
||||||
|
import net.filebot.mediainfo.MediaInfoTest;
|
||||||
import net.filebot.similarity.EpisodeMetricsTest;
|
import net.filebot.similarity.EpisodeMetricsTest;
|
||||||
import net.filebot.similarity.SimilarityTestSuite;
|
import net.filebot.similarity.SimilarityTestSuite;
|
||||||
import net.filebot.subtitle.SubtitleReaderTestSuite;
|
import net.filebot.subtitle.SubtitleReaderTestSuite;
|
||||||
@ -16,7 +17,7 @@ import net.filebot.util.UtilTestSuite;
|
|||||||
import net.filebot.web.WebTestSuite;
|
import net.filebot.web.WebTestSuite;
|
||||||
|
|
||||||
@RunWith(Suite.class)
|
@RunWith(Suite.class)
|
||||||
@SuiteClasses({ SimilarityTestSuite.class, WebTestSuite.class, ExpressionFormatTest.class, VerificationFormatTest.class, MatchModelTest.class, EpisodeMetricsTest.class, SubtitleReaderTestSuite.class, ReleaseInfoTest.class, MediaDetectionTest.class, UtilTestSuite.class })
|
@SuiteClasses({ SimilarityTestSuite.class, WebTestSuite.class, ExpressionFormatTest.class, VerificationFormatTest.class, MatchModelTest.class, EpisodeMetricsTest.class, SubtitleReaderTestSuite.class, ReleaseInfoTest.class, MediaDetectionTest.class, MediaInfoTest.class, UtilTestSuite.class })
|
||||||
public class AllTests {
|
public class AllTests {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
58
test/net/filebot/mediainfo/MediaInfoTest.java
Normal file
58
test/net/filebot/mediainfo/MediaInfoTest.java
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
package net.filebot.mediainfo;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import net.filebot.Cache;
|
||||||
|
import net.filebot.CacheType;
|
||||||
|
import net.filebot.mediainfo.MediaInfo.StreamKind;
|
||||||
|
|
||||||
|
public class MediaInfoTest {
|
||||||
|
|
||||||
|
private static File getSampleFile(String name) throws Exception {
|
||||||
|
File folder = new File(FileUtils.getTempDirectory(), MediaInfoTest.class.getName());
|
||||||
|
File file = new File(folder, name + ".mp4");
|
||||||
|
|
||||||
|
if (!file.exists()) {
|
||||||
|
byte[] bytes = Cache.getCache(folder.getName(), CacheType.Persistent).bytes("video/mp4/720/big_buck_bunny_720p_1mb.mp4", n -> {
|
||||||
|
return new URL("http://www.sample-videos.com/" + n);
|
||||||
|
}).get();
|
||||||
|
|
||||||
|
FileUtils.forceMkdir(folder);
|
||||||
|
FileUtils.writeByteArrayToFile(file, bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void testSampleFile(String name) throws Exception {
|
||||||
|
MediaInfo mi = new MediaInfo().open(getSampleFile(name));
|
||||||
|
|
||||||
|
assertEquals("MPEG-4", mi.get(StreamKind.General, 0, "Format"));
|
||||||
|
assertEquals("AVC", mi.get(StreamKind.Video, 0, "Format"));
|
||||||
|
assertEquals("AAC", mi.get(StreamKind.Audio, 0, "Format"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void open() throws Exception {
|
||||||
|
testSampleFile("English");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void openUnicode() throws Exception {
|
||||||
|
testSampleFile("中文");
|
||||||
|
testSampleFile("日本語");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void openDiacriticalMarks() throws Exception {
|
||||||
|
testSampleFile("Español");
|
||||||
|
testSampleFile("Österreichisch");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user