From e182156f75a74457c4452cc3bfe91d778d0d7148 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 15 Dec 2020 00:51:34 +0100 Subject: Bv2.1 7.2.2: Check that subtitle languages are the same for all reels. --- test/test.h | 1 + test/verify_test.cc | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) (limited to 'test') diff --git a/test/test.h b/test/test.h index 1d9cd921..10f99ce1 100644 --- a/test/test.h +++ b/test/test.h @@ -45,6 +45,7 @@ extern void check_xml (std::string ref, std::string test, std::list extern void check_file (boost::filesystem::path ref, boost::filesystem::path check); extern std::shared_ptr simple_picture (boost::filesystem::path path, std::string suffix); extern std::shared_ptr simple_sound (boost::filesystem::path path, std::string suffix, dcp::MXFMetadata mxf_meta, std::string language); +extern std::shared_ptr simple_subtitle (); extern std::shared_ptr make_simple (boost::filesystem::path path, int reels = 1); extern std::shared_ptr make_simple_with_interop_subs (boost::filesystem::path path); extern std::shared_ptr make_simple_with_smpte_subs (boost::filesystem::path path); diff --git a/test/verify_test.cc b/test/verify_test.cc index 24d583b6..9bb3859a 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -1335,3 +1335,39 @@ BOOST_AUTO_TEST_CASE (verify_missing_language_tag_in_subtitle_xml) BOOST_CHECK_EQUAL (notes.front().type(), dcp::VerificationNote::VERIFY_BV21_ERROR); BOOST_CHECK_EQUAL (notes.front().code(), dcp::VerificationNote::MISSING_SUBTITLE_LANGUAGE); } + + +BOOST_AUTO_TEST_CASE (verify_inconsistent_subtitle_languages) +{ + boost::filesystem::path path ("build/test/verify_inconsistent_subtitle_languages"); + shared_ptr dcp = make_simple (path, 2); + shared_ptr cpl = dcp->cpls().front(); + + { + shared_ptr subs(new dcp::SMPTESubtitleAsset()); + subs->set_language (dcp::LanguageTag("de-DE")); + subs->add (simple_subtitle()); + subs->write (path / "subs1.mxf"); + shared_ptr reel_subs(new dcp::ReelSubtitleAsset(subs, dcp::Fraction(24, 1), 240, 0)); + cpl->reels().front()->add (reel_subs); + } + + { + shared_ptr subs(new dcp::SMPTESubtitleAsset()); + subs->set_language (dcp::LanguageTag("en-US")); + subs->add (simple_subtitle()); + subs->write (path / "subs2.mxf"); + shared_ptr reel_subs(new dcp::ReelSubtitleAsset(subs, dcp::Fraction(24, 1), 240, 0)); + cpl->reels().back()->add (reel_subs); + } + + dcp->write_xml (dcp::SMPTE); + + vector dirs; + dirs.push_back (path); + list notes = dcp::verify (dirs, &stage, &progress, xsd_test); + BOOST_REQUIRE_EQUAL (notes.size(), 1U); + BOOST_CHECK_EQUAL (notes.front().type(), dcp::VerificationNote::VERIFY_BV21_ERROR); + BOOST_CHECK_EQUAL (notes.front().code(), dcp::VerificationNote::SUBTITLE_LANGUAGES_DIFFER); +} + -- cgit v1.2.3