Verify a whole bunch of DCPs made by unit tests.
authorCarl Hetherington <cth@carlh.net>
Sun, 21 Feb 2021 19:28:59 +0000 (20:28 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 23 Feb 2021 19:09:39 +0000 (20:09 +0100)
27 files changed:
test/atmos_test.cc
test/audio_delay_test.cc
test/burnt_subtitle_test.cc
test/closed_caption_test.cc
test/content_test.cc
test/cpl_hash_test.cc
test/data
test/dcp_subtitle_test.cc
test/ffmpeg_dcp_test.cc
test/ffmpeg_encoder_test.cc
test/image_content_fade_test.cc
test/import_dcp_test.cc
test/kdm_naming_test.cc
test/no_use_video_test.cc
test/recover_test.cc
test/reel_writer_test.cc
test/reels_test.cc
test/repeat_frame_test.cc
test/silence_padding_test.cc
test/srt_subtitle_test.cc
test/ssa_subtitle_test.cc
test/subtitle_language_test.cc
test/test.cc
test/test.h
test/torture_test.cc
test/video_level_test.cc
test/video_mxf_content_test.cc

index 50b642c1f423ff43e151cdf1fde2359fc2300fe8..c3e8c341c2917c0a064d7df3d73ab937bce8a50b 100644 (file)
@@ -40,15 +40,16 @@ BOOST_AUTO_TEST_CASE (atmos_passthrough_test)
 {
        Cleanup cl;
 
-       auto film = new_test_film2 ("atmos_passthrough_test", &cl);
-       auto ref = TestPaths::private_data() / "atmos_asset.mxf";
-       auto content = content_factory (TestPaths::private_data() / "atmos_asset.mxf").front();
-       film->examine_and_add_content (content);
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto film = new_test_film2 (
+               "atmos_passthrough_test",
+               { content_factory(TestPaths::private_data() / "atmos_asset.mxf").front() },
+               &cl
+               );
 
        film->make_dcp ();
        BOOST_REQUIRE (!wait_for_jobs());
 
+       auto ref = TestPaths::private_data() / "atmos_asset.mxf";
        BOOST_REQUIRE (mxf_atmos_files_same(ref, dcp_file(film, "atmos"), true));
 
        cl.run ();
@@ -59,16 +60,13 @@ BOOST_AUTO_TEST_CASE (atmos_encrypted_passthrough_test)
 {
        Cleanup cl;
 
-       auto film = new_test_film2 ("atmos_encrypted_passthrough_test", &cl);
        auto ref = TestPaths::private_data() / "atmos_asset.mxf";
        auto content = content_factory (TestPaths::private_data() / "atmos_asset.mxf").front();
-       film->examine_and_add_content (content);
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto film = new_test_film2 ("atmos_encrypted_passthrough_test", {content}, &cl);
 
        film->set_encrypted (true);
        film->_key = dcp::Key ("4fac12927eb122af1c2781aa91f3a4cc");
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_CPL_METADATA });
 
        BOOST_REQUIRE (!mxf_atmos_files_same(ref, dcp_file(film, "atmos")));
 
@@ -83,14 +81,10 @@ BOOST_AUTO_TEST_CASE (atmos_encrypted_passthrough_test)
                optional<int>()
                );
 
-       auto film2 = new_test_film2 ("atmos_encrypted_passthrough_test2", &cl);
        auto content2 = make_shared<DCPContent>(film->dir(film->dcp_name()));
        content2->add_kdm (kdm);
-       film2->examine_and_add_content (content2);
-       BOOST_REQUIRE (!wait_for_jobs());
-
-       film2->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto film2 = new_test_film2 ("atmos_encrypted_passthrough_test2", {content2}, &cl);
+       make_and_verify_dcp (film2, { dcp::VerificationNote::Code::MISSING_CPL_METADATA });
 
        BOOST_CHECK (mxf_atmos_files_same(ref, dcp_file(film2, "atmos"), true));
 
index f229446f02a7a464e0199cf1fb6565d5e1fd91d2..d8d69424bd1a44144004dcffed39b03c2a9f61f5 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
+
 /** @defgroup feature Tests of features */
 
 /** @file  test/audio_delay_test.cc
  *  The output is checked algorithmically using knowledge of the input.
  */
 
-#include <boost/test/unit_test.hpp>
-#include <dcp/sound_frame.h>
+
+#include "lib/audio_content.h"
+#include "lib/dcp_content_type.h"
+#include "lib/ffmpeg_content.h"
+#include "lib/film.h"
+#include "lib/ratio.h"
+#include "test.h"
 #include <dcp/cpl.h>
 #include <dcp/reel.h>
+#include <dcp/reel_sound_asset.h>
 #include <dcp/sound_asset.h>
 #include <dcp/sound_asset_reader.h>
-#include <dcp/reel_sound_asset.h>
-#include "lib/ffmpeg_content.h"
-#include "lib/dcp_content_type.h"
-#include "lib/ratio.h"
-#include "lib/film.h"
-#include "lib/audio_content.h"
-#include "test.h"
+#include <dcp/sound_frame.h>
+#include <boost/test/unit_test.hpp>
 #include <iostream>
 
-using std::string;
+
 using std::cout;
-using boost::lexical_cast;
+using std::make_shared;
 using std::shared_ptr;
+using std::string;
+using boost::lexical_cast;
+
 
 static
 void test_audio_delay (int delay_in_ms)
@@ -53,18 +58,14 @@ void test_audio_delay (int delay_in_ms)
        BOOST_TEST_MESSAGE ("Testing delay of " << delay_in_ms);
 
        string const film_name = "audio_delay_test_" + lexical_cast<string> (delay_in_ms);
-       shared_ptr<Film> film = new_test_film (film_name);
-       film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
-       film->set_container (Ratio::from_id ("185"));
-       film->set_name (film_name);
-
-       shared_ptr<FFmpegContent> content (new FFmpegContent("test/data/staircase.wav"));
-       film->examine_and_add_content (content);
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto content = make_shared<FFmpegContent>("test/data/staircase.wav");
+       shared_ptr<Film> film = new_test_film2 (
+               film_name, { content }
+               );
+
        content->audio->set_delay (delay_in_ms);
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_CPL_METADATA });
 
        boost::filesystem::path path = "build/test";
        path /= film_name;
@@ -73,7 +74,7 @@ void test_audio_delay (int delay_in_ms)
        dcp::DCP check (path.string ());
        check.read ();
 
-       shared_ptr<const dcp::ReelSoundAsset> sound_asset = check.cpls().front()->reels().front()->main_sound ();
+       auto sound_asset = check.cpls().front()->reels().front()->main_sound ();
        BOOST_CHECK (sound_asset);
 
        /* Sample index in the DCP */
@@ -103,6 +104,7 @@ void test_audio_delay (int delay_in_ms)
        }
 }
 
+
 /* Test audio delay when specified in a piece of audio content */
 BOOST_AUTO_TEST_CASE (audio_delay_test)
 {
index 25ad3f66bd06bb512fc211412132e770b0b124b8..1d689e33252f21512e36444ce9e6bdd2cc83f989 100644 (file)
@@ -83,8 +83,7 @@ BOOST_AUTO_TEST_CASE (burnt_subtitle_test_dcp)
        content->subtitle->set_use (true);
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs());
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
 
        check_dcp ("test/data/burnt_subtitle_test_dcp", film->dir (film->dcp_name ()));
 }
@@ -98,8 +97,7 @@ BOOST_AUTO_TEST_CASE (burnt_subtitle_test_onto_dcp)
        film->set_name ("frobozz");
        film->examine_and_add_content (content_factory(film, "test/data/flat_black.png").front());
        BOOST_REQUIRE (!wait_for_jobs());
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
 
        Config::instance()->set_log_types (Config::instance()->log_types() | LogEntry::TYPE_DEBUG_ENCODE);
        auto film2 = new_test_film ("burnt_subtitle_test_onto_dcp2");
@@ -115,8 +113,7 @@ BOOST_AUTO_TEST_CASE (burnt_subtitle_test_onto_dcp)
        sub->subtitle->set_outline (true);
        film2->examine_and_add_content (sub);
        BOOST_REQUIRE (!wait_for_jobs());
-       film2->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film2);
 
        BOOST_CHECK (background_dcp->position() == DCPTime());
        BOOST_CHECK (sub->position() == DCPTime());
index cc2dca930e8457ab9eb2efd07f5a4f9e3492b65f..434aacde3ebedc404735e6a5f0a8de07ddb57d6d 100644 (file)
@@ -37,10 +37,8 @@ BOOST_AUTO_TEST_CASE (closed_caption_test1)
 {
        Cleanup cl;
 
-       auto film = new_test_film2 ("closed_caption_test1", &cl);
        auto content = make_shared<StringTextFileContent>("test/data/subrip.srt");
-       film->examine_and_add_content (content);
-       BOOST_REQUIRE (!wait_for_jobs ());
+       auto film = new_test_film2 ("closed_caption_test1", { content }, &cl);
 
        content->only_text()->set_type (TextType::CLOSED_CAPTION);
 
@@ -65,15 +63,10 @@ BOOST_AUTO_TEST_CASE (closed_caption_test1)
 BOOST_AUTO_TEST_CASE (closed_caption_test2)
 {
        Cleanup cl;
-
-       auto film = new_test_film2 ("closed_caption_test2", &cl);
        auto content1 = make_shared<StringTextFileContent>("test/data/subrip.srt");
-       film->examine_and_add_content (content1);
        auto content2 = make_shared<StringTextFileContent>("test/data/subrip2.srt");
-       film->examine_and_add_content (content2);
        auto content3 = make_shared<StringTextFileContent>("test/data/subrip3.srt");
-       film->examine_and_add_content (content3);
-       BOOST_REQUIRE (!wait_for_jobs ());
+       auto film = new_test_film2 ("closed_caption_test2", { content1, content2, content3 }, &cl);
 
        content1->only_text()->set_type (TextType::CLOSED_CAPTION);
        content1->only_text()->set_dcp_track (DCPTextTrack("First track", "fr-FR"));
@@ -82,8 +75,14 @@ BOOST_AUTO_TEST_CASE (closed_caption_test2)
        content3->only_text()->set_type (TextType::CLOSED_CAPTION);
        content3->only_text()->set_dcp_track (DCPTextTrack("Third track", "it-IT"));
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs ());
+       make_and_verify_dcp (
+               film,
+               {
+                       dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION,
+                       dcp::VerificationNote::Code::INVALID_CLOSED_CAPTION_LINE_LENGTH,
+                       dcp::VerificationNote::Code::MISSING_CPL_METADATA
+               }
+               );
 
        dcp::DCP check (film->dir(film->dcp_name()));
        check.read ();
index cf34251f5d379206b5e4208a688b9cc74a8177b1..ef3b710e76618d57e0c34545e2045fbd38299435 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2017-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 /** @file  test/content_test.cc
  *  @brief Tests which expose problems with certain pieces of content.
  *  @ingroup completedcp
  */
 
+
 #include "lib/audio_content.h"
 #include "lib/film.h"
 #include "lib/dcp_content_type.h"
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 
+
 using std::shared_ptr;
 using namespace dcpomatic;
 
+
 /** There has been garbled audio with this piece of content */
 BOOST_AUTO_TEST_CASE (content_test1)
 {
-       shared_ptr<Film> film = new_test_film ("content_test1");
+       auto film = new_test_film ("content_test1");
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
        film->set_name ("content_test1");
        film->set_container (Ratio::from_id ("185"));
 
-       shared_ptr<Content> content = content_factory(TestPaths::private_data() / "demo_sound_bug.mkv").front ();
+       auto content = content_factory(TestPaths::private_data() / "demo_sound_bug.mkv").front ();
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs ());
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs ());
+       make_and_verify_dcp (
+               film,
+               { dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE }
+               );
 
        boost::filesystem::path check;
 
-       for (
-               boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator("build/test/content_test1/" + film->dcp_name());
-               i != boost::filesystem::directory_iterator();
-               ++i) {
-
-               if (i->path().leaf().string().substr(0, 4) == "pcm_") {
-                       check = *i;
+       for (auto i: boost::filesystem::directory_iterator("build/test/content_test1/" + film->dcp_name())) {
+               if (i.path().leaf().string().substr(0, 4) == "pcm_") {
+                       check = i;
                }
        }
 
        check_mxf_audio_file (TestPaths::private_data() / "content_test1.mxf", check);
 }
 
+
 /** Taking some 23.976fps content and trimming 0.5s (in content time) from the start
  *  has failed in the past; ensure that this is fixed.
  */
 BOOST_AUTO_TEST_CASE (content_test2)
 {
-       shared_ptr<Film> film = new_test_film2 ("content_test2");
-
-       shared_ptr<Content> content = content_factory("test/data/red_23976.mp4").front();
-       film->examine_and_add_content (content);
-       BOOST_REQUIRE (!wait_for_jobs ());
+       auto content = content_factory("test/data/red_23976.mp4").front();
+       auto film = new_test_film2 ("content_test2", {content});
        content->set_trim_start(ContentTime::from_seconds(0.5));
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs ());
+       make_and_verify_dcp (film);
 }
 
+
 /** Check that position and start trim of video content is forced to a frame boundary */
 BOOST_AUTO_TEST_CASE (content_test3)
 {
-       shared_ptr<Film> film = new_test_film2 ("content_test3");
+       auto content = content_factory("test/data/red_24.mp4").front();
+       auto film = new_test_film2 ("content_test3", {content});
        film->set_sequence (false);
 
-       shared_ptr<Content> content = content_factory("test/data/red_24.mp4").front();
-       film->examine_and_add_content (content);
-       BOOST_REQUIRE (!wait_for_jobs ());
-
        /* Trim */
 
        /* 12 frames */
@@ -128,9 +125,9 @@ BOOST_AUTO_TEST_CASE (content_test3)
 /** Content containing video will have its length rounded to the nearest video frame */
 BOOST_AUTO_TEST_CASE (content_test4)
 {
-       shared_ptr<Film> film = new_test_film2 ("content_test4");
+       auto film = new_test_film2 ("content_test4");
 
-       shared_ptr<Content> video = content_factory("test/data/count300bd24.m2ts").front();
+       auto video = content_factory("test/data/count300bd24.m2ts").front();
        film->examine_and_add_content (video);
        BOOST_REQUIRE (!wait_for_jobs());
 
@@ -142,13 +139,11 @@ BOOST_AUTO_TEST_CASE (content_test4)
 /** Content containing no video will not have its length rounded to the nearest video frame */
 BOOST_AUTO_TEST_CASE (content_test5)
 {
-       shared_ptr<Film> film = new_test_film2 ("content_test5");
-
-       shared_ptr<Content> audio = content_factory("test/data/sine_16_48_220_10.wav").front();
-       film->examine_and_add_content (audio);
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto audio = content_factory("test/data/sine_16_48_220_10.wav").front();
+       auto film = new_test_film2 ("content_test5", {audio});
 
        audio->set_trim_end (dcpomatic::ContentTime(3000));
+
        BOOST_CHECK (audio->length_after_trim(film) == DCPTime(957000));
 }
 
@@ -158,11 +153,13 @@ BOOST_AUTO_TEST_CASE (content_test6)
 {
        Cleanup cl;
 
-       auto film = new_test_film2 ("content_test6", &cl);
-       film->examine_and_add_content (content_factory(TestPaths::private_data() / "fha.mkv").front());
-       BOOST_REQUIRE (!wait_for_jobs());
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto film = new_test_film2 (
+               "content_test6",
+               { content_factory(TestPaths::private_data() / "fha.mkv").front() },
+               &cl
+               );
+
+       make_and_verify_dcp (film);
        check_dcp (TestPaths::private_data() / "fha", film);
 
        cl.run ();
@@ -172,11 +169,8 @@ BOOST_AUTO_TEST_CASE (content_test6)
 /** Reel length error when making the test for #1833 */
 BOOST_AUTO_TEST_CASE (content_test7)
 {
-       shared_ptr<Film> film = new_test_film2 ("content_test7");
-       shared_ptr<Content> content = content_factory(TestPaths::private_data() / "clapperboard.mp4").front();
-       film->examine_and_add_content (content);
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto content = content_factory(TestPaths::private_data() / "clapperboard.mp4").front();
+       auto film = new_test_film2 ("content_test7", {content});
        content->audio->set_delay (-1000);
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film, { dcp::VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_2K });
 }
index 5b15c6ee0949eab3d4e8d749a45985d52b19726a..f34c295831db4dc8ee0b676770ccea7ba1ec6c18 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
+
 /** @file  test/cpl_hash_test.cc
  *  @brief Make sure that <Hash> tags are always written to CPLs where required.
  *  @ingroup feature
@@ -33,8 +34,9 @@
 #include <boost/test/unit_test.hpp>
 
 
-using std::string;
+using std::make_shared;
 using std::shared_ptr;
+using std::string;
 
 
 BOOST_AUTO_TEST_CASE (hash_added_to_imported_dcp_test)
@@ -42,46 +44,45 @@ BOOST_AUTO_TEST_CASE (hash_added_to_imported_dcp_test)
        using namespace boost::filesystem;
 
        string const ov_name = "hash_added_to_imported_dcp_test_ov";
-       shared_ptr<Film> ov = new_test_film2 (ov_name);
-       ov->examine_and_add_content (content_factory("test/data/flat_red.png").front());
-       BOOST_REQUIRE (!wait_for_jobs());
-       ov->make_dcp();
-       BOOST_REQUIRE (!wait_for_jobs());
+       shared_ptr<Film> ov = new_test_film2 (
+               ov_name,
+               { content_factory("test/data/flat_red.png").front() }
+               );
+       make_and_verify_dcp (ov);
 
        /* Remove <Hash> tags from the CPL */
-       for (directory_iterator i = directory_iterator(String::compose("build/test/%1/%2", ov_name, ov->dcp_name())); i != directory_iterator(); ++i) {
-               if (boost::algorithm::starts_with(i->path().filename().string(), "cpl_")) {
-                       FILE* in = fopen_boost(i->path(), "r");
+       for (auto i: directory_iterator(String::compose("build/test/%1/%2", ov_name, ov->dcp_name()))) {
+               if (boost::algorithm::starts_with(i.path().filename().string(), "cpl_")) {
+                       auto in = fopen_boost(i.path(), "r");
                        BOOST_REQUIRE (in);
-                       FILE* out = fopen_boost(i->path().string() + ".tmp", "w");
+                       auto out = fopen_boost(i.path().string() + ".tmp", "w");
                        BOOST_REQUIRE (out);
                        char buffer[256];
-                       while (fgets (buffer, sizeof(buffer), in)) {
+                       while (fgets(buffer, sizeof(buffer), in)) {
                                if (string(buffer).find("Hash") == string::npos) {
                                        fputs (buffer, out);
                                }
                        }
                        fclose (in);
                        fclose (out);
-                       rename (i->path().string() + ".tmp", i->path());
+                       rename (i.path().string() + ".tmp", i.path());
                }
        }
 
        string const vf_name = "hash_added_to_imported_dcp_test_vf";
-       shared_ptr<Film> vf = new_test_film2 (vf_name);
-       shared_ptr<DCPContent> ov_content(new DCPContent(String::compose("build/test/%1/%2", ov_name, ov->dcp_name())));
-       vf->examine_and_add_content (ov_content);
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto ov_content = make_shared<DCPContent>(String::compose("build/test/%1/%2", ov_name, ov->dcp_name()));
+       auto vf = new_test_film2 (
+               vf_name, { ov_content }
+               );
 
        ov_content->set_reference_video (true);
-       vf->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
 
        /* Check for Hash tags in the VF DCP */
        int hashes = 0;
-       for (directory_iterator i = directory_iterator(String::compose("build/test/%1/%2", vf_name, vf->dcp_name())); i != directory_iterator(); ++i) {
-               if (boost::algorithm::starts_with(i->path().filename().string(), "cpl_")) {
-                       FILE* in = fopen_boost(i->path(), "r");
+       for (auto i: directory_iterator(String::compose("build/test/%1/%2", vf_name, vf->dcp_name()))) {
+               if (boost::algorithm::starts_with(i.path().filename().string(), "cpl_")) {
+                       auto in = fopen_boost(i.path(), "r");
                        BOOST_REQUIRE (in);
                        char buffer[256];
                        while (fgets (buffer, sizeof(buffer), in)) {
index 21f386365bef1ee6f8073c088679357fbbb13f9d..3eb05f5989dcb601bde60c4badc95b66cf46a0cb 160000 (submodule)
--- a/test/data
+++ b/test/data
@@ -1 +1 @@
-Subproject commit 21f386365bef1ee6f8073c088679357fbbb13f9d
+Subproject commit 3eb05f5989dcb601bde60c4badc95b66cf46a0cb
index 1bde437638da801bfcc2472f287b644c84c08687..d923448d3afffa418a608454edcd0d2a21d79e92 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2019 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 /** @file  test/dcp_subtitle_test.cc
  *  @brief Test DCP subtitle content in various ways.
  *  @ingroup feature
  */
 
+
 #include <boost/test/unit_test.hpp>
 #include "lib/film.h"
 #include "lib/dcp_subtitle_content.h"
 #include "test.h"
 #include <iostream>
 
+
 using std::cout;
 using std::list;
+using std::make_shared;
 using std::shared_ptr;
 using std::vector;
 using boost::optional;
@@ -48,8 +52,10 @@ using namespace boost::placeholders;
 #endif
 using namespace dcpomatic;
 
+
 optional<ContentStringText> stored;
 
+
 static void
 store (ContentStringText sub)
 {
@@ -62,15 +68,16 @@ store (ContentStringText sub)
        }
 }
 
+
 /** Test pass-through of a very simple DCP subtitle file */
 BOOST_AUTO_TEST_CASE (dcp_subtitle_test)
 {
-       shared_ptr<Film> film = new_test_film ("dcp_subtitle_test");
+       auto film = new_test_film ("dcp_subtitle_test");
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
        film->set_interop (false);
-       shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent ("test/data/dcp_sub.xml"));
+       auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub.xml");
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs ());
 
@@ -78,20 +85,26 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test)
 
        content->only_text()->set_use (true);
        content->only_text()->set_burn (false);
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs ());
-
-       check_dcp ("test/data/dcp_subtitle_test", film->dir (film->dcp_name ()));
+       make_and_verify_dcp (
+               film,
+               {
+                       dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+                       dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+                       dcp::VerificationNote::Code::MISSING_CPL_METADATA
+               });
+
+       check_dcp ("test/data/dcp_subtitle_test", film->dir(film->dcp_name()));
 }
 
+
 /** Test parsing of a subtitle within an existing DCP */
 BOOST_AUTO_TEST_CASE (dcp_subtitle_within_dcp_test)
 {
-       shared_ptr<Film> film = new_test_film ("dcp_subtitle_within_dcp_test");
+       auto film = new_test_film ("dcp_subtitle_within_dcp_test");
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
-       shared_ptr<DCPContent> content (new DCPContent(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV"));
+       auto content = make_shared<DCPContent>(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV");
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs ());
 
@@ -110,15 +123,15 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_within_dcp_test)
 /** Test subtitles whose text includes things like &lt;b&gt; */
 BOOST_AUTO_TEST_CASE (dcp_subtitle_test2)
 {
-       shared_ptr<Film> film = new_test_film ("dcp_subtitle_test2");
+       auto film = new_test_film ("dcp_subtitle_test2");
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
-       shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent("test/data/dcp_sub2.xml"));
+       auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub2.xml");
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs ());
 
-       shared_ptr<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder(film, content));
+       auto decoder = make_shared<DCPSubtitleDecoder>(film, content);
        decoder->only_text()->PlainStart.connect (bind (store, _1));
 
        stored = optional<ContentStringText> ();
@@ -129,28 +142,28 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test2)
        }
 }
 
+
 /** Test a failure case */
 BOOST_AUTO_TEST_CASE (dcp_subtitle_test3)
 {
-       shared_ptr<Film> film = new_test_film ("dcp_subtitle_test3");
+       auto film = new_test_film ("dcp_subtitle_test3");
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
        film->set_interop (true);
-       shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent ("test/data/dcp_sub3.xml"));
+       auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub3.xml");
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs ());
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs ());
+       make_and_verify_dcp (film, { dcp::VerificationNote::Code::INVALID_STANDARD });
 
-       shared_ptr<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder (film, content));
+       auto decoder = make_shared<DCPSubtitleDecoder>(film, content);
        stored = optional<ContentStringText> ();
        while (!decoder->pass ()) {
                decoder->only_text()->PlainStart.connect (bind (store, _1));
                if (stored && stored->from() == ContentTime::from_seconds(0.08)) {
-                       list<dcp::SubtitleString> s = stored->subs;
-                       list<dcp::SubtitleString>::const_iterator i = s.begin ();
+                       auto s = stored->subs;
+                       auto i = s.begin ();
                        BOOST_CHECK_EQUAL (i->text(), "This");
                        ++i;
                        BOOST_REQUIRE (i != s.end ());
@@ -164,29 +177,26 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test3)
        }
 }
 
+
 /** Check that Interop DCPs aren't made with more than one <LoadFont> (#1273) */
 BOOST_AUTO_TEST_CASE (dcp_subtitle_test4)
 {
-       shared_ptr<Film> film = new_test_film2 ("dcp_subtitle_test4");
+       auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub3.xml");
+       auto content2 = make_shared<DCPSubtitleContent>("test/data/dcp_sub3.xml");
+       auto film = new_test_film2 ("dcp_subtitle_test4", {content, content2});
        film->set_interop (true);
 
-       shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent ("test/data/dcp_sub3.xml"));
-       film->examine_and_add_content (content);
-       shared_ptr<DCPSubtitleContent> content2 (new DCPSubtitleContent ("test/data/dcp_sub3.xml"));
-       film->examine_and_add_content (content2);
-       BOOST_REQUIRE (!wait_for_jobs ());
-
        content->only_text()->add_font (shared_ptr<Font> (new Font ("font1")));
        content2->only_text()->add_font (shared_ptr<Font> (new Font ("font2")));
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs ());
+       make_and_verify_dcp (film, { dcp::VerificationNote::Code::INVALID_STANDARD });
 
        cxml::Document doc ("DCSubtitle");
        doc.read_file (subtitle_file (film));
        BOOST_REQUIRE_EQUAL (doc.node_children("LoadFont").size(), 1U);
 }
 
+
 static
 void
 check_font_tags (vector<cxml::NodePtr> nodes)
@@ -199,21 +209,17 @@ check_font_tags (vector<cxml::NodePtr> nodes)
        }
 }
 
+
 /** Check that imported <LoadFont> tags with empty IDs (or corresponding Font tags with empty IDs)
  *  are not passed through into the DCP.
  */
 BOOST_AUTO_TEST_CASE (dcp_subtitle_test5)
 {
-       shared_ptr<Film> film = new_test_film2 ("dcp_subtitle_test5");
+       auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub6.xml");
+       auto film = new_test_film2 ("dcp_subtitle_test5", {content});
        film->set_interop (true);
 
-       shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent("test/data/dcp_sub6.xml"));
-       film->examine_and_add_content (content);
-       BOOST_REQUIRE (!wait_for_jobs());
-
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
-       film->write_metadata ();
+       make_and_verify_dcp (film, { dcp::VerificationNote::Code::INVALID_STANDARD });
 
        cxml::Document doc ("DCSubtitle");
        doc.read_file (subtitle_file(film));
index ea3b8d4f9d8ea2b0b81f6725bd6a9482d1cffd9a..0d56f4290fd1788db1e655773717e5274df96e71 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
+
 /** @file test/ffmpeg_dcp_test.cc
  *  @brief Test creation of a very simple DCP from some FFmpegContent (data/test.mp4).
  *  @ingroup feature
@@ -25,6 +26,7 @@
  *  Also a quick test of Film::have_dcp ().
  */
 
+
 #include <boost/test/unit_test.hpp>
 #include <boost/filesystem.hpp>
 #include <boost/algorithm/string.hpp>
 #include "lib/video_content.h"
 #include "test.h"
 
+
+using std::make_shared;
 using std::shared_ptr;
 
+
 BOOST_AUTO_TEST_CASE (ffmpeg_dcp_test)
 {
-       shared_ptr<Film> film = new_test_film ("ffmpeg_dcp_test");
+       auto film = new_test_film ("ffmpeg_dcp_test");
        film->set_name ("test_film2");
-       shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/test.mp4"));
+       auto c = make_shared<FFmpegContent>("test/data/test.mp4");
        film->examine_and_add_content (c);
 
        BOOST_REQUIRE (!wait_for_jobs());
 
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
-       film->make_dcp ();
-       film->write_metadata ();
+       make_and_verify_dcp (film);
 
        BOOST_REQUIRE (!wait_for_jobs());
 }
 
-/** Briefly test Film::cpls().  Requires the output from ffmpeg_dcp_test above */
+
+/** Briefly test Film::cpls() */
 BOOST_AUTO_TEST_CASE (ffmpeg_have_dcp_test, * boost::unit_test::depends_on("ffmpeg_dcp_test"))
 {
-       boost::filesystem::path p = test_film_dir ("ffmpeg_dcp_test");
-       shared_ptr<Film> film (new Film (p));
+       auto p = test_film_dir ("ffmpeg_dcp_test");
+       auto film = make_shared<Film>(p);
        film->read_metadata ();
        BOOST_CHECK (!film->cpls().empty());
 
        p /= film->dcp_name();
-       boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (p);
+       auto i = boost::filesystem::directory_iterator (p);
        while (i != boost::filesystem::directory_iterator() && !boost::algorithm::starts_with (i->path().leaf().string(), "j2c")) {
                ++i;
        }
index aab3fd8ef1c20b2afa2b834b04ec4178ddbea722..4654723b032a0cc9a07f0de2a8d8f1f510e2be96 100644 (file)
@@ -63,14 +63,11 @@ ffmpeg_content_test (int number, boost::filesystem::path content, ExportFormat f
 
        name = String::compose("%1_test%2", name, number);
 
-       shared_ptr<Film> film = new_test_film2 (name, &cl);
-       film->set_name (name);
        auto c = make_shared<FFmpegContent>(content);
+       shared_ptr<Film> film = new_test_film2 (name, {c}, &cl);
+       film->set_name (name);
        film->set_audio_channels (6);
 
-       film->examine_and_add_content (c);
-       BOOST_REQUIRE (!wait_for_jobs ());
-
        film->write_metadata ();
        auto job = make_shared<TranscodeJob>(film);
        auto file = boost::filesystem::path("build") / "test" / String::compose("%1.%2", name, extension);
index 61f1c4848b89f390c98e50af400fff4e5559498e..1fcf98443cefc31507d71d9d4ede655df1571980 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2019-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
-#include "test.h"
-#include "lib/film.h"
-#include "lib/content_factory.h"
+
 #include "lib/content.h"
+#include "lib/content_factory.h"
+#include "lib/film.h"
 #include "lib/video_content.h"
+#include "test.h"
 #include <boost/test/unit_test.hpp>
 
+
 using std::string;
 using std::list;
 using std::shared_ptr;
 
+
 BOOST_AUTO_TEST_CASE (image_content_fade_test)
 {
-       shared_ptr<Film> film = new_test_film2 ("image_content_fade_test");
-       shared_ptr<Content> content = content_factory("test/data/flat_red.png").front();
+       auto film = new_test_film2 ("image_content_fade_test");
+       auto content = content_factory("test/data/flat_red.png").front();
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs());
 
        content->video->set_fade_in (1);
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
 
        check_dcp ("test/data/image_content_fade_test", film->dir(film->dcp_name()));
 }
index 44f3c7d444d7008e98d42284a2204d90cff27758..54cea296baf2bf72f75c51a924c6b20d3894b245 100644 (file)
@@ -111,10 +111,8 @@ BOOST_AUTO_TEST_CASE (import_dcp_markers_test)
        Cleanup cl;
 
        /* Make a DCP with some markers */
-       auto film = new_test_film2 ("import_dcp_markers_test", &cl);
        auto content = content_factory("test/data/flat_red.png").front();
-       film->examine_and_add_content (content);
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto film = new_test_film2 ("import_dcp_markers_test", {content}, &cl);
 
        content->video->set_length (24 * 60 * 10);
 
@@ -126,10 +124,8 @@ BOOST_AUTO_TEST_CASE (import_dcp_markers_test)
        BOOST_REQUIRE (!wait_for_jobs());
 
        /* Import the DCP to a new film and check the markers */
-       auto film2 = new_test_film2 ("import_dcp_markers_test2", &cl);
        auto imported = make_shared<DCPContent>(film->dir(film->dcp_name()));
-       film2->examine_and_add_content (imported);
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto film2 = new_test_film2 ("import_dcp_markers_test2", {imported}, &cl);
        film2->write_metadata ();
 
        /* When import_dcp_markers_test was made a LFOC marker will automatically
@@ -149,7 +145,7 @@ BOOST_AUTO_TEST_CASE (import_dcp_markers_test)
        auto film3 = make_shared<Film>(boost::filesystem::path("build/test/import_dcp_markers_test2"));
        film3->read_metadata ();
        BOOST_REQUIRE_EQUAL (film3->content().size(), 1U);
-       shared_ptr<DCPContent> reloaded = dynamic_pointer_cast<DCPContent>(film3->content().front());
+       auto reloaded = dynamic_pointer_cast<DCPContent>(film3->content().front());
        BOOST_REQUIRE (reloaded);
 
        BOOST_CHECK_EQUAL (reloaded->markers().size(), 4U);
index fb0f37dcf522957876a58fc7838051ddd81f71c5..c58de34711c509a5d4ab4b554683f5abaec14dcf 100644 (file)
@@ -79,10 +79,8 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test)
        film->examine_and_add_content (content_factory("test/data/flat_black.png").front());
        BOOST_REQUIRE (!wait_for_jobs());
        film->set_encrypted (true);
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
-       film->write_metadata ();
-       vector<CPLSummary> cpls = film->cpls ();
+       make_and_verify_dcp (film);
+       auto cpls = film->cpls ();
        BOOST_REQUIRE(cpls.size() == 1);
 
        dcp::LocalTime from (cert.not_before());
@@ -93,8 +91,8 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test)
        string const from_string = from.date() + " " + from.time_of_day(true, false);
        string const until_string = until.date() + " " + until.time_of_day(true, false);
 
-       boost::filesystem::path cpl = cpls.front().cpl_file;
-       KDMWithMetadataPtr kdm = kdm_for_screen (
+       auto cpl = cpls.front().cpl_file;
+       auto kdm = kdm_for_screen (
                        film,
                        cpls.front().cpl_file,
                        cinema_a_screen_1,
@@ -105,11 +103,8 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test)
                        optional<int>()
                        );
 
-       list<KDMWithMetadataPtr> kdms;
-       kdms.push_back (kdm);
-
        write_files (
-               kdms,
+               { kdm },
                boost::filesystem::path("build/test/single_kdm_naming_test"),
                dcp::NameFormat("KDM %c - %s - %f - %b - %e"),
                &confirm_overwrite
@@ -133,15 +128,15 @@ BOOST_AUTO_TEST_CASE (directory_kdm_naming_test, * boost::unit_test::depends_on(
 
        /* Film */
        boost::filesystem::remove_all ("build/test/directory_kdm_naming_test");
-       shared_ptr<Film> film = new_test_film2 ("directory_kdm_naming_test");
+       auto film = new_test_film2 (
+               "directory_kdm_naming_test",
+               { content_factory("test/data/flat_black.png").front() }
+               );
+
        film->set_name ("my_great_film");
-       film->examine_and_add_content (content_factory("test/data/flat_black.png").front());
-       BOOST_REQUIRE (!wait_for_jobs());
        film->set_encrypted (true);
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
-       film->write_metadata ();
-       vector<CPLSummary> cpls = film->cpls ();
+       make_and_verify_dcp (film);
+       auto cpls = film->cpls ();
        BOOST_REQUIRE(cpls.size() == 1);
 
        dcp::LocalTime from (cert.not_before());
@@ -152,18 +147,16 @@ BOOST_AUTO_TEST_CASE (directory_kdm_naming_test, * boost::unit_test::depends_on(
        string const from_string = from.date() + " " + from.time_of_day(true, false);
        string const until_string = until.date() + " " + until.time_of_day(true, false);
 
-       list<shared_ptr<dcpomatic::Screen> > screens;
-       screens.push_back (cinema_a_screen_2);
-       screens.push_back (cinema_b_screen_x);
-       screens.push_back (cinema_a_screen_1);
-       screens.push_back (cinema_b_screen_z);
+       list<shared_ptr<dcpomatic::Screen>> screens = {
+               cinema_a_screen_2, cinema_b_screen_x, cinema_a_screen_1, (cinema_b_screen_z)
+       };
 
-       path const cpl = cpls.front().cpl_file;
-       string const cpl_id = cpls.front().cpl_id;
+       auto const cpl = cpls.front().cpl_file;
+       auto const cpl_id = cpls.front().cpl_id;
 
        list<KDMWithMetadataPtr> kdms;
        for (auto i: screens) {
-               KDMWithMetadataPtr kdm = kdm_for_screen (
+               auto kdm = kdm_for_screen (
                                film,
                                cpls.front().cpl_file,
                                i,
@@ -190,9 +183,9 @@ BOOST_AUTO_TEST_CASE (directory_kdm_naming_test, * boost::unit_test::depends_on(
                &confirm_overwrite
                );
 
-       string from_time = from.time_of_day (true, false);
+       auto from_time = from.time_of_day (true, false);
        boost::algorithm::replace_all (from_time, ":", "-");
-       string until_time = until.time_of_day (true, false);
+       auto until_time = until.time_of_day (true, false);
        boost::algorithm::replace_all (until_time, ":", "-");
 
        path const base = "build/test/directory_kdm_naming_test";
index e64a2162165fdcbacc5a8f60a1e13f566f30f708..3c21675c77ae0cf89e022a521ac05c0ed519904b 100644 (file)
@@ -62,8 +62,7 @@ BOOST_AUTO_TEST_CASE (no_use_video_test1)
        B->set_position (film, dcpomatic::DCPTime());
        A->video->set_use (false);
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
 
        check_dcp ("test/data/no_use_video_test1", film);
 }
@@ -83,8 +82,7 @@ BOOST_AUTO_TEST_CASE (no_use_video_test2)
        B->set_position (film, dcpomatic::DCPTime());
        A->video->set_use (false);
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
 
        check_dcp (TestPaths::private_data() / "no_use_video_test2", film);
 }
@@ -101,8 +99,7 @@ BOOST_AUTO_TEST_CASE (no_use_video_test3)
        ov_a->examine_and_add_content (ov_a_pic);
        ov_a->examine_and_add_content (ov_a_snd);
        BOOST_REQUIRE (!wait_for_jobs());
-       ov_a->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (ov_a);
 
        auto ov_b = new_test_film2("no_use_video_test3_ov_b");
        auto ov_b_pic = content_factory("test/data/flat_green.png").front();
@@ -112,8 +109,7 @@ BOOST_AUTO_TEST_CASE (no_use_video_test3)
        ov_b->examine_and_add_content (ov_b_pic);
        ov_b->examine_and_add_content (ov_b_snd);
        BOOST_REQUIRE (!wait_for_jobs());
-       ov_b->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (ov_b);
 
        auto vf = new_test_film2 ("no_use_video_test3_vf");
        auto A = make_shared<DCPContent>(ov_a->dir(ov_a->dcp_name()));
@@ -132,8 +128,7 @@ BOOST_AUTO_TEST_CASE (no_use_video_test3)
        A->set_reference_audio (true);
        B->set_reference_video (true);
 
-       vf->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
 
        dcp::DCP ov_a_check (ov_a->dir(ov_a->dcp_name()));
        ov_a_check.read ();
index bdbd6f273de0409482c7335c48d7378a4b9b9d60..164bf2322b4cb73cc721f07dfd15ab08244ec089 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 /** @file  test/recover_test.cc
  *  @brief Test recovery of a DCP transcode after a crash.
  *  @ingroup feature
  */
 
+
 #include "test.h"
 #include "lib/film.h"
 #include "lib/dcp_content_type.h"
@@ -35,6 +37,7 @@
 #include <boost/test/unit_test.hpp>
 #include <iostream>
 
+
 using std::cout;
 using std::make_shared;
 using std::shared_ptr;
@@ -43,6 +46,7 @@ using std::string;
 using namespace boost::placeholders;
 #endif
 
+
 static void
 note (dcp::NoteType t, string n)
 {
@@ -51,6 +55,7 @@ note (dcp::NoteType t, string n)
        }
 }
 
+
 BOOST_AUTO_TEST_CASE (recover_test_2d)
 {
        shared_ptr<Film> film = new_test_film ("recover_test_2d");
@@ -74,8 +79,7 @@ BOOST_AUTO_TEST_CASE (recover_test_2d)
 
        boost::filesystem::resize_file (video, 2 * 1024 * 1024);
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE });
 
        shared_ptr<dcp::MonoPictureAsset> A (new dcp::MonoPictureAsset ("build/test/recover_test_2d/original.mxf"));
        shared_ptr<dcp::MonoPictureAsset> B (new dcp::MonoPictureAsset (video));
@@ -84,6 +88,7 @@ BOOST_AUTO_TEST_CASE (recover_test_2d)
        BOOST_CHECK (A->equals (B, eq, boost::bind (&note, _1, _2)));
 }
 
+
 BOOST_AUTO_TEST_CASE (recover_test_3d, * boost::unit_test::depends_on("recover_test_2d"))
 {
        auto film = new_test_film ("recover_test_3d");
@@ -98,8 +103,7 @@ BOOST_AUTO_TEST_CASE (recover_test_3d, * boost::unit_test::depends_on("recover_t
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs());
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE });
 
        boost::filesystem::path const video = "build/test/recover_test_3d/video/185_2K_70e6661af92ae94458784c16a21a9748_24_100000000_P_S_3D_0_96000.mxf";
 
@@ -110,8 +114,7 @@ BOOST_AUTO_TEST_CASE (recover_test_3d, * boost::unit_test::depends_on("recover_t
 
        boost::filesystem::resize_file (video, 2 * 1024 * 1024);
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE });
 
        auto A = make_shared<dcp::StereoPictureAsset>("build/test/recover_test_3d/original.mxf");
        auto B = make_shared<dcp::StereoPictureAsset>(video);
@@ -135,8 +138,7 @@ BOOST_AUTO_TEST_CASE (recover_test_2d_encrypted, * boost::unit_test::depends_on(
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs());
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE });
 
        boost::filesystem::path const video =
                "build/test/recover_test_2d_encrypted/video/185_2K_02543352c540f4b083bff3f1e309d4a9_24_100000000_Eeafcb91c9f5472edf01f3a2404c57258_S_0_1200000.mxf";
@@ -148,8 +150,7 @@ BOOST_AUTO_TEST_CASE (recover_test_2d_encrypted, * boost::unit_test::depends_on(
 
        boost::filesystem::resize_file (video, 2 * 1024 * 1024);
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE });
 
        auto A = make_shared<dcp::MonoPictureAsset>("build/test/recover_test_2d_encrypted/original.mxf");
        A->set_key (film->key ());
index 9e567fb2a2714663dcd8cc3334e5d80f4808000d..6fa571500c2c5d5d9d1b067d324e9b6a4e3ecacd 100644 (file)
@@ -110,8 +110,7 @@ BOOST_AUTO_TEST_CASE (reel_reuse_video_test)
        auto audio = content_factory("test/data/white.wav").front();
        film->examine_and_add_content (audio);
        BOOST_REQUIRE (!wait_for_jobs());
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
 
        /* Find main picture and sound asset IDs */
        dcp::DCP dcp1 (film->dir(film->dcp_name()));
@@ -125,8 +124,7 @@ BOOST_AUTO_TEST_CASE (reel_reuse_video_test)
 
        /* Change the audio and re-make */
        audio->audio->set_gain (-3);
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
 
        /* Video ID should be the same, sound different */
        dcp::DCP dcp2 (film->dir(film->dcp_name()));
@@ -140,8 +138,7 @@ BOOST_AUTO_TEST_CASE (reel_reuse_video_test)
 
        /* Crop video and re-make */
        video->video->set_left_crop (5);
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
 
        /* Video and sound IDs should be different */
        dcp::DCP dcp3 (film->dir(film->dcp_name()));
index 4020053395f6649aeb8337665383605b72e16aeb..47ead7e125ecfba620d72c5bad40fe6b7389d2f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2015-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 /** @file  test/reels_test.cc
  *  @brief Check manipulation of reels in various ways.
  *  @ingroup feature
  */
 
+
 #include "lib/film.h"
 #include "lib/ratio.h"
 #include "lib/ffmpeg_content.h"
@@ -36,6 +38,7 @@
 #include <boost/test/unit_test.hpp>
 #include <iostream>
 
+
 using std::list;
 using std::cout;
 using std::vector;
@@ -45,6 +48,7 @@ using std::make_shared;
 using boost::function;
 using namespace dcpomatic;
 
+
 /** Test Film::reels() */
 BOOST_AUTO_TEST_CASE (reels_test1)
 {
@@ -88,6 +92,7 @@ BOOST_AUTO_TEST_CASE (reels_test1)
        BOOST_CHECK_EQUAL (i->to.get(), DCPTime::from_frames(144, 24).get());
 }
 
+
 /** Make a short DCP with multi reels split by video content, then import
  *  this into a new project and make a new DCP referencing it.
  */
@@ -124,20 +129,13 @@ BOOST_AUTO_TEST_CASE (reels_test2)
        BOOST_CHECK_EQUAL (film->reels().size(), 3U);
        BOOST_REQUIRE (!wait_for_jobs());
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
 
        check_dcp ("test/data/reels_test2", film->dir (film->dcp_name()));
 
-       shared_ptr<Film> film2 = new_test_film ("reels_test2b");
-       film2->set_name ("reels_test2b");
-       film2->set_container (Ratio::from_id ("185"));
-       film2->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
-       film2->set_reel_type (ReelType::BY_VIDEO_CONTENT);
-
        auto c = make_shared<DCPContent>(film->dir(film->dcp_name()));
-       film2->examine_and_add_content (c);
-       BOOST_REQUIRE (!wait_for_jobs ());
+       auto film2 = new_test_film2 ("reels_test2b", {c});
+       film2->set_reel_type (ReelType::BY_VIDEO_CONTENT);
 
        auto r = film2->reels ();
        BOOST_CHECK_EQUAL (r.size(), 3U);
@@ -154,26 +152,19 @@ BOOST_AUTO_TEST_CASE (reels_test2)
        c->set_reference_video (true);
        c->set_reference_audio (true);
 
-       film2->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film2, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
 }
 
+
 /** Check that ReelType::BY_VIDEO_CONTENT adds an extra reel, if necessary, at the end
  *  of all the video content to mop up anything afterward.
  */
 BOOST_AUTO_TEST_CASE (reels_test3)
 {
-       auto film = new_test_film ("reels_test3");
-       film->set_name ("reels_test3");
-       film->set_container (Ratio::from_id ("185"));
-       film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
-       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
-
        auto dcp = make_shared<DCPContent>("test/data/reels_test2");
-       film->examine_and_add_content (dcp);
        auto sub = make_shared<StringTextFileContent>("test/data/subrip.srt");
-       film->examine_and_add_content (sub);
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto film = new_test_film2 ("reels_test3", {dcp, sub});
+       film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
 
        auto reels = film->reels();
        BOOST_REQUIRE_EQUAL (reels.size(), 4U);
@@ -191,15 +182,13 @@ BOOST_AUTO_TEST_CASE (reels_test3)
        BOOST_CHECK_EQUAL (i->to.get(), sub->full_length(film).ceil(film->video_frame_rate()).get());
 }
 
+
 /** Check creation of a multi-reel DCP with a single .srt subtitle file;
  *  make sure that the reel subtitle timing is done right.
  */
 BOOST_AUTO_TEST_CASE (reels_test4)
 {
-       auto film = new_test_film ("reels_test4");
-       film->set_name ("reels_test4");
-       film->set_container (Ratio::from_id ("185"));
-       film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
+       auto film = new_test_film2 ("reels_test4");
        film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        film->set_interop (false);
 
@@ -212,7 +201,7 @@ BOOST_AUTO_TEST_CASE (reels_test4)
                content[i]->video->set_length (24);
        }
 
-       shared_ptr<StringTextFileContent> subs (new StringTextFileContent("test/data/subrip3.srt"));
+       auto subs = make_shared<StringTextFileContent>("test/data/subrip3.srt");
        film->examine_and_add_content (subs);
        BOOST_REQUIRE (!wait_for_jobs());
 
@@ -231,19 +220,23 @@ BOOST_AUTO_TEST_CASE (reels_test4)
        BOOST_CHECK_EQUAL (i->from.get(), 96000 * 3);
        BOOST_CHECK_EQUAL (i->to.get(), 96000 * 4);
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (
+               film,
+               {
+                       dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+                       dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+                       dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION
+               });
 
        check_dcp ("test/data/reels_test4", film->dir (film->dcp_name()));
 }
 
+
 BOOST_AUTO_TEST_CASE (reels_test5)
 {
-       auto film = new_test_film ("reels_test5");
+       auto dcp = make_shared<DCPContent>("test/data/reels_test4");
+       auto film = new_test_film2 ("reels_test5", {dcp});
        film->set_sequence (false);
-       shared_ptr<DCPContent> dcp (new DCPContent("test/data/reels_test4"));
-       film->examine_and_add_content (dcp);
-       BOOST_REQUIRE (!wait_for_jobs ());
 
        /* Set to 2123 but it will be rounded up to the next frame (4000) */
        dcp->set_position(film, DCPTime(2123));
@@ -291,40 +284,34 @@ BOOST_AUTO_TEST_CASE (reels_test5)
        }
 }
 
+
 /** Check reel split with a muxed video/audio source */
 BOOST_AUTO_TEST_CASE (reels_test6)
 {
-       auto film = new_test_film ("reels_test6");
-       film->set_name ("reels_test6");
-       film->set_container (Ratio::from_id ("185"));
-       film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
-       shared_ptr<FFmpegContent> A (new FFmpegContent("test/data/test2.mp4"));
-       film->examine_and_add_content (A);
-       BOOST_REQUIRE (!wait_for_jobs ());
+       auto A = make_shared<FFmpegContent>("test/data/test2.mp4");
+       auto film = new_test_film2 ("reels_test6", {A});
 
        film->set_j2k_bandwidth (100000000);
        film->set_reel_type (ReelType::BY_LENGTH);
        /* This is just over 2.5s at 100Mbit/s; should correspond to 60 frames */
        film->set_reel_length (31253154);
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs ());
+       make_and_verify_dcp (
+               film,
+               {
+                       dcp::VerificationNote::Code::INVALID_INTRINSIC_DURATION,
+                       dcp::VerificationNote::Code::INVALID_DURATION,
+               });
 }
 
+
 /** Check the case where the last bit of audio hangs over the end of the video
  *  and we are using ReelType::BY_VIDEO_CONTENT.
  */
 BOOST_AUTO_TEST_CASE (reels_test7)
 {
-       auto film = new_test_film ("reels_test7");
-       film->set_name ("reels_test7");
-       film->set_container (Ratio::from_id ("185"));
-       film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
        auto A = content_factory("test/data/flat_red.png").front();
-       film->examine_and_add_content (A);
-       BOOST_REQUIRE (!wait_for_jobs ());
        auto B = content_factory("test/data/awkward_length.wav").front();
-       film->examine_and_add_content (B);
-       BOOST_REQUIRE (!wait_for_jobs ());
+       auto film = new_test_film2 ("reels_test7", { A, B });
        film->set_video_frame_rate (24);
        A->video->set_length (2 * 24);
 
@@ -333,51 +320,45 @@ BOOST_AUTO_TEST_CASE (reels_test7)
        BOOST_CHECK (film->reels().front() == DCPTimePeriod(DCPTime(0), DCPTime::from_frames(2 * 24, 24)));
        BOOST_CHECK (film->reels().back() == DCPTimePeriod(DCPTime::from_frames(2 * 24, 24), DCPTime::from_frames(3 * 24 + 1, 24)));
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs ());
+       make_and_verify_dcp (film);
 }
 
+
 /** Check a reels-related error; make_dcp() would raise a ProgrammingError */
 BOOST_AUTO_TEST_CASE (reels_test8)
 {
-       shared_ptr<Film> film = new_test_film ("reels_test8");
-       film->set_name ("reels_test8");
-       film->set_container (Ratio::from_id ("185"));
-       film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
        auto A = make_shared<FFmpegContent>("test/data/test2.mp4");
-       film->examine_and_add_content (A);
-       BOOST_REQUIRE (!wait_for_jobs ());
+       auto film = new_test_film2 ("reels_test8", {A});
 
        A->set_trim_end (ContentTime::from_seconds (1));
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs ());
+       make_and_verify_dcp (film);
 }
 
+
 /** Check another reels-related error; make_dcp() would raise a ProgrammingError */
 BOOST_AUTO_TEST_CASE (reels_test9)
 {
-       shared_ptr<Film> film = new_test_film2("reels_test9a");
-       shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
-       film->examine_and_add_content(A);
-       BOOST_REQUIRE(!wait_for_jobs());
+       auto A = make_shared<FFmpegContent>("test/data/flat_red.png");
+       auto film = new_test_film2("reels_test9a", {A});
        A->video->set_length(5 * 24);
        film->set_video_frame_rate(24);
-       film->make_dcp();
-       BOOST_REQUIRE(!wait_for_jobs());
+       make_and_verify_dcp (film);
 
-       shared_ptr<Film> film2 = new_test_film2("reels_test9b");
-       shared_ptr<DCPContent> B(new DCPContent(film->dir(film->dcp_name())));
-       film2->examine_and_add_content(B);
-       film2->examine_and_add_content(content_factory("test/data/dcp_sub4.xml").front());
+       auto B = make_shared<DCPContent>(film->dir(film->dcp_name()));
+       auto film2 = new_test_film2("reels_test9b", {B, content_factory("test/data/dcp_sub4.xml").front()});
        B->set_reference_video(true);
        B->set_reference_audio(true);
-       BOOST_REQUIRE(!wait_for_jobs());
        film2->set_reel_type(ReelType::BY_VIDEO_CONTENT);
        film2->write_metadata();
-       film2->make_dcp();
-       BOOST_REQUIRE(!wait_for_jobs());
+       make_and_verify_dcp (
+               film2,
+               {
+                       dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+                       dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME
+               });
 }
 
+
 /** Another reels-related error; make_dcp() would raise a ProgrammingError
  *  in AudioBuffers::allocate due to an attempt to allocate a negatively-sized buffer.
  *  This was triggered by a VF where there are referenced audio reels followed by
@@ -387,58 +368,50 @@ BOOST_AUTO_TEST_CASE (reels_test9)
 BOOST_AUTO_TEST_CASE (reels_test10)
 {
        /* Make the OV */
-       shared_ptr<Film> ov = new_test_film2("reels_test10_ov");
-       shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
-       ov->examine_and_add_content (A);
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto A = make_shared<FFmpegContent>("test/data/flat_red.png");
+       auto B = make_shared<FFmpegContent>("test/data/flat_red.png");
+       auto ov = new_test_film2("reels_test10_ov", {A, B});
        A->video->set_length (5 * 24);
-
-       shared_ptr<FFmpegContent> B(new FFmpegContent("test/data/flat_red.png"));
-       ov->examine_and_add_content (B);
-       BOOST_REQUIRE (!wait_for_jobs());
        B->video->set_length (5 * 24);
 
        ov->set_reel_type (ReelType::BY_VIDEO_CONTENT);
-       ov->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (ov);
        ov->write_metadata ();
 
        /* Now try to make the VF; this used to fail */
-       shared_ptr<Film> vf = new_test_film2("reels_test10_vf");
-       shared_ptr<DCPContent> ov_dcp(new DCPContent(ov->dir(ov->dcp_name())));
-       vf->examine_and_add_content (ov_dcp);
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
+       auto vf = new_test_film2("reels_test10_vf", {ov_dcp, content_factory("test/data/15s.srt").front()});
        vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        ov_dcp->set_reference_video (true);
        ov_dcp->set_reference_audio (true);
-       vf->examine_and_add_content (content_factory("test/data/15s.srt").front());
-       BOOST_REQUIRE (!wait_for_jobs());
 
-       vf->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
-       vf->write_metadata ();
+       make_and_verify_dcp (
+               vf,
+               {
+                       dcp::VerificationNote::Code::EXTERNAL_ASSET,
+                       dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+                       dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME
+               });
 }
 
+
 /** Another reels error; ReelType::BY_VIDEO_CONTENT when the first content is not
  *  at time 0.
  */
 BOOST_AUTO_TEST_CASE (reels_test11)
 {
-       shared_ptr<Film> film = new_test_film2 ("reels_test11");
+       auto A = make_shared<FFmpegContent>("test/data/flat_red.png");
+       auto film = new_test_film2 ("reels_test11", {A});
        film->set_video_frame_rate (24);
-       shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
-       film->examine_and_add_content (A);
-       BOOST_REQUIRE (!wait_for_jobs());
        A->video->set_length (240);
        A->set_video_frame_rate (24);
        A->set_position (film, DCPTime::from_seconds(1));
        film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
        BOOST_CHECK_EQUAL (A->position().get(), DCPTime::from_seconds(1).get());
        BOOST_CHECK_EQUAL (A->end(film).get(), DCPTime::from_seconds(1 + 10).get());
 
-       list<DCPTimePeriod> r = film->reels ();
+       auto r = film->reels ();
        BOOST_CHECK_EQUAL (r.size(), 2U);
        BOOST_CHECK_EQUAL (r.front().from.get(), 0);
        BOOST_CHECK_EQUAL (r.front().to.get(), DCPTime::from_seconds(1).get());
@@ -446,33 +419,30 @@ BOOST_AUTO_TEST_CASE (reels_test11)
        BOOST_CHECK_EQUAL (r.back().to.get(), DCPTime::from_seconds(1 + 10).get());
 }
 
+
 /** For VFs to work right we have to make separate reels for empty bits between
  *  video content.
  */
 BOOST_AUTO_TEST_CASE (reels_test12)
 {
-       shared_ptr<Film> film = new_test_film2 ("reels_test12");
+       auto A = make_shared<FFmpegContent>("test/data/flat_red.png");
+       auto B = make_shared<FFmpegContent>("test/data/flat_red.png");
+       auto film = new_test_film2 ("reels_test12", {A, B});
        film->set_video_frame_rate (24);
        film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        film->set_sequence (false);
 
-       shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
-       film->examine_and_add_content (A);
-       BOOST_REQUIRE (!wait_for_jobs());
        A->video->set_length (240);
        A->set_video_frame_rate (24);
        A->set_position (film, DCPTime::from_seconds(1));
 
-       shared_ptr<FFmpegContent> B(new FFmpegContent("test/data/flat_red.png"));
-       film->examine_and_add_content (B);
-       BOOST_REQUIRE (!wait_for_jobs());
        B->video->set_length (120);
        B->set_video_frame_rate (24);
        B->set_position (film, DCPTime::from_seconds(14));
 
-       list<DCPTimePeriod> r = film->reels ();
+       auto r = film->reels ();
        BOOST_REQUIRE_EQUAL (r.size(), 4U);
-       list<DCPTimePeriod>::const_iterator i = r.begin ();
+       auto i = r.begin ();
 
        BOOST_CHECK_EQUAL (i->from.get(), 0);
        BOOST_CHECK_EQUAL (i->to.get(),   DCPTime::from_seconds(1).get());
@@ -487,6 +457,7 @@ BOOST_AUTO_TEST_CASE (reels_test12)
        BOOST_CHECK_EQUAL (i->to.get(),   DCPTime::from_seconds(19).get());
 }
 
+
 static void
 no_op ()
 {
@@ -507,109 +478,95 @@ dump_notes (vector<dcp::VerificationNote> const & notes)
  */
 BOOST_AUTO_TEST_CASE (reels_should_not_be_short1)
 {
-       shared_ptr<Film> film = new_test_film2 ("reels_should_not_be_short1");
+       auto A = make_shared<FFmpegContent>("test/data/flat_red.png");
+       auto B = make_shared<FFmpegContent>("test/data/flat_red.png");
+       auto film = new_test_film2 ("reels_should_not_be_short1", {A, B});
        film->set_video_frame_rate (24);
 
-       shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
-       film->examine_and_add_content (A);
-       BOOST_REQUIRE (!wait_for_jobs());
        A->video->set_length (23);
 
-       shared_ptr<FFmpegContent> B(new FFmpegContent("test/data/flat_red.png"));
-       film->examine_and_add_content (B);
-       BOOST_REQUIRE (!wait_for_jobs());
        B->video->set_length (23);
        B->set_position (film, DCPTime::from_frames(23, 24));
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
 
-       vector<boost::filesystem::path> dirs;
-       dirs.push_back (film->dir(film->dcp_name(false)));
+       vector<boost::filesystem::path> dirs = { film->dir(film->dcp_name(false)) };
        auto notes = dcp::verify(dirs, boost::bind(&no_op), boost::bind(&no_op), TestPaths::xsd());
        dump_notes (notes);
        BOOST_REQUIRE (notes.empty());
 }
 
+
 /** Leaving less than 1 second's gap between two pieces of content with
  *  ReelType::BY_VIDEO_CONTENT should not make a <1s reel.
  */
 BOOST_AUTO_TEST_CASE (reels_should_not_be_short2)
 {
-       shared_ptr<Film> film = new_test_film2 ("reels_should_not_be_short2");
+       auto A = make_shared<FFmpegContent>("test/data/flat_red.png");
+       auto B = make_shared<FFmpegContent>("test/data/flat_red.png");
+       auto film = new_test_film2 ("reels_should_not_be_short2", {A, B});
        film->set_video_frame_rate (24);
        film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
 
-       shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
-       film->examine_and_add_content (A);
-       BOOST_REQUIRE (!wait_for_jobs());
        A->video->set_length (240);
 
-       shared_ptr<FFmpegContent> B(new FFmpegContent("test/data/flat_red.png"));
-       film->examine_and_add_content (B);
-       BOOST_REQUIRE (!wait_for_jobs());
        B->video->set_length (240);
        B->set_position (film, DCPTime::from_seconds(10.2));
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
 
-       vector<boost::filesystem::path> dirs;
-       dirs.push_back (film->dir(film->dcp_name(false)));
+       vector<boost::filesystem::path> dirs = { film->dir(film->dcp_name(false)) };
        auto const notes = dcp::verify(dirs, boost::bind(&no_op), boost::bind(&no_op), TestPaths::xsd());
        dump_notes (notes);
        BOOST_REQUIRE (notes.empty());
 }
 
+
 /** Setting ReelType::BY_LENGTH and using a small length value should not make
  *  <1s reels.
  */
 BOOST_AUTO_TEST_CASE (reels_should_not_be_short3)
 {
-       shared_ptr<Film> film = new_test_film2 ("reels_should_not_be_short3");
+       auto A = make_shared<FFmpegContent>("test/data/flat_red.png");
+       auto film = new_test_film2 ("reels_should_not_be_short3", {A});
        film->set_video_frame_rate (24);
        film->set_reel_type (ReelType::BY_LENGTH);
        film->set_reel_length (1024 * 1024 * 10);
 
-       shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
-       film->examine_and_add_content (A);
-       BOOST_REQUIRE (!wait_for_jobs());
        A->video->set_length (240);
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
 
-       vector<boost::filesystem::path> dirs;
-       auto const notes = dcp::verify(dirs, boost::bind(&no_op), boost::bind(&no_op), TestPaths::xsd());
+       auto const notes = dcp::verify({}, boost::bind(&no_op), boost::bind(&no_op), TestPaths::xsd());
        dump_notes (notes);
        BOOST_REQUIRE (notes.empty());
 }
 
+
 /** Having one piece of content less than 1s long in ReelType::BY_VIDEO_CONTENT
  *  should not make a reel less than 1s long.
  */
 BOOST_AUTO_TEST_CASE (reels_should_not_be_short4)
 {
-       shared_ptr<Film> film = new_test_film2 ("reels_should_not_be_short4");
+       auto A = make_shared<FFmpegContent>("test/data/flat_red.png");
+       auto B = make_shared<FFmpegContent>("test/data/flat_red.png");
+       auto film = new_test_film2 ("reels_should_not_be_short4", {A, B});
        film->set_video_frame_rate (24);
        film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
 
-       shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
-       film->examine_and_add_content (A);
-       BOOST_REQUIRE (!wait_for_jobs());
        A->video->set_length (240);
 
-       shared_ptr<FFmpegContent> B(new FFmpegContent("test/data/flat_red.png"));
-       film->examine_and_add_content (B);
-       BOOST_REQUIRE (!wait_for_jobs());
        B->video->set_length (23);
        B->set_position (film, DCPTime::from_frames(240, 24));
 
+       BOOST_CHECK_EQUAL (film->reels().size(), 1U);
+       BOOST_CHECK (film->reels().front() == dcpomatic::DCPTimePeriod(dcpomatic::DCPTime(), dcpomatic::DCPTime::from_frames(263, 24)));
+
+       film->write_metadata ();
        film->make_dcp ();
        BOOST_REQUIRE (!wait_for_jobs());
 
-       vector<boost::filesystem::path> dirs;
-       dirs.push_back (film->dir(film->dcp_name(false)));
+       vector<boost::filesystem::path> dirs = { film->dir(film->dcp_name(false)) };
        auto const notes = dcp::verify(dirs, boost::bind(&no_op), boost::bind(&no_op), TestPaths::xsd());
        dump_notes (notes);
        BOOST_REQUIRE (notes.empty());
index fbbaba3f152c7158e71940d43d31dcc1a5a4b785..b43312e59bbbc9c208eea3d97107b2071ed3296a 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
+
 /** @file  test/repeat_frame_test.cc
  *  @brief Test the repeat of frames by the player when putting a 24fps
  *  source into a 48fps DCP.
@@ -26,6 +27,7 @@
  *  @see test/skip_frame_test.cc
  */
 
+
 #include <boost/test/unit_test.hpp>
 #include "test.h"
 #include "lib/film.h"
 #include "lib/dcp_content_type.h"
 #include "lib/video_content.h"
 
+
+using std::make_shared;
 using std::shared_ptr;
 
+
 BOOST_AUTO_TEST_CASE (repeat_frame_test)
 {
-       shared_ptr<Film> film = new_test_film ("repeat_frame_test");
-       film->set_name ("repeat_frame_test");
-       film->set_container (Ratio::from_id ("185"));
-       film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
+       auto c = make_shared<FFmpegContent>("test/data/red_24.mp4");
+       auto film = new_test_film2 ("repeat_frame_test", {c});
        film->set_interop (false);
-       shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/red_24.mp4"));
-       film->examine_and_add_content (c);
-       BOOST_REQUIRE (!wait_for_jobs());
        c->video->set_custom_ratio (1.85);
 
        film->set_video_frame_rate (48);
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
 
        /* Should be 32 frames of red followed by 16 frames of black to fill the DCP up to 1 second */
        check_dcp ("test/data/repeat_frame_test", film->dir (film->dcp_name ()));
index d3382f30a3d2401d1fbdc9565ab547530cbd4a3d..328f9bef74bc4bdce99d40428abb1ae25b1909af 100644 (file)
@@ -46,18 +46,15 @@ static void
 test_silence_padding (int channels)
 {
        string const film_name = "silence_padding_test_" + lexical_cast<string> (channels);
-       auto film = new_test_film (film_name);
-       film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
-       film->set_container (Ratio::from_id ("185"));
-       film->set_name (film_name);
-
-       auto content = make_shared<FFmpegContent>("test/data/staircase.wav");
-       film->examine_and_add_content (content);
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto film = new_test_film2 (
+               film_name,
+               {
+                       make_shared<FFmpegContent>("test/data/flat_red.png"),
+                       make_shared<FFmpegContent>("test/data/staircase.wav")
+               });
 
        film->set_audio_channels (channels);
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
 
        boost::filesystem::path path = "build/test";
        path /= film_name;
@@ -138,16 +135,13 @@ BOOST_AUTO_TEST_CASE (silence_padding_test2)
 {
        Cleanup cl;
 
-       auto film = new_test_film2 ("silence_padding_test2", &cl);
        auto content = make_shared<FFmpegContent>(TestPaths::private_data() / "cars.mov");
-       film->examine_and_add_content (content);
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto film = new_test_film2 ("silence_padding_test2", { content }, &cl);
 
        film->set_video_frame_rate (24);
        content->set_trim_start (dcpomatic::ContentTime(4003));
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
 
        cl.run ();
 }
index 3fe9bc2d20792f5f29ba5089e3b3a9d369523864..1d8fb89daef13f0c40a01a86d007b99e073b9562 100644 (file)
@@ -100,21 +100,17 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test3)
 {
        Cleanup cl;
 
-       shared_ptr<Film> film = new_test_film2 ("srt_subtitle_test3", &cl);
+       shared_ptr<StringTextFileContent> content (new StringTextFileContent(TestPaths::private_data() / "Ankoemmling_short.srt"));
+       shared_ptr<Film> film = new_test_film2 ("srt_subtitle_test3", { content }, &cl);
 
-       film->set_container (Ratio::from_id ("185"));
        film->set_name ("frobozz");
        film->set_interop (true);
        film->set_audio_channels (6);
-       shared_ptr<StringTextFileContent> content (new StringTextFileContent(TestPaths::private_data() / "Ankoemmling_short.srt"));
-       film->examine_and_add_content (content);
-       BOOST_REQUIRE (!wait_for_jobs());
 
        content->only_text()->set_use (true);
        content->only_text()->set_burn (false);
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film, {dcp::VerificationNote::Code::INVALID_STANDARD});
 
        check_subtitle_file (film, TestPaths::private_data() / "Ankoemmling_short.xml");
 
index c7e4c39a6e038341ea4e9cd4fa85f0957b1a894e..5c2e61b7e41d74602209432e0f6e9017d6fdf33b 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 /** @file  test/ssa_subtitle_test.cc
  *  @brief Test use of SSA subtitle files.
  *  @ingroup feature
  */
 
+
 #include "lib/film.h"
 #include "lib/string_text_file_content.h"
 #include "lib/dcp_content_type.h"
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 #include <boost/algorithm/string.hpp>
-#include <list>
+
 
 using std::string;
 using std::list;
 using std::shared_ptr;
+using std::make_shared;
+
 
 /** Make a DCP with subs from a .ssa file */
 BOOST_AUTO_TEST_CASE (ssa_subtitle_test1)
 {
        Cleanup cl;
 
-       shared_ptr<Film> film = new_test_film2 ("ssa_subtitle_test1", &cl);
+       auto film = new_test_film2 ("ssa_subtitle_test1", {}, &cl);
 
        film->set_container (Ratio::from_id ("185"));
        film->set_name ("frobozz");
        film->set_interop (true);
-       shared_ptr<StringTextFileContent> content (new StringTextFileContent(TestPaths::private_data() / "DKH_UT_EN20160601def.ssa"));
+       auto content = make_shared<StringTextFileContent>(TestPaths::private_data() / "DKH_UT_EN20160601def.ssa");
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs());
 
        content->only_text()->set_use (true);
        content->only_text()->set_burn (false);
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film, { dcp::VerificationNote::Code::INVALID_STANDARD });
 
        /* Find the subtitle file and check it */
-       list<string> ignore;
-       ignore.push_back ("SubtitleID");
-       check_xml (subtitle_file(film), TestPaths::private_data() / "DKH_UT_EN20160601def.xml", ignore);
+       check_xml (subtitle_file(film), TestPaths::private_data() / "DKH_UT_EN20160601def.xml", {"SubtitleID"});
 
        cl.run ();
 }
index 28c278c9424ef9715d67286707dc1790ba9ccfa4..f43a3721ca0da340a7c67ee190e0ef809dffe43d 100644 (file)
@@ -39,18 +39,15 @@ using std::shared_ptr;
 BOOST_AUTO_TEST_CASE (subtitle_language_interop_test)
 {
        string const name = "subtitle_language_interop_test";
-       shared_ptr<Film> film = new_test_film2 (name);
-       film->examine_and_add_content (content_factory("test/data/frames.srt").front());
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto film = new_test_film2 (name, { content_factory("test/data/frames.srt").front() });
 
-       vector<dcp::LanguageTag> langs;
-       langs.push_back(dcp::LanguageTag("fr-FR"));
-       langs.push_back(dcp::LanguageTag("de-DE"));
+       vector<dcp::LanguageTag> langs = {
+               dcp::LanguageTag("fr-FR"), dcp::LanguageTag("de-DE")
+       };
        film->set_subtitle_languages(langs);
        film->set_interop (true);
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film, {dcp::VerificationNote::Code::INVALID_STANDARD});
 
        check_dcp (String::compose("test/data/%1", name), String::compose("build/test/%1/%2", name, film->dcp_name()));
 }
@@ -59,18 +56,23 @@ BOOST_AUTO_TEST_CASE (subtitle_language_interop_test)
 BOOST_AUTO_TEST_CASE (subtitle_language_smpte_test)
 {
        string const name = "subtitle_language_smpte_test";
-       shared_ptr<Film> film = new_test_film2 (name);
-       film->examine_and_add_content (content_factory("test/data/frames.srt").front());
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto film = new_test_film2 (name, { content_factory("test/data/frames.srt").front() });
 
-       vector<dcp::LanguageTag> langs;
-       langs.push_back(dcp::LanguageTag("fr-FR"));
-       langs.push_back(dcp::LanguageTag("de-DE"));
-       film->set_subtitle_languages(langs);
+       vector<dcp::LanguageTag> langs = {
+               dcp::LanguageTag("fr-FR"), dcp::LanguageTag("de-DE")
+       };
+       film->set_subtitle_languages (langs);
        film->set_interop (false);
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (
+               film,
+               {
+                       dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+                       dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+                       dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION,
+                       dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING,
+                       dcp::VerificationNote::Code::MISSING_CPL_METADATA
+               });
 
        check_dcp (String::compose("test/data/%1", name), String::compose("build/test/%1/%2", name, film->dcp_name()));
 }
index 292b4e1d9436b60365c6ad5e604a512f52cc108e..eba0fc49055cb8747edc5de568a1b46f9dd0fe6d 100644 (file)
@@ -176,7 +176,7 @@ new_test_film (string name)
 }
 
 shared_ptr<Film>
-new_test_film2 (string name, Cleanup* cleanup)
+new_test_film2 (string name, vector<shared_ptr<Content>> content, Cleanup* cleanup)
 {
        auto p = test_film_dir (name);
        if (boost::filesystem::exists (p)) {
@@ -190,6 +190,12 @@ new_test_film2 (string name, Cleanup* cleanup)
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
        film->set_container (Ratio::from_id ("185"));
        film->write_metadata ();
+
+       for (auto i: content) {
+               film->examine_and_add_content (i);
+               BOOST_REQUIRE (!wait_for_jobs());
+       }
+
        return film;
 }
 
@@ -830,3 +836,26 @@ Cleanup::run ()
                boost::filesystem::remove_all (i, ec);
        }
 }
+
+
+void stage (string, boost::optional<boost::filesystem::path>) {}
+void progress (float) {}
+
+
+void
+make_and_verify_dcp (shared_ptr<Film> film, vector<dcp::VerificationNote::Code> ignore)
+{
+       film->write_metadata ();
+       film->make_dcp ();
+       BOOST_REQUIRE (!wait_for_jobs());
+       auto notes = dcp::verify ({film->dir(film->dcp_name())}, &stage, &progress, TestPaths::xsd());
+       bool ok = true;
+       for (auto i: notes) {
+               if (find(ignore.begin(), ignore.end(), i.code()) == ignore.end()) {
+                       std::cout << "\t" << dcp::note_to_string(i) << "\n";
+                       ok = false;
+               }
+       }
+       BOOST_CHECK(ok);
+}
+
index 5a2246894992da9cfa71d0f6b9e575a24f8b8969..a4b6bedd1a503aedf1a5ec024125b13aa2c01d22 100644 (file)
@@ -21,7 +21,9 @@
 
 #include "lib/warnings.h"
 #include "lib/types.h"
+#include <dcp/verify.h>
 #include <boost/filesystem.hpp>
+#include <vector>
 
 
 class Film;
@@ -56,7 +58,7 @@ private:
 extern bool wait_for_jobs ();
 extern void setup_test_config ();
 extern std::shared_ptr<Film> new_test_film (std::string);
-extern std::shared_ptr<Film> new_test_film2 (std::string, Cleanup* cleanup = nullptr);
+extern std::shared_ptr<Film> new_test_film2 (std::string, std::vector<std::shared_ptr<Content>> content = {}, Cleanup* cleanup = nullptr);
 extern void check_dcp (boost::filesystem::path, boost::filesystem::path);
 extern void check_dcp (boost::filesystem::path, std::shared_ptr<const Film>);
 extern void check_file (boost::filesystem::path ref, boost::filesystem::path check);
@@ -73,6 +75,7 @@ boost::filesystem::path dcp_file (std::shared_ptr<const Film> film, std::string
 void check_one_frame (boost::filesystem::path dcp, int64_t index, boost::filesystem::path ref);
 extern boost::filesystem::path subtitle_file (std::shared_ptr<Film> film);
 extern void make_random_file (boost::filesystem::path path, size_t size);
+extern void make_and_verify_dcp (std::shared_ptr<Film> film, std::vector<dcp::VerificationNote::Code> ignore = {});
 
 
 class LogSwitcher
index 434ed0b5ec408228264fd920bacf9525d3c952e3..6b8cbffbfb96e8344f1286499caf477cbc7a6826 100644 (file)
@@ -50,18 +50,15 @@ using namespace dcpomatic;
 /** Test start/end trim and positioning of some audio content */
 BOOST_AUTO_TEST_CASE (torture_test1)
 {
-       shared_ptr<Film> film = new_test_film ("torture_test1");
-       film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
-       film->set_name ("torture_test1");
-       film->set_container (Ratio::from_id ("185"));
+       auto film = new_test_film2 ("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) */
-       shared_ptr<Content> staircase = content_factory("test/data/staircase.wav").front ();
+       auto staircase = content_factory("test/data/staircase.wav").front();
        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_position (film, DCPTime::from_frames(2000, film->audio_frame_rate()));
+       staircase->set_trim_start (ContentTime::from_frames(12, 48000));
        staircase->set_trim_end (ContentTime::from_frames (35, 48000));
        staircase->audio->set_gain (20 * log10(2));
 
@@ -70,21 +67,19 @@ BOOST_AUTO_TEST_CASE (torture_test1)
        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_end (ContentTime::from_frames (35, 48000));
+       staircase->set_trim_start (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 */
-       shared_ptr<Content> red = content_factory("test/data/flat_red.png").front ();
+       auto red = content_factory("test/data/flat_red.png").front();
        film->examine_and_add_content (red);
        BOOST_REQUIRE (!wait_for_jobs());
        red->set_position (film, DCPTime::from_seconds(5));
        red->video->set_length (24);
 
        film->set_video_frame_rate (24);
-       film->write_metadata ();
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
 
        dcp::DCP dcp ("build/test/torture_test1/" + film->dcp_name(false));
        dcp.read ();
@@ -102,7 +97,7 @@ BOOST_AUTO_TEST_CASE (torture_test1)
        BOOST_REQUIRE (sound);
        BOOST_CHECK_EQUAL (sound->intrinsic_duration(), 144);
 
-       shared_ptr<dcp::SoundAssetReader> sound_reader = sound->start_read ();
+       auto sound_reader = sound->start_read ();
 
        /* First frame silent */
        auto fr = sound_reader->get_frame (0);
@@ -226,21 +221,21 @@ BOOST_AUTO_TEST_CASE (torture_test1)
 
        /* Check picture */
 
-       shared_ptr<dcp::ReelPictureAsset> reel_picture = reels.front()->main_picture();
+       auto reel_picture = reels.front()->main_picture();
        BOOST_REQUIRE (reel_picture);
-       shared_ptr<dcp::MonoPictureAsset> picture = dynamic_pointer_cast<dcp::MonoPictureAsset> (reel_picture->asset());
+       auto picture = dynamic_pointer_cast<dcp::MonoPictureAsset> (reel_picture->asset());
        BOOST_REQUIRE (picture);
        BOOST_CHECK_EQUAL (picture->intrinsic_duration(), 144);
 
-       shared_ptr<dcp::MonoPictureAssetReader> picture_reader = picture->start_read ();
+       auto picture_reader = picture->start_read ();
 
        /* First 5 * 24 = 120 frames should be black, possibly with a little noise to raise the bitrate */
 
        shared_ptr<dcp::OpenJPEGImage> ref;
        for (int i = 0; i < 120; ++i) {
-               shared_ptr<const dcp::MonoPictureFrame> fr = picture_reader->get_frame (i);
-               shared_ptr<dcp::OpenJPEGImage> image = fr->xyz_image ();
-               dcp::Size const size = image->size ();
+               auto fr = picture_reader->get_frame (i);
+               auto image = fr->xyz_image ();
+               auto const size = image->size ();
                if (i == 0) {
                        /* Check the first frame pixel by pixel... */
                        for (int c = 0; c < 3; ++c) {
@@ -265,9 +260,9 @@ BOOST_AUTO_TEST_CASE (torture_test1)
        /* Then 24 red, perhaps also with some noise */
 
        for (int i = 120; i < 144; ++i) {
-               shared_ptr<const dcp::MonoPictureFrame> fr = picture_reader->get_frame (i);
-               shared_ptr<dcp::OpenJPEGImage> image = fr->xyz_image ();
-               dcp::Size const size = image->size ();
+               auto fr = picture_reader->get_frame (i);
+               auto image = fr->xyz_image ();
+               auto const size = image->size ();
                if (i == 120) {
                        for (int y = 0; y < size.height; ++y) {
                                for (int x = 0; x < size.width; ++x) {
index 9514e29a0f977b07aab3c42fc43e6cc6058698f0..88fb2390cfc38810951ee86fc34f99820bff822a 100644 (file)
@@ -401,8 +401,7 @@ static
 pair<int, int>
 dcp_range (shared_ptr<Film> film)
 {
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
        return pixel_range (film->dir(film->dcp_name()));
 }
 
index 60422ecf9ec5a0b5cfae59157261c5c0bd31ec7f..f110062d1706833c34b0feedccf12efbba00b545 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 /** @file  test/video_mxf_content_test.cc
  *  @brief Test use of Video MXF content.
  *  @ingroup feature
  */
 
+
+
 #include "lib/film.h"
 #include "lib/video_mxf_content.h"
 #include "lib/content_factory.h"
 #include <dcp/mono_picture_asset.h>
 #include <boost/test/unit_test.hpp>
 
+
+using std::make_shared;
 using std::shared_ptr;
 using std::dynamic_pointer_cast;
 
+
 static boost::filesystem::path ref_mxf = "test/data/scaling_test_185_185/j2c_74b946f4-1c33-4209-b639-b834de675eac.mxf";
 
+
 static void note (dcp::NoteType, std::string)
 {
 
 }
 
+
 /** Basic test of using video MXF content */
 BOOST_AUTO_TEST_CASE (video_mxf_content_test)
 {
-       shared_ptr<Film> film = new_test_film ("video_mxf_content_test");
+       auto film = new_test_film ("video_mxf_content_test");
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
        film->set_container (Ratio::from_id ("185"));
        film->set_name ("video_mxf_content_test");
 
-       shared_ptr<Content> content = content_factory(ref_mxf).front();
-       shared_ptr<VideoMXFContent> check = dynamic_pointer_cast<VideoMXFContent> (content);
+       auto content = content_factory(ref_mxf).front();
+       auto check = dynamic_pointer_cast<VideoMXFContent> (content);
        BOOST_REQUIRE (check);
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs());
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE });
 
-       shared_ptr<dcp::MonoPictureAsset> ref (new dcp::MonoPictureAsset (ref_mxf));
+       auto ref = make_shared<dcp::MonoPictureAsset>(ref_mxf);
        boost::filesystem::directory_iterator i ("build/test/video_mxf_content_test/video");
-       shared_ptr<dcp::MonoPictureAsset> comp (new dcp::MonoPictureAsset (*i));
+       auto comp = make_shared<dcp::MonoPictureAsset>(*i);
        dcp::EqualityOptions op;
        BOOST_CHECK (ref->equals (comp, op, note));
 }