From f11ff8d4d961d92e994ef0f9beb456aa8ec7c4cb Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 3 Jan 2021 00:31:40 +0100 Subject: Bv2.1 7.2.3: Check that subtitle exists and is 0. --- test/verify_test.cc | 123 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 115 insertions(+), 8 deletions(-) (limited to 'test/verify_test.cc') diff --git a/test/verify_test.cc b/test/verify_test.cc index 9bb3859a..4cde3966 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -729,9 +729,13 @@ BOOST_AUTO_TEST_CASE (verify_test21) vector dirs; dirs.push_back (dir); list notes = dcp::verify (dirs, &stage, &progress, xsd_test); - BOOST_REQUIRE_EQUAL (notes.size(), 2); - BOOST_CHECK_EQUAL (notes.front().code(), dcp::VerificationNote::XML_VALIDATION_ERROR); - BOOST_CHECK_EQUAL (notes.back().code(), dcp::VerificationNote::XML_VALIDATION_ERROR); + BOOST_REQUIRE_EQUAL (notes.size(), 3); + list::const_iterator i = notes.begin(); + BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::XML_VALIDATION_ERROR); + ++i; + BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::XML_VALIDATION_ERROR); + ++i; + BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::MISSING_SUBTITLE_START_TIME); } @@ -1206,9 +1210,12 @@ BOOST_AUTO_TEST_CASE (verify_closed_caption_xml_too_large) 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::CLOSED_CAPTION_XML_TOO_LARGE_IN_BYTES); + BOOST_REQUIRE_EQUAL (notes.size(), 2U); + list::const_iterator i = notes.begin(); + BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::MISSING_SUBTITLE_START_TIME); + ++i; + BOOST_CHECK_EQUAL (i->type(), dcp::VerificationNote::VERIFY_BV21_ERROR); + BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::CLOSED_CAPTION_XML_TOO_LARGE_IN_BYTES); } @@ -1273,13 +1280,15 @@ verify_timed_text_asset_too_large (string name) vector dirs; dirs.push_back (dir); list notes = dcp::verify (dirs, &stage, &progress, xsd_test); - BOOST_REQUIRE_EQUAL (notes.size(), 2U); + BOOST_REQUIRE_EQUAL (notes.size(), 3U); list::const_iterator i = notes.begin(); BOOST_CHECK_EQUAL (i->type(), dcp::VerificationNote::VERIFY_BV21_ERROR); BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::TIMED_TEXT_ASSET_TOO_LARGE_IN_BYTES); ++i; BOOST_CHECK_EQUAL (i->type(), dcp::VerificationNote::VERIFY_BV21_ERROR); BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::TIMED_TEXT_FONTS_TOO_LARGE_IN_BYTES); + ++i; + BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::MISSING_SUBTITLE_START_TIME); } @@ -1366,8 +1375,106 @@ BOOST_AUTO_TEST_CASE (verify_inconsistent_subtitle_languages) vector dirs; dirs.push_back (path); list notes = dcp::verify (dirs, &stage, &progress, xsd_test); + BOOST_REQUIRE_EQUAL (notes.size(), 3U); + list::const_iterator i = notes.begin(); + BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::MISSING_SUBTITLE_START_TIME); + ++i; + BOOST_CHECK_EQUAL (i->type(), dcp::VerificationNote::VERIFY_BV21_ERROR); + ++i; + BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::MISSING_SUBTITLE_START_TIME); +} + + +BOOST_AUTO_TEST_CASE (verify_missing_start_time_tag_in_subtitle_xml) +{ + boost::filesystem::path dir = "build/test/verify_missing_start_time_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" + "de-DE" + "25 1" + "25" + "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::SUBTITLE_LANGUAGES_DIFFER); + BOOST_CHECK_EQUAL (notes.front().code(), dcp::VerificationNote::MISSING_SUBTITLE_START_TIME); } + +BOOST_AUTO_TEST_CASE (verify_non_zero_start_time_tag_in_subtitle_xml) +{ + boost::filesystem::path dir = "build/test/verify_non_zero_start_time_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" + "de-DE" + "25 1" + "25" + "00:00:02: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::SUBTITLE_START_TIME_NON_ZERO); +} -- cgit v1.2.3