X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=test%2Fimport_dcp_test.cc;h=874e3d418333eb456d23c0d1617e780ba5865243;hb=182b9d2e2feb6545592868606aaf0f0146095481;hp=44f3c7d444d7008e98d42284a2204d90cff27758;hpb=369821c41e62d4cce506cd4206f9db0d91b4f643;p=dcpomatic.git diff --git a/test/import_dcp_test.cc b/test/import_dcp_test.cc index 44f3c7d44..874e3d418 100644 --- a/test/import_dcp_test.cc +++ b/test/import_dcp_test.cc @@ -25,35 +25,37 @@ */ -#include "test.h" -#include "lib/film.h" -#include "lib/screen.h" -#include "lib/dcp_subtitle_content.h" -#include "lib/ratio.h" -#include "lib/dcp_content_type.h" +#include "lib/config.h" +#include "lib/content_factory.h" +#include "lib/cross.h" #include "lib/dcp_content.h" -#include "lib/ffmpeg_content.h" +#include "lib/dcp_content_type.h" +#include "lib/dcp_subtitle_content.h" #include "lib/examine_content_job.h" +#include "lib/ffmpeg_content.h" +#include "lib/film.h" #include "lib/job_manager.h" -#include "lib/config.h" -#include "lib/cross.h" +#include "lib/ratio.h" +#include "lib/screen.h" #include "lib/video_content.h" -#include "lib/content_factory.h" +#include "test.h" #include #include -using std::vector; -using std::string; -using std::map; -using std::shared_ptr; using std::dynamic_pointer_cast; using std::make_shared; +using std::map; +using std::shared_ptr; +using std::string; +using std::vector; /** Make an encrypted DCP, import it and make a new unencrypted DCP */ BOOST_AUTO_TEST_CASE (import_dcp_test) { + ConfigRestorer cr; + auto A = new_test_film ("import_dcp_test"); A->set_container (Ratio::from_id ("185")); A->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); @@ -65,15 +67,13 @@ BOOST_AUTO_TEST_CASE (import_dcp_test) A->set_encrypted (true); BOOST_CHECK (!wait_for_jobs ()); - A->make_dcp (); - BOOST_CHECK (!wait_for_jobs ()); + make_and_verify_dcp (A); dcp::DCP A_dcp ("build/test/import_dcp_test/" + A->dcp_name()); A_dcp.read (); - Config::instance()->set_decryption_chain (make_shared(openssl_path())); + Config::instance()->set_decryption_chain (make_shared(openssl_path(), CERTIFICATE_VALIDITY_PERIOD)); - /* Dear future-carl: I suck! I thought you wouldn't still be running these tests in 2030! Sorry! */ auto kdm = A->make_kdm ( Config::instance()->decryption_chain()->leaf (), vector(), @@ -97,8 +97,7 @@ BOOST_AUTO_TEST_CASE (import_dcp_test) JobManager::instance()->add (make_shared(B, d)); BOOST_CHECK (!wait_for_jobs ()); - B->make_dcp (); - BOOST_CHECK (!wait_for_jobs ()); + make_and_verify_dcp (B); /* Should be 1s red, 1s green, 1s blue */ check_dcp ("test/data/import_dcp_test2", "build/test/import_dcp_test2/" + B->dcp_name()); @@ -111,25 +110,20 @@ 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 content = content_factory("test/data/flat_red.png"); + auto film = new_test_film2 ("import_dcp_markers_test", content, &cl); - content->video->set_length (24 * 60 * 10); + content[0]->video->set_length (24 * 60 * 10); - film->set_marker(dcp::Marker::FFOC, dcpomatic::DCPTime::from_seconds(1.91)); + film->set_marker(dcp::Marker::FFOC, dcpomatic::DCPTime::from_frames(1, 24)); film->set_marker(dcp::Marker::FFMC, dcpomatic::DCPTime::from_seconds(9.4)); film->set_marker(dcp::Marker::LFMC, dcpomatic::DCPTime::from_seconds(9.99)); - film->make_dcp (); - BOOST_REQUIRE (!wait_for_jobs()); + make_and_verify_dcp (film); /* 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(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 @@ -138,8 +132,6 @@ BOOST_AUTO_TEST_CASE (import_dcp_markers_test) BOOST_CHECK_EQUAL (imported->markers().size(), 4U); auto markers = imported->markers(); - BOOST_REQUIRE(markers.find(dcp::Marker::FFOC) != markers.end()); - BOOST_CHECK(markers[dcp::Marker::FFOC] == dcpomatic::ContentTime(184000)); BOOST_REQUIRE(markers.find(dcp::Marker::FFMC) != markers.end()); BOOST_CHECK(markers[dcp::Marker::FFMC] == dcpomatic::ContentTime(904000)); BOOST_REQUIRE(markers.find(dcp::Marker::LFMC) != markers.end()); @@ -149,14 +141,12 @@ BOOST_AUTO_TEST_CASE (import_dcp_markers_test) auto film3 = make_shared(boost::filesystem::path("build/test/import_dcp_markers_test2")); film3->read_metadata (); BOOST_REQUIRE_EQUAL (film3->content().size(), 1U); - shared_ptr reloaded = dynamic_pointer_cast(film3->content().front()); + auto reloaded = dynamic_pointer_cast(film3->content().front()); BOOST_REQUIRE (reloaded); BOOST_CHECK_EQUAL (reloaded->markers().size(), 4U); markers = reloaded->markers(); - BOOST_REQUIRE(markers.find(dcp::Marker::FFOC) != markers.end()); - BOOST_CHECK(markers[dcp::Marker::FFOC] == dcpomatic::ContentTime(184000)); BOOST_REQUIRE(markers.find(dcp::Marker::FFMC) != markers.end()); BOOST_CHECK(markers[dcp::Marker::FFMC] == dcpomatic::ContentTime(904000)); BOOST_REQUIRE(markers.find(dcp::Marker::LFMC) != markers.end()); @@ -171,7 +161,7 @@ BOOST_AUTO_TEST_CASE (import_dcp_metadata_test) { /* Make a DCP with some ratings and a content version */ auto film = new_test_film2 ("import_dcp_metadata_test"); - auto content = content_factory("test/data/flat_red.png").front(); + auto content = content_factory("test/data/flat_red.png")[0]; film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs()); @@ -183,8 +173,7 @@ BOOST_AUTO_TEST_CASE (import_dcp_metadata_test) vector cv = { "Fred "}; film->set_content_versions (cv); - film->make_dcp (); - BOOST_REQUIRE (!wait_for_jobs()); + make_and_verify_dcp (film); /* Import the DCP to a new film and check the metadata */ auto film2 = new_test_film2 ("import_dcp_metadata_test2");