summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-12-15 00:51:34 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-17 20:13:22 +0100
commite182156f75a74457c4452cc3bfe91d778d0d7148 (patch)
tree7c929330d3953a76c801d4ba22bc9936da7c94d2 /test
parent7c5237f7f45b85a6030b345cf4542ed4059fa5c9 (diff)
Bv2.1 7.2.2: Check that subtitle languages are the same for all reels.
Diffstat (limited to 'test')
-rw-r--r--test/test.h1
-rw-r--r--test/verify_test.cc36
2 files changed, 37 insertions, 0 deletions
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<std::string>
extern void check_file (boost::filesystem::path ref, boost::filesystem::path check);
extern std::shared_ptr<dcp::MonoPictureAsset> simple_picture (boost::filesystem::path path, std::string suffix);
extern std::shared_ptr<dcp::SoundAsset> simple_sound (boost::filesystem::path path, std::string suffix, dcp::MXFMetadata mxf_meta, std::string language);
+extern std::shared_ptr<dcp::Subtitle> simple_subtitle ();
extern std::shared_ptr<dcp::DCP> make_simple (boost::filesystem::path path, int reels = 1);
extern std::shared_ptr<dcp::DCP> make_simple_with_interop_subs (boost::filesystem::path path);
extern std::shared_ptr<dcp::DCP> 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::DCP> dcp = make_simple (path, 2);
+ shared_ptr<dcp::CPL> cpl = dcp->cpls().front();
+
+ {
+ shared_ptr<dcp::SMPTESubtitleAsset> subs(new dcp::SMPTESubtitleAsset());
+ subs->set_language (dcp::LanguageTag("de-DE"));
+ subs->add (simple_subtitle());
+ subs->write (path / "subs1.mxf");
+ shared_ptr<dcp::ReelSubtitleAsset> reel_subs(new dcp::ReelSubtitleAsset(subs, dcp::Fraction(24, 1), 240, 0));
+ cpl->reels().front()->add (reel_subs);
+ }
+
+ {
+ shared_ptr<dcp::SMPTESubtitleAsset> subs(new dcp::SMPTESubtitleAsset());
+ subs->set_language (dcp::LanguageTag("en-US"));
+ subs->add (simple_subtitle());
+ subs->write (path / "subs2.mxf");
+ shared_ptr<dcp::ReelSubtitleAsset> reel_subs(new dcp::ReelSubtitleAsset(subs, dcp::Fraction(24, 1), 240, 0));
+ cpl->reels().back()->add (reel_subs);
+ }
+
+ dcp->write_xml (dcp::SMPTE);
+
+ vector<boost::filesystem::path> dirs;
+ dirs.push_back (path);
+ list<dcp::VerificationNote> 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);
+}
+