From ebecf95d5f3bd55fcf65535fe3e509a5e24c6438 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 29 Dec 2023 00:06:54 +0100 Subject: Add a test. --- test/data | 2 +- test/vf_test.cc | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/data b/test/data index 154eb8c75..a513e2cd9 160000 --- a/test/data +++ b/test/data @@ -1 +1 @@ -Subproject commit 154eb8c751e43e350dac04943dc48e6ab7f9c98f +Subproject commit a513e2cd9f48dd0f6f748e4b5a77c559bbf915cf diff --git a/test/vf_test.cc b/test/vf_test.cc index 249f9c5b0..2311e3537 100644 --- a/test/vf_test.cc +++ b/test/vf_test.cc @@ -34,14 +34,20 @@ #include "lib/job_manager.h" #include "lib/make_dcp.h" #include "lib/player.h" +#include "lib/ratio.h" #include "lib/text_content.h" #include "lib/referenced_reel_asset.h" #include "lib/video_content.h" #include "test.h" #include +#include +#include #include -#include +#include #include +#include +#include +#include #include #include @@ -52,6 +58,7 @@ using std::list; using std::make_shared; using std::shared_ptr; using std::string; +using std::vector; using namespace dcpomatic; @@ -470,3 +477,81 @@ BOOST_AUTO_TEST_CASE(test_duplicate_font_id_in_vf) }); } + +BOOST_AUTO_TEST_CASE(test_referencing_ov_with_missing_subtitle_in_some_reels) +{ + auto const path = boost::filesystem::path("build/test/test_referencing_ov_with_missing_subtitle_in_some_reels"); + boost::filesystem::remove_all(path); + + boost::filesystem::create_directories(path / "ov"); + dcp::DCP ov(path / "ov"); + + auto make_picture = [path](string filename) { + auto pic = make_shared(dcp::Fraction(24, 1), dcp::Standard::SMPTE); + auto writer = pic->start_write(path / "ov" / filename, dcp::PictureAsset::Behaviour::MAKE_NEW); + auto frame = dcp::ArrayData("test/data/picture.j2c"); + for (int i = 0; i < 240; ++i) { + writer->write(frame); + } + writer->finalize(); + return pic; + }; + + auto pic1 = make_picture("pic1.mxf"); + auto pic2 = make_picture("pic2.mxf"); + + auto sub1 = make_shared(); + + sub1->add(std::make_shared( + boost::optional(), false, false, false, dcp::Colour(255, 255, 255), + 42, 1, dcp::Time(0, 0, 5, 0, 24), dcp::Time(0, 0, 9, 0, 24), + 0, dcp::HAlign::CENTER, + 0, dcp::VAlign::CENTER, + 0, dcp::Direction::LTR, + "Hello", + dcp::Effect::NONE, dcp::Colour(0, 0, 0), + dcp::Time{}, dcp::Time{}, + 0, vector{} + )); + sub1->write(path / "ov" / "sub.mxf"); + + auto reel1_pic = make_shared(pic1, 0); + auto reel1_sub = make_shared(sub1, dcp::Fraction(24, 1), 240, 0); + + auto reel2_pic = make_shared(pic1, 0); + + auto reel1 = make_shared(reel1_pic, shared_ptr(), reel1_sub); + auto reel2 = make_shared(reel2_pic); + + auto cpl = make_shared("Test CPL", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); + cpl->add(reel1); + cpl->add(reel2); + + ov.add(cpl); + ov.write_xml(); + + auto dcp_ov = make_shared(path / "ov"); + auto vf = make_shared(path / "vf"); + vf->set_dcp_content_type(DCPContentType::from_isdcf_name("TST")); + vf->set_container(Ratio::from_id("185")); + vf->write_metadata(); + vf->examine_and_add_content(dcp_ov); + BOOST_REQUIRE(!wait_for_jobs()); + vf->set_reel_type(ReelType::BY_VIDEO_CONTENT); + dcp_ov->set_reference_video(true); + dcp_ov->set_reference_text(TextType::OPEN_SUBTITLE, true); + + vf->write_metadata(); + make_dcp(vf, TranscodeJob::ChangedBehaviour::IGNORE); + BOOST_REQUIRE(!wait_for_jobs()); + + vector ignore = { + dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE, + dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME, + dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING, + dcp::VerificationNote::Code::EXTERNAL_ASSET, + }; + + verify_dcp(vf->dir(vf->dcp_name()), ignore); +} + -- cgit v1.2.3