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/data/822bd341-c751-45b1-94d2-410e4ffcff1b.png | Bin 44935 -> 44861 bytes test/data/sub.png | Bin 44935 -> 44861 bytes test/data/subs.mxf | Bin 62859 -> 62954 bytes test/ref/write_interop_subtitle_test3/ASSETMAP | 2 +- .../d36f4bb3-c4fa-4a95-9915-6fec3110cd71.png | Bin 44935 -> 44861 bytes test/ref/write_interop_subtitle_test3/pkl.xml | 31 +++++- .../pkl_6a9e31a6-50a4-4ecb-8683-fa667848470a.xml | 30 ----- test/test.cc | 2 + test/verify_test.cc | 123 +++++++++++++++++++-- 9 files changed, 148 insertions(+), 40 deletions(-) mode change 120000 => 100644 test/ref/write_interop_subtitle_test3/pkl.xml delete mode 100644 test/ref/write_interop_subtitle_test3/pkl_6a9e31a6-50a4-4ecb-8683-fa667848470a.xml (limited to 'test') diff --git a/test/data/822bd341-c751-45b1-94d2-410e4ffcff1b.png b/test/data/822bd341-c751-45b1-94d2-410e4ffcff1b.png index 89b53cf2..9d8f2988 100644 Binary files a/test/data/822bd341-c751-45b1-94d2-410e4ffcff1b.png and b/test/data/822bd341-c751-45b1-94d2-410e4ffcff1b.png differ diff --git a/test/data/sub.png b/test/data/sub.png index 89b53cf2..9d8f2988 100644 Binary files a/test/data/sub.png and b/test/data/sub.png differ diff --git a/test/data/subs.mxf b/test/data/subs.mxf index ec208dce..d321e5c6 100644 Binary files a/test/data/subs.mxf and b/test/data/subs.mxf differ diff --git a/test/ref/write_interop_subtitle_test3/ASSETMAP b/test/ref/write_interop_subtitle_test3/ASSETMAP index dfcc1bc9..0b704a41 100644 --- a/test/ref/write_interop_subtitle_test3/ASSETMAP +++ b/test/ref/write_interop_subtitle_test3/ASSETMAP @@ -48,7 +48,7 @@ d36f4bb3-c4fa-4a95-9915-6fec3110cd71.png 1 0 - 44935 + 44861 diff --git a/test/ref/write_interop_subtitle_test3/d36f4bb3-c4fa-4a95-9915-6fec3110cd71.png b/test/ref/write_interop_subtitle_test3/d36f4bb3-c4fa-4a95-9915-6fec3110cd71.png index 89b53cf2..9d8f2988 100644 Binary files a/test/ref/write_interop_subtitle_test3/d36f4bb3-c4fa-4a95-9915-6fec3110cd71.png and b/test/ref/write_interop_subtitle_test3/d36f4bb3-c4fa-4a95-9915-6fec3110cd71.png differ diff --git a/test/ref/write_interop_subtitle_test3/pkl.xml b/test/ref/write_interop_subtitle_test3/pkl.xml deleted file mode 120000 index 23d28034..00000000 --- a/test/ref/write_interop_subtitle_test3/pkl.xml +++ /dev/null @@ -1 +0,0 @@ -pkl_6a9e31a6-50a4-4ecb-8683-fa667848470a.xml \ No newline at end of file diff --git a/test/ref/write_interop_subtitle_test3/pkl.xml b/test/ref/write_interop_subtitle_test3/pkl.xml new file mode 100644 index 00000000..f82e98c4 --- /dev/null +++ b/test/ref/write_interop_subtitle_test3/pkl.xml @@ -0,0 +1,30 @@ + + + urn:uuid:6a9e31a6-50a4-4ecb-8683-fa667848470a + Created by libdcp + 2018-09-02T04:45:18+00:00 + libdcp + libdcp + + + urn:uuid:46c3eb45-15e5-47d6-8684-d8641e4dc516 + 46c3eb45-15e5-47d6-8684-d8641e4dc516 + hu0RaV4ZgrcqQQtgOW4r/YznVo0= + 1105 + text/xml;asdcpKind=CPL + + + urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6 + a6c58cff-3e1e-4b38-acec-a42224475ef6 + cVnFjMLTQnSIAlIzJpNB/p7B230= + 414 + text/xml;asdcpKind=Subtitle + + + urn:uuid:d36f4bb3-c4fa-4a95-9915-6fec3110cd71 + 2vTylSKQ5MCQHbKPT4X+rlwfHk4= + 44861 + image/png + + + diff --git a/test/ref/write_interop_subtitle_test3/pkl_6a9e31a6-50a4-4ecb-8683-fa667848470a.xml b/test/ref/write_interop_subtitle_test3/pkl_6a9e31a6-50a4-4ecb-8683-fa667848470a.xml deleted file mode 100644 index 5e721188..00000000 --- a/test/ref/write_interop_subtitle_test3/pkl_6a9e31a6-50a4-4ecb-8683-fa667848470a.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - urn:uuid:6a9e31a6-50a4-4ecb-8683-fa667848470a - Created by libdcp - 2018-09-02T04:45:18+00:00 - libdcp - libdcp - - - urn:uuid:46c3eb45-15e5-47d6-8684-d8641e4dc516 - 46c3eb45-15e5-47d6-8684-d8641e4dc516 - hu0RaV4ZgrcqQQtgOW4r/YznVo0= - 1105 - text/xml;asdcpKind=CPL - - - urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6 - a6c58cff-3e1e-4b38-acec-a42224475ef6 - cVnFjMLTQnSIAlIzJpNB/p7B230= - 414 - text/xml;asdcpKind=Subtitle - - - urn:uuid:d36f4bb3-c4fa-4a95-9915-6fec3110cd71 - w0Xc4TUYpao08I0yPSDfFkaEwdg= - 44935 - image/png - - - diff --git a/test/test.cc b/test/test.cc index 7a08cfc3..1d336806 100644 --- a/test/test.cc +++ b/test/test.cc @@ -404,6 +404,7 @@ make_simple_with_smpte_subs (boost::filesystem::path path) shared_ptr subs(new dcp::SMPTESubtitleAsset()); subs->set_language (dcp::LanguageTag("de-DE")); + subs->set_start_time (dcp::Time()); subs->add (simple_subtitle()); subs->write (path / "subs.mxf"); @@ -438,6 +439,7 @@ make_simple_with_smpte_ccaps (boost::filesystem::path path) shared_ptr subs(new dcp::SMPTESubtitleAsset()); subs->set_language (dcp::LanguageTag("de-DE")); + subs->set_start_time (dcp::Time()); subs->add (simple_subtitle()); subs->write (path / "ccap.mxf"); 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