summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test.cc6
-rw-r--r--test/test.h2
-rw-r--r--test/verify_test.cc36
3 files changed, 41 insertions, 3 deletions
diff --git a/test/test.cc b/test/test.cc
index c24f28cd..c8f41d05 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -271,9 +271,11 @@ simple_picture (boost::filesystem::path path, string suffix)
shared_ptr<dcp::SoundAsset>
-simple_sound (boost::filesystem::path path, string suffix, dcp::MXFMetadata mxf_meta)
+simple_sound (boost::filesystem::path path, string suffix, dcp::MXFMetadata mxf_meta, string language)
{
+ /* Set a valid language, then overwrite it, so that the language parameter can be badly formed */
shared_ptr<dcp::SoundAsset> ms (new dcp::SoundAsset(dcp::Fraction(24, 1), 48000, 1, dcp::LanguageTag("en-US"), dcp::SMPTE));
+ ms->_language = language;
ms->set_metadata (mxf_meta);
vector<dcp::Channel> active_channels;
active_channels.push_back (dcp::LEFT);
@@ -325,7 +327,7 @@ make_simple (boost::filesystem::path path, int reels)
string suffix = reels == 1 ? "" : dcp::String::compose("%1", i);
shared_ptr<dcp::MonoPictureAsset> mp = simple_picture (path, suffix);
- shared_ptr<dcp::SoundAsset> ms = simple_sound (path, suffix, mxf_meta);
+ shared_ptr<dcp::SoundAsset> ms = simple_sound (path, suffix, mxf_meta, "en-US");
cpl->add (shared_ptr<dcp::Reel> (
new dcp::Reel (
diff --git a/test/test.h b/test/test.h
index 4fc88424..1368973a 100644
--- a/test/test.h
+++ b/test/test.h
@@ -44,7 +44,7 @@ extern void check_xml (xmlpp::Element* ref, xmlpp::Element* test, std::list<std:
extern void check_xml (std::string ref, std::string test, std::list<std::string> ignore, bool ignore_whitespace = false);
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);
+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::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 ac2d825b..89b46d72 100644
--- a/test/verify_test.cc
+++ b/test/verify_test.cc
@@ -36,6 +36,7 @@
#include "j2k.h"
#include "reel.h"
#include "reel_mono_picture_asset.h"
+#include "reel_sound_asset.h"
#include "cpl.h"
#include "dcp.h"
#include "openjpeg_image.h"
@@ -174,6 +175,10 @@ BOOST_AUTO_TEST_CASE (verify_test1)
BOOST_REQUIRE (st->second);
BOOST_CHECK_EQUAL (st->second.get(), boost::filesystem::canonical("build/test/verify_test1/audio.mxf"));
++st;
+ BOOST_CHECK_EQUAL (st->first, "Checking sound asset metadata");
+ BOOST_REQUIRE (st->second);
+ BOOST_CHECK_EQUAL (st->second.get(), boost::filesystem::canonical("build/test/verify_test1/audio.mxf"));
+ ++st;
BOOST_CHECK_EQUAL (st->first, "Checking PKL");
BOOST_REQUIRE (st->second);
BOOST_CHECK_EQUAL (st->second.get(), boost::filesystem::canonical(pkl_file));
@@ -481,6 +486,10 @@ BOOST_AUTO_TEST_CASE (verify_test13)
BOOST_REQUIRE (st->second);
BOOST_CHECK_EQUAL (st->second.get(), boost::filesystem::canonical("build/test/verify_test13/pcm_69cf9eaf-9a99-4776-b022-6902208626c3.mxf"));
++st;
+ BOOST_CHECK_EQUAL (st->first, "Checking sound asset metadata");
+ BOOST_REQUIRE (st->second);
+ BOOST_CHECK_EQUAL (st->second.get(), boost::filesystem::canonical("build/test/verify_test13/pcm_69cf9eaf-9a99-4776-b022-6902208626c3.mxf"));
+ ++st;
BOOST_CHECK_EQUAL (st->first, "Checking PKL");
BOOST_REQUIRE (st->second);
BOOST_CHECK_EQUAL (st->second.get(), boost::filesystem::canonical(pkl_file));
@@ -906,3 +915,30 @@ BOOST_AUTO_TEST_CASE (verify_test26)
BOOST_CHECK_EQUAL (*i->note(), "wrong-andbad");
}
+
+/* SMPTE DCP with invalid <Language> in the MainSound reel */
+BOOST_AUTO_TEST_CASE (verify_invalid_sound_reel_language)
+{
+ boost::filesystem::path const dir("build/test/verify_invalid_sound_reel_language");
+ prepare_directory (dir);
+
+ shared_ptr<dcp::SoundAsset> sound = simple_sound (dir, "foo", dcp::MXFMetadata(), "frobozz");
+ shared_ptr<dcp::ReelSoundAsset> reel_sound(new dcp::ReelSoundAsset(sound, 0));
+ shared_ptr<dcp::Reel> reel(new dcp::Reel());
+ reel->add (reel_sound);
+ shared_ptr<dcp::CPL> cpl(new dcp::CPL("hello", dcp::FEATURE));
+ cpl->add (reel);
+ shared_ptr<dcp::DCP> dcp(new dcp::DCP(dir));
+ dcp->add (cpl);
+ dcp->write_xml (dcp::SMPTE);
+
+ vector<boost::filesystem::path> dirs;
+ dirs.push_back (dir);
+ list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, xsd_test);
+ BOOST_REQUIRE_EQUAL (notes.size(), 1U);
+ list<dcp::VerificationNote>::const_iterator i = notes.begin ();
+ BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::BAD_LANGUAGE);
+ BOOST_REQUIRE (i->note());
+ BOOST_CHECK_EQUAL (*i->note(), "frobozz");
+}
+