X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=test%2Fsubtitle_reel_test.cc;h=d7eb90d251eb45382eff78d2c4a78a2a1213a852;hb=693013b77341e4177c792de091ab9a524e33c477;hp=c910d4aec3f39a105141c8cee8e0bc2713b5f3ba;hpb=8fedaaa75c4586a4cc7ffb393bd71d1fdb091dc8;p=dcpomatic.git diff --git a/test/subtitle_reel_test.cc b/test/subtitle_reel_test.cc index c910d4aec..d7eb90d25 100644 --- a/test/subtitle_reel_test.cc +++ b/test/subtitle_reel_test.cc @@ -19,9 +19,9 @@ */ #include "lib/content_factory.h" +#include "lib/dcp_subtitle_content.h" #include "lib/film.h" #include "lib/image_content.h" -#include "lib/dcp_subtitle_content.h" #include "lib/text_content.h" #include "lib/video_content.h" #include "test.h" @@ -35,9 +35,8 @@ using std::list; -using std::string; -using std::shared_ptr; using std::make_shared; +using std::string; using boost::optional; @@ -67,13 +66,12 @@ BOOST_AUTO_TEST_CASE (subtitle_reel_test) film->set_reel_type (ReelType::BY_VIDEO_CONTENT); - film->make_dcp (); - BOOST_REQUIRE (!wait_for_jobs()); + make_and_verify_dcp (film, {dcp::VerificationNote::Code::INVALID_STANDARD}); dcp::DCP dcp ("build/test/subtitle_reel_test/" + film->dcp_name()); dcp.read (); BOOST_REQUIRE_EQUAL (dcp.cpls().size(), 1U); - shared_ptr cpl = dcp.cpls().front(); + auto cpl = dcp.cpls().front(); auto reels = cpl->reels (); BOOST_REQUIRE_EQUAL (reels.size(), 2U); @@ -107,17 +105,22 @@ BOOST_AUTO_TEST_CASE (subtitle_in_all_reels_test) film->set_sequence (false); film->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]; film->examine_and_add_content (video); BOOST_REQUIRE (!wait_for_jobs()); video->video->set_length (15 * 24); video->set_position (film, dcpomatic::DCPTime::from_seconds(15 * i)); } - auto subs = content_factory("test/data/15s.srt").front(); + auto subs = content_factory("test/data/15s.srt")[0]; film->examine_and_add_content (subs); BOOST_REQUIRE (!wait_for_jobs()); - 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_SPACING + }); dcp::DCP dcp ("build/test/subtitle_in_all_reels_test/" + film->dcp_name()); dcp.read (); @@ -142,27 +145,31 @@ BOOST_AUTO_TEST_CASE (closed_captions_in_all_reels_test) film->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]; film->examine_and_add_content (video); BOOST_REQUIRE (!wait_for_jobs()); video->video->set_length (15 * 24); video->set_position (film, dcpomatic::DCPTime::from_seconds(15 * i)); } - auto ccap1 = content_factory("test/data/15s.srt").front(); + auto ccap1 = content_factory("test/data/15s.srt")[0]; film->examine_and_add_content (ccap1); BOOST_REQUIRE (!wait_for_jobs()); ccap1->text.front()->set_type (TextType::CLOSED_CAPTION); - ccap1->text.front()->set_dcp_track (DCPTextTrack("Test", "de-DE")); + ccap1->text.front()->set_dcp_track (DCPTextTrack("Test", dcp::LanguageTag("de-DE"))); - auto ccap2 = content_factory("test/data/15s.srt").front(); + auto ccap2 = content_factory("test/data/15s.srt")[0]; film->examine_and_add_content (ccap2); BOOST_REQUIRE (!wait_for_jobs()); ccap2->text.front()->set_type (TextType::CLOSED_CAPTION); - ccap2->text.front()->set_dcp_track (DCPTextTrack("Other", "en-GB")); + ccap2->text.front()->set_dcp_track (DCPTextTrack("Other", dcp::LanguageTag("en-GB"))); - film->make_dcp (); - BOOST_REQUIRE (!wait_for_jobs()); + make_and_verify_dcp ( + film, + { + dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME, + dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING + }); dcp::DCP dcp ("build/test/closed_captions_in_all_reels_test/" + film->dcp_name()); dcp.read (); @@ -182,3 +189,42 @@ BOOST_AUTO_TEST_CASE (closed_captions_in_all_reels_test) ); } } + + +BOOST_AUTO_TEST_CASE (subtitles_split_at_reel_boundaries) +{ + auto film = new_test_film2 ("subtitles_split_at_reel_boundaries"); + film->set_interop (true); + + film->set_sequence (false); + film->set_reel_type (ReelType::BY_VIDEO_CONTENT); + + for (int i = 0; i < 3; ++i) { + auto video = content_factory("test/data/flat_red.png")[0]; + film->examine_and_add_content (video); + BOOST_REQUIRE (!wait_for_jobs()); + video->video->set_length (15 * 24); + video->set_position (film, dcpomatic::DCPTime::from_seconds(15 * i)); + } + + auto subtitle = content_factory("test/data/45s.srt")[0]; + film->examine_and_add_content (subtitle); + BOOST_REQUIRE (!wait_for_jobs()); + + make_and_verify_dcp (film, { dcp::VerificationNote::Code::INVALID_STANDARD }); + + dcp::DCP dcp (film->dir(film->dcp_name())); + dcp.read(); + BOOST_REQUIRE_EQUAL (dcp.cpls().size(), 1U); + auto cpl = dcp.cpls()[0]; + BOOST_REQUIRE_EQUAL (cpl->reels().size(), 3U); + + for (auto i: cpl->reels()) { + auto reel_sub = i->main_subtitle(); + BOOST_REQUIRE (reel_sub); + auto sub = reel_sub->asset(); + BOOST_REQUIRE (sub); + BOOST_CHECK_EQUAL (sub->subtitles().size(), 1U); + } +} +