Supporters update.
[dcpomatic.git] / test / torture_test.cc
index 6b8cbffbfb96e8344f1286499caf477cbc7a6826..0c781fdb1218faa4e6c5d0d0f72747a6a59cb94d 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2017 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 /** @file  test/torture_test.cc
  *  @brief Tricky arrangements of content whose resulting DCPs are checked programmatically.
  *  @ingroup completedcp
  */
 
+
 #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;
 
+
 /** Test start/end trim and positioning of some audio content */
 BOOST_AUTO_TEST_CASE (torture_test1)
 {
@@ -54,25 +61,25 @@ BOOST_AUTO_TEST_CASE (torture_test1)
        film->set_sequence (false);
 
        /* Staircase at an offset of 2000 samples, trimmed both start and end, with a gain of exactly 2 (linear) */
-       auto staircase = content_factory("test/data/staircase.wav").front();
+       auto staircase = content_factory("test/data/staircase.wav")[0];
        film->examine_and_add_content (staircase);
        BOOST_REQUIRE (!wait_for_jobs());
        staircase->set_position (film, DCPTime::from_frames(2000, film->audio_frame_rate()));
-       staircase->set_trim_start (ContentTime::from_frames(12, 48000));
+       staircase->set_trim_start(film, ContentTime::from_frames(12, 48000));
        staircase->set_trim_end (ContentTime::from_frames (35, 48000));
        staircase->audio->set_gain (20 * log10(2));
 
        /* And again at an offset of 50000 samples, trimmed both start and end, with a gain of exactly 2 (linear) */
-       staircase = content_factory("test/data/staircase.wav").front ();
+       staircase = content_factory("test/data/staircase.wav")[0];
        film->examine_and_add_content (staircase);
        BOOST_REQUIRE (!wait_for_jobs());
        staircase->set_position (film, DCPTime::from_frames(50000, film->audio_frame_rate()));
-       staircase->set_trim_start (ContentTime::from_frames(12, 48000));
+       staircase->set_trim_start(film, ContentTime::from_frames(12, 48000));
        staircase->set_trim_end (ContentTime::from_frames(35, 48000));
        staircase->audio->set_gain (20 * log10(2));
 
        /* 1s of red at 5s in */
-       auto red = content_factory("test/data/flat_red.png").front();
+       auto red = content_factory("test/data/flat_red.png")[0];
        film->examine_and_add_content (red);
        BOOST_REQUIRE (!wait_for_jobs());
        red->set_position (film, DCPTime::from_seconds(5));
@@ -292,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 });
+}
+