Handle fonts for ccaps coming from DCP content (#2525).
[dcpomatic.git] / test / torture_test.cc
index 851a26a31ddadcce03ac229b259c199fffebdf0a..0c781fdb1218faa4e6c5d0d0f72747a6a59cb94d 100644 (file)
 
 
 #include "lib/audio_content.h"
-#include "lib/film.h"
+#include "lib/content_factory.h"
+#include "lib/dcp_content.h"
 #include "lib/dcp_content_type.h"
+#include "lib/film.h"
 #include "lib/ratio.h"
-#include "lib/content_factory.h"
+#include "lib/text_content.h"
 #include "lib/video_content.h"
 #include "test.h"
 #include <dcp/cpl.h>
-#include <dcp/reel.h>
-#include <dcp/reel_sound_asset.h>
-#include <dcp/reel_picture_asset.h>
-#include <dcp/sound_asset.h>
 #include <dcp/mono_picture_asset.h>
 #include <dcp/mono_picture_frame.h>
 #include <dcp/openjpeg_image.h>
+#include <dcp/reel.h>
+#include <dcp/reel_picture_asset.h>
+#include <dcp/reel_sound_asset.h>
+#include <dcp/sound_asset.h>
 #include <boost/test/unit_test.hpp>
 #include <iostream>
 
 
-using std::list;
 using std::cout;
-using std::shared_ptr;
 using std::dynamic_pointer_cast;
+using std::list;
+using std::make_shared;
+using std::shared_ptr;
 using namespace dcpomatic;
 
 
@@ -296,3 +299,29 @@ BOOST_AUTO_TEST_CASE (torture_test1)
        }
 
 }
+
+
+BOOST_AUTO_TEST_CASE(multi_reel_interop_ccap_test)
+{
+       auto pic1 = content_factory("test/data/flat_red.png").front();
+       auto ccap1 = content_factory("test/data/15s.srt").front();
+       auto pic2 = content_factory("test/data/flat_red.png").front();
+       auto ccap2 = content_factory("test/data/15s.srt").front();
+       auto film1 = new_test_film2("multi_reel_interop_ccap_test1", { pic1, ccap1, pic2, ccap2 });
+       film1->set_interop(true);
+       film1->set_reel_type(ReelType::BY_VIDEO_CONTENT);
+       ccap1->text[0]->set_type(TextType::CLOSED_CAPTION);
+       pic1->video->set_length(15 * 24);
+       ccap2->text[0]->set_type(TextType::CLOSED_CAPTION);
+       pic2->video->set_length(15 * 24);
+       make_and_verify_dcp(film1, { dcp::VerificationNote::Code::INVALID_STANDARD, dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING });
+
+       auto reload = make_shared<DCPContent>(film1->dir(film1->dcp_name()));
+       auto film2 = new_test_film2("multi_reel_interop_ccap_test2", { reload });
+       for (auto i: reload->text) {
+               i->set_use(true);
+       }
+       film2->set_interop(true);
+       make_and_verify_dcp(film2, { dcp::VerificationNote::Code::INVALID_STANDARD, dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING });
+}
+