From 8ed4c943141876970e8761993915cfb48df3f189 Mon Sep 17 00:00:00 2001 From: simon987 Date: Wed, 5 May 2021 16:10:55 -0400 Subject: [PATCH] Add tests for subtitle --- test/main.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/main.cpp b/test/main.cpp index 001a8b8..9423c2a 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -374,6 +374,36 @@ TEST(MediaImage, Mem2AsIs) { cleanup(&doc, &f); } +TEST(MediaVideo, VidMkvSubDisabled) { + vfile_t f; + document_t doc; + load_doc_file("libscan-test-files/test_files/media/berd.mkv", &f, &doc); + + size_t size_before = store_size; + parse_media(&media_ctx, &f, &doc); + + ASSERT_NE(size_before, store_size); + ASSERT_EQ(get_meta(&doc, MetaContent), nullptr); + + cleanup(&doc, &f); +} + +TEST(MediaVideo, VidMkvSubEnabled) { + vfile_t f; + document_t doc; + load_doc_file("libscan-test-files/test_files/media/berd.mkv", &f, &doc); + + size_t size_before = store_size; + media_ctx.read_subtitles = TRUE; + parse_media(&media_ctx, &f, &doc); + media_ctx.read_subtitles = FALSE; + + ASSERT_NE(size_before, store_size); + ASSERT_NE(get_meta(&doc, MetaContent), nullptr); + + cleanup(&doc, &f); +} + TEST(MediaVideo, Vid3Mp4) { vfile_t f; document_t doc;