Make sure 2-channel MXFs don't get extra channel descriptors (#2631).
[dcpomatic.git] / test / subtitle_font_id_test.cc
index b55562c227898bd338f09d52e140453eabfb3ea0..b4c28e53ef685be0127567f7a6a110df772dd25d 100644 (file)
@@ -24,6 +24,7 @@
 #include "lib/film.h"
 #include "lib/font.h"
 #include "lib/text_content.h"
+#include "lib/util.h"
 #include <dcp/cpl.h>
 #include <dcp/dcp.h>
 #include <dcp/reel.h>
@@ -34,7 +35,6 @@
 
 
 using std::make_shared;
-using std::shared_ptr;
 
 
 BOOST_AUTO_TEST_CASE(full_dcp_subtitle_font_id_test)
@@ -90,10 +90,14 @@ BOOST_AUTO_TEST_CASE(make_dcp_with_subs_from_interop_dcp)
 
 BOOST_AUTO_TEST_CASE(make_dcp_with_subs_from_smpte_dcp)
 {
+       Cleanup cl;
+
        auto dcp = make_shared<DCPContent>(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV");
-       auto film = new_test_film2("make_dcp_with_subs_from_smpte_dcp", { dcp });
+       auto film = new_test_film2("make_dcp_with_subs_from_smpte_dcp", { dcp }, &cl);
        dcp->text.front()->set_use(true);
        make_and_verify_dcp(film);
+
+       cl.run();
 }
 
 
@@ -157,7 +161,7 @@ BOOST_AUTO_TEST_CASE(make_dcp_with_subs_in_dcp_without_font_tag)
 #if BOOST_VERSION >= 107400
        boost::filesystem::copy_file("test/data/no_font.xml", source_subtitle_file, boost::filesystem::copy_options::overwrite_existing);
 #else
-       boost::filesystem::copy_file("test/data/no_font.xml", source_subtitle_file, boost::filesystem::copy_option::overwrite_existing);
+       boost::filesystem::copy_file("test/data/no_font.xml", source_subtitle_file, boost::filesystem::copy_option::overwrite_if_exists);
 #endif
 
        /* Fix the <Id> tag */
@@ -187,3 +191,25 @@ BOOST_AUTO_TEST_CASE(make_dcp_with_subs_in_dcp_without_font_tag)
        BOOST_CHECK(check_font_data.begin()->second == dcp::ArrayData(default_font_file()));
 }
 
+
+BOOST_AUTO_TEST_CASE(filler_subtitle_reels_have_load_font_tags)
+{
+       auto const name = boost::unit_test::framework::current_test_case().full_name();
+
+       auto subs = content_factory("test/data/short.srt")[0];
+       auto video1 = content_factory("test/data/flat_red.png")[0];
+       auto video2 = content_factory("test/data/flat_red.png")[0];
+
+       auto film = new_test_film2(name, { video1, video2, subs });
+       film->set_reel_type(ReelType::BY_VIDEO_CONTENT);
+
+       make_and_verify_dcp(
+               film,
+               {
+                       dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+                       dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+                       dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING,
+                       dcp::VerificationNote::Code::MISSING_CPL_METADATA
+               });
+}
+