diff options
Diffstat (limited to 'test/vf_test.cc')
| -rw-r--r-- | test/vf_test.cc | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/test/vf_test.cc b/test/vf_test.cc index 9c7ff65be..29b9913fd 100644 --- a/test/vf_test.cc +++ b/test/vf_test.cc @@ -592,3 +592,99 @@ BOOST_AUTO_TEST_CASE(vf_subs_get_font_from_ov) auto vf_font = find_file(*font_dir, "font"); check_file("test/data/Inconsolata-VF.ttf", vf_font); } + + +/** CCAPs in OVs would not correctly be referred to as we'd incorrectly create an + * empty filler CCAP asset. + */ +BOOST_AUTO_TEST_CASE(vf_referring_to_ov_ccap_test) +{ + auto picture = content_factory("test/data/flat_red.png")[0]; + auto ccap = content_factory("test/data/short.srt")[0]; + auto ov = new_test_film("vf_referring_to_ov_ccap_test_ov", { picture, ccap }); + ccap->only_text()->set_use(true); + ccap->only_text()->set_type(TextType::CLOSED_CAPTION); + ccap->only_text()->set_dcp_track(DCPTextTrack("First track", dcp::LanguageTag("fr"))); + make_and_verify_dcp(ov, { dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME }); + + auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name())); + auto subs = content_factory("test/data/short.srt")[0]; + auto vf = new_test_film("vf_referring_to_ov_ccap_test_vf", { ov_dcp, subs }); + vf->set_reel_type(ReelType::BY_VIDEO_CONTENT); + ov_dcp->set_reference_video(true); + ov_dcp->set_reference_audio(true); + ov_dcp->set_reference_text(TextType::CLOSED_CAPTION, true); + subs->only_text()->set_use(true); + subs->only_text()->set_type(TextType::OPEN_SUBTITLE); + subs->set_position(vf, dcpomatic::DCPTime()); + vf->write_metadata(); + make_dcp(vf, TranscodeJob::ChangedBehaviour::IGNORE); + BOOST_REQUIRE(!wait_for_jobs()); + + dcp::DCP ov_check(ov->dir(ov->dcp_name())); + ov_check.read(); + dcp::DCP vf_check(vf->dir(vf->dcp_name())); + vf_check.read(); + + BOOST_REQUIRE_EQUAL(ov_check.cpls().size(), 1U); + BOOST_REQUIRE_EQUAL(vf_check.cpls().size(), 1U); + BOOST_REQUIRE_EQUAL(ov_check.cpls()[0]->reels().size(), 1U); + BOOST_REQUIRE_EQUAL(vf_check.cpls()[0]->reels().size(), 1U); + BOOST_REQUIRE_EQUAL(ov_check.cpls()[0]->reels()[0]->closed_captions().size(), 1U); + BOOST_REQUIRE_EQUAL(vf_check.cpls()[0]->reels()[0]->closed_captions().size(), 1U); + + BOOST_CHECK_EQUAL( + ov_check.cpls()[0]->reels()[0]->closed_captions()[0]->id(), + vf_check.cpls()[0]->reels()[0]->closed_captions()[0]->id() + ); +} + + +/** Check that in a VF we can have a CCAP reel which refers to the OV and another + * which is an auto-created filler. + */ +BOOST_AUTO_TEST_CASE(ccaps_can_be_referred_and_filled_test) +{ + auto picture = content_factory("test/data/flat_red.png")[0]; + auto ccap = content_factory("test/data/short.srt")[0]; + auto ov = new_test_film("ccaps_can_be_referred_and_filled_test_ov", { picture, ccap }); + ccap->only_text()->set_use(true); + ccap->only_text()->set_type(TextType::CLOSED_CAPTION); + ccap->only_text()->set_dcp_track(DCPTextTrack("First track", dcp::LanguageTag("fr"))); + make_and_verify_dcp(ov, { dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME }); + + auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name())); + auto subs = content_factory("test/data/short.srt")[0]; + auto vf = new_test_film("ccaps_can_be_referred_and_filled_test_vf", { ov_dcp, subs, picture }); + vf->set_reel_type(ReelType::BY_VIDEO_CONTENT); + ov_dcp->set_reference_video(true); + ov_dcp->set_reference_audio(true); + ov_dcp->set_reference_text(TextType::CLOSED_CAPTION, true); + subs->only_text()->set_use(true); + subs->only_text()->set_type(TextType::OPEN_SUBTITLE); + subs->set_position(vf, dcpomatic::DCPTime()); + vf->write_metadata(); + make_dcp(vf, TranscodeJob::ChangedBehaviour::IGNORE); + BOOST_REQUIRE(!wait_for_jobs()); + + dcp::DCP ov_check(ov->dir(ov->dcp_name())); + ov_check.read(); + dcp::DCP vf_check(vf->dir(vf->dcp_name())); + vf_check.read(); + + BOOST_REQUIRE_EQUAL(ov_check.cpls().size(), 1U); + BOOST_REQUIRE_EQUAL(vf_check.cpls().size(), 1U); + BOOST_REQUIRE_EQUAL(ov_check.cpls()[0]->reels().size(), 1U); + BOOST_REQUIRE_EQUAL(vf_check.cpls()[0]->reels().size(), 2U); + + BOOST_REQUIRE_EQUAL(ov_check.cpls()[0]->reels()[0]->closed_captions().size(), 1U); + BOOST_REQUIRE_EQUAL(vf_check.cpls()[0]->reels()[0]->closed_captions().size(), 1U); + + BOOST_CHECK_EQUAL( + ov_check.cpls()[0]->reels()[0]->closed_captions()[0]->id(), + vf_check.cpls()[0]->reels()[0]->closed_captions()[0]->id() + ); + + BOOST_REQUIRE_EQUAL(vf_check.cpls()[0]->reels()[1]->closed_captions().size(), 1U); +} + |
