Bv2.1 8.1: CPL must have <AnnotationText>.
[libdcp.git] / test / verify_test.cc
index 1877e284a6a99e6a5394e11fe5e28cdb20ab3dff..98a28cbc3635d960b0f39478612b9a342a9750c4 100644 (file)
@@ -1452,7 +1452,7 @@ BOOST_AUTO_TEST_CASE (verify_text_not_too_short)
 
 BOOST_AUTO_TEST_CASE (verify_too_many_subtitle_lines1)
 {
-       auto const dir = boost::filesystem::path ("verify_too_many_subtitle_lines1");
+       auto const dir = boost::filesystem::path ("build/test/verify_too_many_subtitle_lines1");
        dcp_with_text<dcp::ReelSubtitleAsset> (
                dir,
                {
@@ -1467,7 +1467,7 @@ BOOST_AUTO_TEST_CASE (verify_too_many_subtitle_lines1)
 
 BOOST_AUTO_TEST_CASE (verify_not_too_many_subtitle_lines1)
 {
-       auto const dir = boost::filesystem::path ("verify_not_too_many_subtitle_lines1");
+       auto const dir = boost::filesystem::path ("build/test/verify_not_too_many_subtitle_lines1");
        dcp_with_text<dcp::ReelSubtitleAsset> (
                dir,
                {
@@ -1482,7 +1482,7 @@ BOOST_AUTO_TEST_CASE (verify_not_too_many_subtitle_lines1)
 
 BOOST_AUTO_TEST_CASE (verify_too_many_subtitle_lines2)
 {
-       auto const dir = boost::filesystem::path ("verify_too_many_subtitle_lines2");
+       auto const dir = boost::filesystem::path ("build/test/verify_too_many_subtitle_lines2");
        dcp_with_text<dcp::ReelSubtitleAsset> (
                dir,
                {
@@ -1497,7 +1497,7 @@ BOOST_AUTO_TEST_CASE (verify_too_many_subtitle_lines2)
 
 BOOST_AUTO_TEST_CASE (verify_not_too_many_subtitle_lines2)
 {
-       auto const dir = boost::filesystem::path ("verify_not_too_many_subtitle_lines2");
+       auto const dir = boost::filesystem::path ("build/test/verify_not_too_many_subtitle_lines2");
        dcp_with_text<dcp::ReelSubtitleAsset> (
                dir,
                {
@@ -1513,7 +1513,7 @@ BOOST_AUTO_TEST_CASE (verify_not_too_many_subtitle_lines2)
 
 BOOST_AUTO_TEST_CASE (verify_subtitle_lines_too_long1)
 {
-       auto const dir = boost::filesystem::path ("verify_subtitle_lines_too_long1");
+       auto const dir = boost::filesystem::path ("build/test/verify_subtitle_lines_too_long1");
        dcp_with_text<dcp::ReelSubtitleAsset> (
                dir,
                {
@@ -1525,7 +1525,7 @@ BOOST_AUTO_TEST_CASE (verify_subtitle_lines_too_long1)
 
 BOOST_AUTO_TEST_CASE (verify_subtitle_lines_too_long2)
 {
-       auto const dir = boost::filesystem::path ("verify_subtitle_lines_too_long2");
+       auto const dir = boost::filesystem::path ("build/test/verify_subtitle_lines_too_long2");
        dcp_with_text<dcp::ReelSubtitleAsset> (
                dir,
                {
@@ -1537,7 +1537,7 @@ BOOST_AUTO_TEST_CASE (verify_subtitle_lines_too_long2)
 
 BOOST_AUTO_TEST_CASE (verify_too_many_closed_caption_lines1)
 {
-       auto const dir = boost::filesystem::path ("verify_too_many_closed_caption_lines1");
+       auto const dir = boost::filesystem::path ("build/test/verify_too_many_closed_caption_lines1");
        dcp_with_text<dcp::ReelClosedCaptionAsset> (
                dir,
                {
@@ -1552,7 +1552,7 @@ BOOST_AUTO_TEST_CASE (verify_too_many_closed_caption_lines1)
 
 BOOST_AUTO_TEST_CASE (verify_not_too_many_closed_caption_lines1)
 {
-       auto const dir = boost::filesystem::path ("verify_not_too_many_closed_caption_lines1");
+       auto const dir = boost::filesystem::path ("build/test/verify_not_too_many_closed_caption_lines1");
        dcp_with_text<dcp::ReelClosedCaptionAsset> (
                dir,
                {
@@ -1567,7 +1567,7 @@ BOOST_AUTO_TEST_CASE (verify_not_too_many_closed_caption_lines1)
 
 BOOST_AUTO_TEST_CASE (verify_too_many_closed_caption_lines2)
 {
-       auto const dir = boost::filesystem::path ("verify_too_many_closed_caption_lines2");
+       auto const dir = boost::filesystem::path ("build/test/verify_too_many_closed_caption_lines2");
        dcp_with_text<dcp::ReelClosedCaptionAsset> (
                dir,
                {
@@ -1582,7 +1582,7 @@ BOOST_AUTO_TEST_CASE (verify_too_many_closed_caption_lines2)
 
 BOOST_AUTO_TEST_CASE (verify_not_too_many_closed_caption_lines2)
 {
-       auto const dir = boost::filesystem::path ("verify_not_too_many_closed_caption_lines2");
+       auto const dir = boost::filesystem::path ("build/test/verify_not_too_many_closed_caption_lines2");
        dcp_with_text<dcp::ReelClosedCaptionAsset> (
                dir,
                {
@@ -1598,7 +1598,7 @@ BOOST_AUTO_TEST_CASE (verify_not_too_many_closed_caption_lines2)
 
 BOOST_AUTO_TEST_CASE (verify_closed_caption_lines_too_long1)
 {
-       auto const dir = boost::filesystem::path ("verify_closed_caption_lines_too_long1");
+       auto const dir = boost::filesystem::path ("build/test/verify_closed_caption_lines_too_long1");
        dcp_with_text<dcp::ReelClosedCaptionAsset> (
                dir,
                {
@@ -1607,3 +1607,47 @@ BOOST_AUTO_TEST_CASE (verify_closed_caption_lines_too_long1)
        check_verify_result ({dir}, {{ dcp::VerificationNote::VERIFY_BV21_ERROR, dcp::VerificationNote::CLOSED_CAPTION_LINE_TOO_LONG }});
 }
 
+
+BOOST_AUTO_TEST_CASE (verify_sound_sampling_rate_must_be_48k)
+{
+       boost::filesystem::path const dir("build/test/verify_sound_sampling_rate_must_be_48k");
+       prepare_directory (dir);
+
+       auto picture = simple_picture (dir, "foo");
+       auto reel_picture = make_shared<dcp::ReelMonoPictureAsset>(picture, 0);
+       auto reel = make_shared<dcp::Reel>();
+       reel->add (reel_picture);
+       auto sound = simple_sound (dir, "foo", dcp::MXFMetadata(), "de-DE", 24, 96000);
+       auto reel_sound = make_shared<dcp::ReelSoundAsset>(sound, 0);
+       reel->add (reel_sound);
+       auto cpl = make_shared<dcp::CPL>("hello", dcp::FEATURE);
+       cpl->add (reel);
+       auto dcp = make_shared<dcp::DCP>(dir);
+       dcp->add (cpl);
+       dcp->write_xml (dcp::SMPTE);
+
+       check_verify_result ({dir}, {{ dcp::VerificationNote::VERIFY_BV21_ERROR, dcp::VerificationNote::INVALID_SOUND_FRAME_RATE }});
+}
+
+
+BOOST_AUTO_TEST_CASE (verify_cpl_must_have_annotation_text)
+{
+       boost::filesystem::path const dir("build/test/verify_cpl_must_have_annotation_text");
+       auto dcp = make_simple (dir);
+       dcp->write_xml (dcp::SMPTE);
+       BOOST_REQUIRE_EQUAL (dcp->cpls().size(), 1U);
+
+       {
+               BOOST_REQUIRE (dcp->cpls()[0]->file());
+               Editor e(dcp->cpls()[0]->file().get());
+               e.replace("<AnnotationText>A Test DCP</AnnotationText>", "");
+       }
+
+       check_verify_result (
+               {dir},
+               {
+                       { dcp::VerificationNote::VERIFY_BV21_ERROR, dcp::VerificationNote::MISSING_ANNOTATION_TEXT_IN_CPL },
+                       { dcp::VerificationNote::VERIFY_ERROR, dcp::VerificationNote::CPL_HASH_INCORRECT }
+               });
+}
+