X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=test%2Fvf_test.cc;h=f3ba156a10518454f66eb85dcb0a2704b08bbbff;hp=d25eb3cca3eea28a0953871489f886566ec16b15;hb=25eb7aa723af004162fc7f95995df250c4e4571b;hpb=9bfa07293928c371d59db2091ba2b7e715ce5994 diff --git a/test/vf_test.cc b/test/vf_test.cc index d25eb3cca..f3ba156a1 100644 --- a/test/vf_test.cc +++ b/test/vf_test.cc @@ -25,14 +25,14 @@ */ -#include "lib/film.h" -#include "lib/dcp_content.h" -#include "lib/ffmpeg_content.h" #include "lib/content_factory.h" +#include "lib/dcp_content.h" #include "lib/dcp_content_type.h" -#include "lib/video_content.h" -#include "lib/referenced_reel_asset.h" +#include "lib/ffmpeg_content.h" +#include "lib/film.h" #include "lib/player.h" +#include "lib/referenced_reel_asset.h" +#include "lib/video_content.h" #include "test.h" #include #include @@ -42,12 +42,12 @@ #include -using std::list; -using std::string; using std::cout; -using std::shared_ptr; -using std::make_shared; using std::dynamic_pointer_cast; +using std::list; +using std::make_shared; +using std::shared_ptr; +using std::string; using namespace dcpomatic; @@ -102,11 +102,11 @@ BOOST_AUTO_TEST_CASE (vf_test2) auto ov = new_test_film ("vf_test2_ov"); ov->set_dcp_content_type (DCPContentType::from_isdcf_name("TST")); ov->set_name ("vf_test2_ov"); - auto video = content_factory("test/data/flat_red.png").front(); + auto video = content_factory("test/data/flat_red.png")[0]; ov->examine_and_add_content (video); BOOST_REQUIRE (!wait_for_jobs()); video->video->set_length (24 * 5); - auto audio = content_factory("test/data/white.wav").front(); + auto audio = content_factory("test/data/white.wav")[0]; ov->examine_and_add_content (audio); BOOST_REQUIRE (!wait_for_jobs()); make_and_verify_dcp (ov); @@ -121,7 +121,7 @@ BOOST_AUTO_TEST_CASE (vf_test2) BOOST_REQUIRE (!wait_for_jobs()); dcp->set_reference_video (true); dcp->set_reference_audio (true); - auto sub = content_factory("test/data/subrip4.srt").front(); + auto sub = content_factory("test/data/subrip4.srt")[0]; vf->examine_and_add_content (sub); BOOST_REQUIRE (!wait_for_jobs()); make_and_verify_dcp ( @@ -164,11 +164,11 @@ BOOST_AUTO_TEST_CASE (vf_test3) auto ov = new_test_film ("vf_test3_ov"); ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); ov->set_name ("vf_test3_ov"); - auto video = content_factory("test/data/flat_red.png").front(); + auto video = content_factory("test/data/flat_red.png")[0]; ov->examine_and_add_content (video); BOOST_REQUIRE (!wait_for_jobs()); video->video->set_length (24 * 5); - auto audio = content_factory("test/data/white.wav").front(); + auto audio = content_factory("test/data/white.wav")[0]; ov->examine_and_add_content (audio); BOOST_REQUIRE (!wait_for_jobs()); make_and_verify_dcp (ov); @@ -208,11 +208,11 @@ BOOST_AUTO_TEST_CASE (vf_test4) auto ov = new_test_film ("vf_test4_ov"); ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); ov->set_name ("vf_test4_ov"); - auto video = content_factory("test/data/flat_red.png").front(); + auto video = content_factory("test/data/flat_red.png")[0]; ov->examine_and_add_content (video); BOOST_REQUIRE (!wait_for_jobs()); video->video->set_length (24 * 5); - auto audio = content_factory("test/data/white.wav").front(); + auto audio = content_factory("test/data/white.wav")[0]; ov->examine_and_add_content (audio); BOOST_REQUIRE (!wait_for_jobs()); make_and_verify_dcp (ov); @@ -230,7 +230,7 @@ BOOST_AUTO_TEST_CASE (vf_test4) dcp->set_position(vf, DCPTime::from_seconds(10)); dcp->set_reference_video (true); dcp->set_reference_audio (true); - auto more_video = content_factory("test/data/flat_red.png").front(); + auto more_video = content_factory("test/data/flat_red.png")[0]; vf->examine_and_add_content (more_video); BOOST_REQUIRE (!wait_for_jobs()); more_video->set_position (vf, DCPTime()); @@ -266,7 +266,7 @@ BOOST_AUTO_TEST_CASE (vf_test5) ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); ov->set_reel_type (ReelType::BY_VIDEO_CONTENT); for (int i = 0; i < 3; ++i) { - auto video = content_factory("test/data/flat_red.png").front(); + auto video = content_factory("test/data/flat_red.png")[0]; ov->examine_and_add_content (video); BOOST_REQUIRE (!wait_for_jobs()); video->video->set_length (24 * 10); @@ -291,7 +291,7 @@ BOOST_AUTO_TEST_CASE (vf_test5) make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}); /* Check that the selected reel assets are right */ - auto player = make_shared(vf, false); + auto player = make_shared(vf, Image::Alignment::COMPACT); auto a = player->get_reel_assets(); BOOST_REQUIRE_EQUAL (a.size(), 4U); auto i = a.begin(); @@ -313,7 +313,7 @@ BOOST_AUTO_TEST_CASE (vf_test6) auto ov = new_test_film ("vf_test6_ov"); ov->set_dcp_content_type (DCPContentType::from_isdcf_name("TST")); ov->set_reel_type (ReelType::BY_VIDEO_CONTENT); - auto video = content_factory("test/data/flat_red.png").front(); + auto video = content_factory("test/data/flat_red.png")[0]; ov->examine_and_add_content (video); BOOST_REQUIRE (!wait_for_jobs()); video->video->set_length (24 * 10); @@ -331,7 +331,7 @@ BOOST_AUTO_TEST_CASE (vf_test6) dcp->set_reference_video (true); dcp->set_reference_audio (true); - auto sub = content_factory("test/data/15s.srt").front(); + auto sub = content_factory("test/data/15s.srt")[0]; vf->examine_and_add_content (sub); BOOST_REQUIRE (!wait_for_jobs()); @@ -349,12 +349,12 @@ BOOST_AUTO_TEST_CASE (vf_test6) BOOST_AUTO_TEST_CASE (vf_test7) { /* First OV */ - auto ov1 = new_test_film2 ("vf_test7_ov1", {content_factory("test/data/flat_red.png").front()}); + auto ov1 = new_test_film2 ("vf_test7_ov1", {content_factory("test/data/flat_red.png")[0]}); ov1->set_video_frame_rate (24); make_and_verify_dcp (ov1); /* Second OV */ - auto ov2 = new_test_film2 ("vf_test7_ov2", {content_factory("test/data/flat_red.png").front()}); + auto ov2 = new_test_film2 ("vf_test7_ov2", {content_factory("test/data/flat_red.png")[0]}); ov2->set_video_frame_rate (24); make_and_verify_dcp (ov2); @@ -370,3 +370,31 @@ BOOST_AUTO_TEST_CASE (vf_test7) vf->write_metadata (); make_and_verify_dcp (vf); } + + +/** Test bug #2116 */ +BOOST_AUTO_TEST_CASE (test_vf_with_trimmed_multi_reel_dcp) +{ + /* Make an OV with 3 reels */ + std::vector> ov_content; + for (int i = 0; i < 3; ++i) { + auto c = content_factory("test/data/flat_red.png")[0]; + c->video->set_length(240); + ov_content.push_back(c); + } + auto ov = new_test_film2 ("test_vf_with_trimmed_multi_reel_dcp_ov", ov_content); + ov->set_reel_type(ReelType::BY_VIDEO_CONTENT); + make_and_verify_dcp (ov); + + /* Make a VF with a specific arrangement */ + auto vf_image = content_factory("test/data/flat_red.png")[0]; + auto vf_dcp = make_shared(ov->dir(ov->dcp_name())); + auto vf = new_test_film2 ("test_vf_with_trimmed_multi_reel_dcp_vf", { vf_image, vf_dcp }); + vf->set_reel_type(ReelType::BY_VIDEO_CONTENT); + vf_dcp->set_reference_video(true); + vf_dcp->set_reference_audio(true); + vf_dcp->set_trim_start(ContentTime::from_seconds(10)); + vf_dcp->set_position(vf, DCPTime::from_seconds(10)); + make_and_verify_dcp (vf, { dcp::VerificationNote::Code::EXTERNAL_ASSET }); +} +