From d4519ea7898ccb878a297126bbb45c7b65cccd08 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 14 Dec 2020 23:23:41 +0100 Subject: Bv2.1 7.2.2: Check that subtitle Language tags are present. --- test/verify_test.cc | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'test/verify_test.cc') diff --git a/test/verify_test.cc b/test/verify_test.cc index e468f286..1fc66dcd 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -1192,6 +1192,7 @@ BOOST_AUTO_TEST_CASE (verify_closed_caption_xml_too_large) ) ); } + asset->set_language (dcp::LanguageTag("de-DE")); asset->write (dir / "subs.mxf"); shared_ptr reel_asset(new dcp::ReelClosedCaptionAsset(asset, dcp::Fraction(24, 1), 16 * 24, 0)); shared_ptr reel(new dcp::Reel()); @@ -1257,6 +1258,7 @@ verify_timed_text_asset_too_large (string name) ) ) ); + asset->set_language (dcp::LanguageTag("de-DE")); asset->write (dir / "subs.mxf"); shared_ptr reel_asset(new T(asset, dcp::Fraction(24, 1), 16 * 24, 0)); @@ -1288,3 +1290,48 @@ BOOST_AUTO_TEST_CASE (verify_subtitle_asset_too_large) } +BOOST_AUTO_TEST_CASE (verify_missing_language_tag_in_subtitle_xml) +{ + boost::filesystem::path dir = "build/test/verify_missing_language_tag_in_subtitle_xml"; + prepare_directory (dir); + shared_ptr dcp = make_simple (dir, 1); + + string const xml = + "" + "" + "urn:uuid:e6a8ae03-ebbf-41ed-9def-913a87d1493a" + "Content" + "Annotation" + "2018-10-02T12:25:14+02:00" + "1" + "25 1" + "25" + "00:00:00:00" + "urn:uuid:e4f0ff0a-9eba-49e0-92ee-d89a88a575f6" + "" + "" + "" + "Hello world" + "" + "" + "" + ""; + + FILE* xml_file = dcp::fopen_boost (dir / "subs.xml", "w"); + BOOST_REQUIRE (xml_file); + fwrite (xml.c_str(), xml.size(), 1, xml_file); + fclose (xml_file); + shared_ptr subs (new dcp::SMPTESubtitleAsset(dir / "subs.xml")); + subs->write (dir / "subs.mxf"); + + shared_ptr reel_subs (new dcp::ReelSubtitleAsset(subs, dcp::Fraction(24, 1), 100, 0)); + dcp->cpls().front()->reels().front()->add (reel_subs); + dcp->write_xml (dcp::SMPTE); + + vector dirs; + dirs.push_back (dir); + 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::MISSING_SUBTITLE_LANGUAGE); +} -- cgit v1.2.3