X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=test%2Fsubtitle_language_test.cc;h=cd4f6f4ca70847dbdf2e42219fb3a9894e69a033;hb=9289657288a73a32063db6703792a60bf60e66a4;hp=442910e901a76e1d8f2849952d0e263d80af694e;hpb=ce73eaf7875a9a3326afcd839ad85eb95879c160;p=dcpomatic.git diff --git a/test/subtitle_language_test.cc b/test/subtitle_language_test.cc index 442910e90..cd4f6f4ca 100644 --- a/test/subtitle_language_test.cc +++ b/test/subtitle_language_test.cc @@ -46,6 +46,7 @@ BOOST_AUTO_TEST_CASE (subtitle_language_interop_test) fr[0]->only_text()->set_language (dcp::LanguageTag("fr-FR")); film->set_interop (true); + film->set_audio_channels(6); make_and_verify_dcp ( film, @@ -78,6 +79,39 @@ BOOST_AUTO_TEST_CASE (subtitle_language_smpte_test) dcp::VerificationNote::Code::MISSING_CPL_METADATA }); - check_dcp (String::compose("test/data/%1", name), String::compose("build/test/%1/%2", name, film->dcp_name())); + /* This test is concerned with the subtitles, so we'll ignore any + * differences in sound between the DCP and the reference to avoid test + * failures for unrelated reasons. + */ + check_dcp(String::compose("test/data/%1", name), String::compose("build/test/%1/%2", name, film->dcp_name()), true); +} + + +BOOST_AUTO_TEST_CASE(subtitle_language_in_cpl_test) +{ + auto subs = content_factory("test/data/frames.srt")[0]; + auto video1 = content_factory("test/data/flat_red.png")[0]; + auto video2 = content_factory("test/data/flat_red.png")[0]; + auto film = new_test_film2(boost::unit_test::framework::current_test_unit().full_name(), { subs, video1, video2 }); + video2->set_position(film, dcpomatic::DCPTime::from_seconds(5)); + film->set_reel_type(ReelType::BY_VIDEO_CONTENT); + subs->only_text()->set_language(dcp::LanguageTag("fr-FR")); + + make_and_verify_dcp( + film, + { + dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME, + dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION, + dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING + }); + + cxml::Document cpl("CompositionPlaylist"); + cpl.read_file(find_file(film->dir(film->dcp_name()), "cpl_")); + + for (auto reel: cpl.node_child("ReelList")->node_children("Reel")) { + auto subtitle = reel->node_child("AssetList")->node_child("MainSubtitle"); + BOOST_REQUIRE(subtitle); + BOOST_CHECK(subtitle->optional_node_child("Language")); + } }