+
+
+BOOST_AUTO_TEST_CASE(verify_duplicate_pkl_asset_ids)
+{
+ RNGFixer rg;
+
+ path dir = "build/test/verify_duplicate_pkl_asset_ids";
+ prepare_directory(dir);
+ auto dcp = make_simple(dir, 1, 24);
+ dcp->write_xml();
+
+ {
+ Editor e(find_pkl(dir));
+ e.replace("urn:uuid:5407b210-4441-4e97-8b16-8bdc7c12da54", "urn:uuid:6affb8ee-0020-4dff-a53c-17652f6358ab");
+ }
+
+ dcp::PKL pkl(find_pkl(dir));
+ auto cpl = std::make_shared<dcp::CPL>(find_cpl(dir));
+
+ check_verify_result(
+ { dir },
+ {},
+ {
+ ok(dcp::VerificationNote::Code::MATCHING_PKL_ANNOTATION_TEXT_WITH_CPL, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_CPL_HASHES, cpl),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::OK,
+ dcp::VerificationNote::Code::VALID_MAIN_PICTURE_ACTIVE_AREA,
+ string{"1998x1080"},
+ canonical(cpl->file().get())
+ ).set_cpl_id(cpl->id()),
+ ok(dcp::VerificationNote::Code::VALID_CPL_ANNOTATION_TEXT, string{"A Test DCP"}, cpl),
+ ok(dcp::VerificationNote::Code::NONE_ENCRYPTED, cpl),
+ { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::DUPLICATE_ASSET_ID_IN_PKL, pkl.id(), canonical(find_pkl(dir)) },
+ });
+}
+
+
+BOOST_AUTO_TEST_CASE(verify_duplicate_assetmap_asset_ids)
+{
+ RNGFixer rg;
+
+ path dir = "build/test/verify_duplicate_assetmap_asset_ids";
+ prepare_directory(dir);
+ auto dcp = make_simple(dir, 1, 24);
+ dcp->write_xml();
+
+ {
+ Editor e(find_asset_map(dir));
+ e.replace("urn:uuid:5407b210-4441-4e97-8b16-8bdc7c12da54", "urn:uuid:97f0f352-5b77-48ee-a558-9df37717f4fa");
+ }
+
+ dcp::PKL pkl(find_pkl(dir));
+ dcp::AssetMap asset_map(find_asset_map(dir));
+ auto cpl = make_shared<dcp::CPL>(find_cpl(dir));
+
+ check_verify_result(
+ { dir },
+ {},
+ {
+ ok(dcp::VerificationNote::Code::MATCHING_PKL_ANNOTATION_TEXT_WITH_CPL, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_CPL_HASHES, cpl),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::OK,
+ dcp::VerificationNote::Code::VALID_MAIN_PICTURE_ACTIVE_AREA,
+ string{"1998x1080"},
+ canonical(cpl->file().get())
+ ).set_cpl_id(cpl->id()),
+ ok(dcp::VerificationNote::Code::VALID_CPL_ANNOTATION_TEXT, string{"A Test DCP"}, cpl),
+ ok(dcp::VerificationNote::Code::NONE_ENCRYPTED, cpl),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::DUPLICATE_ASSET_ID_IN_ASSETMAP, asset_map.id(), canonical(find_asset_map(dir))
+ ),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::WARNING, dcp::VerificationNote::Code::EXTERNAL_ASSET, string("5407b210-4441-4e97-8b16-8bdc7c12da54")
+ )
+ });
+}
+
+
+BOOST_AUTO_TEST_CASE(verify_mismatched_sound_channel_counts)
+{
+ boost::filesystem::path const path = "build/test/verify_mismatched_sound_channel_counts";
+
+ dcp::MXFMetadata mxf_meta;
+ mxf_meta.company_name = "OpenDCP";
+ mxf_meta.product_name = "OpenDCP";
+ mxf_meta.product_version = "0.0.25";
+
+ auto constexpr sample_rate = 48000;
+ auto constexpr frames = 240;
+
+ boost::filesystem::remove_all(path);
+ boost::filesystem::create_directories(path);
+ auto dcp = make_shared<dcp::DCP>(path);
+ auto cpl = make_shared<dcp::CPL>("hello", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE);
+ cpl->set_annotation_text("hello");
+ cpl->set_main_sound_configuration(dcp::MainSoundConfiguration("51/L,R"));
+ cpl->set_main_sound_sample_rate(sample_rate);
+ cpl->set_main_picture_stored_area(dcp::Size(1998, 1080));
+ cpl->set_main_picture_active_area(dcp::Size(1998, 1080));
+ cpl->set_version_number(1);
+
+ {
+
+ /* Reel with 2 channels of audio */
+
+ auto mp = simple_picture(path, "1", frames, {});
+ auto ms = simple_sound(path, "1", mxf_meta, "en-US", frames, sample_rate, {}, 2);
+
+ auto reel = make_shared<dcp::Reel>(
+ std::make_shared<dcp::ReelMonoPictureAsset>(mp, 0),
+ std::make_shared<dcp::ReelSoundAsset>(ms, 0)
+ );
+
+ auto markers = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), frames);
+ markers->set(dcp::Marker::FFOC, dcp::Time(0, 0, 0, 1, 24));
+ reel->add(markers);
+
+ cpl->add(reel);
+ }
+
+ {
+ /* Reel with 6 channels of audio */
+
+ auto mp = simple_picture(path, "2", frames, {});
+ auto ms = simple_sound(path, "2", mxf_meta, "en-US", frames, sample_rate, {}, 6);
+
+ auto reel = make_shared<dcp::Reel>(
+ std::make_shared<dcp::ReelMonoPictureAsset>(mp, 0),
+ std::make_shared<dcp::ReelSoundAsset>(ms, 0)
+ );
+
+ auto markers = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), frames);
+ markers->set(dcp::Marker::LFOC, dcp::Time(0, 0, 0, frames - 1, 24));
+ reel->add(markers);
+
+ cpl->add(reel);
+ }
+
+ dcp->add(cpl);
+ dcp->set_annotation_text("hello");
+ dcp->write_xml();
+
+ check_verify_result(
+ { path },
+ {},
+ {
+ ok(dcp::VerificationNote::Code::NONE_ENCRYPTED, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_PKL_ANNOTATION_TEXT_WITH_CPL, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_CPL_HASHES, cpl),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::OK,
+ dcp::VerificationNote::Code::VALID_MAIN_PICTURE_ACTIVE_AREA,
+ string{"1998x1080"},
+ cpl->file().get()
+ ).set_cpl_id(cpl->id()),
+ ok(dcp::VerificationNote::Code::VALID_CPL_ANNOTATION_TEXT, string{"hello"}, cpl),
+ ok(dcp::VerificationNote::Code::CORRECT_PICTURE_HASH, canonical(path / "video1.mxf"), cpl),
+ ok(dcp::VerificationNote::Code::VALID_PICTURE_FRAME_SIZES_IN_BYTES, canonical(path / "video1.mxf"), cpl),
+ ok(dcp::VerificationNote::Code::CORRECT_PICTURE_HASH, canonical(path / "video2.mxf"), cpl),
+ ok(dcp::VerificationNote::Code::VALID_PICTURE_FRAME_SIZES_IN_BYTES, canonical(path / "video2.mxf"), cpl),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_SOUND_CHANNEL_COUNTS, canonical(find_file(path, "audio2"))
+ ).set_cpl_id(cpl->id())
+ });
+}
+
+
+BOOST_AUTO_TEST_CASE(verify_invalid_main_sound_configuration)
+{
+ boost::filesystem::path const path = "build/test/verify_invalid_main_sound_configuration";
+
+ dcp::MXFMetadata mxf_meta;
+ mxf_meta.company_name = "OpenDCP";
+ mxf_meta.product_name = "OpenDCP";
+ mxf_meta.product_version = "0.0.25";
+
+ auto constexpr sample_rate = 48000;
+ auto constexpr frames = 240;
+
+ boost::filesystem::remove_all(path);
+ boost::filesystem::create_directories(path);
+ auto dcp = make_shared<dcp::DCP>(path);
+ auto cpl = make_shared<dcp::CPL>("hello", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE);
+ cpl->set_annotation_text("hello");
+ cpl->set_main_sound_configuration(dcp::MainSoundConfiguration("51/L,R,C,LFE,Ls,Rs"));
+ cpl->set_main_sound_sample_rate(sample_rate);
+ cpl->set_main_picture_stored_area(dcp::Size(1998, 1080));
+ cpl->set_main_picture_active_area(dcp::Size(1998, 1080));
+ cpl->set_version_number(1);
+
+ auto mp = simple_picture(path, "1", frames, {});
+ auto ms = simple_sound(path, "1", mxf_meta, "en-US", frames, sample_rate, {}, 2);
+
+ auto reel = make_shared<dcp::Reel>(
+ std::make_shared<dcp::ReelMonoPictureAsset>(mp, 0),
+ std::make_shared<dcp::ReelSoundAsset>(ms, 0)
+ );
+
+ auto markers = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), frames);
+ markers->set(dcp::Marker::FFOC, dcp::Time(0, 0, 0, 1, 24));
+ markers->set(dcp::Marker::LFOC, dcp::Time(0, 0, 9, 23, 24));
+ reel->add(markers);
+
+ cpl->add(reel);
+
+ dcp->add(cpl);
+ dcp->set_annotation_text("hello");
+ dcp->write_xml();
+
+ check_verify_result(
+ { path },
+ {},
+ {
+ ok(dcp::VerificationNote::Code::NONE_ENCRYPTED, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_PKL_ANNOTATION_TEXT_WITH_CPL, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_CPL_HASHES, cpl),
+ ok(dcp::VerificationNote::Code::VALID_CPL_ANNOTATION_TEXT, string{"hello"}, cpl),
+ ok(dcp::VerificationNote::Code::CORRECT_PICTURE_HASH, canonical(path / "video1.mxf"), cpl),
+ ok(dcp::VerificationNote::Code::VALID_PICTURE_FRAME_SIZES_IN_BYTES, canonical(path / "video1.mxf"), cpl),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::OK,
+ dcp::VerificationNote::Code::VALID_MAIN_PICTURE_ACTIVE_AREA,
+ string{"1998x1080"},
+ cpl->file().get()
+ ).set_cpl_id(cpl->id()),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_MAIN_SOUND_CONFIGURATION, std::string{"MainSoundConfiguration has 6 channels but sound assets have 2"}, canonical(find_cpl(path))
+ ).set_cpl_id(cpl->id())
+ });
+}
+
+
+BOOST_AUTO_TEST_CASE(verify_invalid_tile_part_size)
+{
+ boost::filesystem::path const path = "build/test/verify_invalid_tile_part_size";
+ auto constexpr video_frames = 24;
+ auto constexpr sample_rate = 48000;
+
+ boost::filesystem::remove_all(path);
+ boost::filesystem::create_directories(path);
+
+ auto mp = make_shared<dcp::MonoPictureAsset>(dcp::Fraction(24, 1), dcp::Standard::SMPTE);
+ auto picture_writer = mp->start_write(path / "video.mxf", dcp::PictureAsset::Behaviour::MAKE_NEW);
+
+ dcp::Size const size(1998, 1080);
+ auto image = make_shared<dcp::OpenJPEGImage>(size);
+ boost::random::mt19937 rng(1);
+ boost::random::uniform_int_distribution<> dist(0, 4095);
+ for (int c = 0; c < 3; ++c) {
+ for (int p = 0; p < (1998 * 1080); ++p) {
+ image->data(c)[p] = dist(rng);
+ }
+ }
+ auto j2c = dcp::compress_j2k(image, 750000000, video_frames, false, false);
+ for (int i = 0; i < 24; ++i) {
+ picture_writer->write(j2c.data(), j2c.size());
+ }
+ picture_writer->finalize();
+
+ auto dcp = make_shared<dcp::DCP>(path);
+ auto cpl = make_shared<dcp::CPL>("A Test DCP", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE);
+ cpl->set_content_version(
+ dcp::ContentVersion("urn:uuid:75ac29aa-42ac-1234-ecae-49251abefd11", "content-version-label-text")
+ );
+ cpl->set_main_sound_configuration(dcp::MainSoundConfiguration("51/L,R,C,LFE,Ls,Rs"));
+ cpl->set_main_sound_sample_rate(sample_rate);
+ cpl->set_main_picture_stored_area(dcp::Size(1998, 1080));
+ cpl->set_main_picture_active_area(dcp::Size(1998, 1080));
+ cpl->set_version_number(1);
+
+ auto ms = simple_sound(path, "", dcp::MXFMetadata(), "en-US", video_frames, sample_rate, {});
+
+ auto reel = make_shared<dcp::Reel>(
+ make_shared<dcp::ReelMonoPictureAsset>(mp, 0),
+ make_shared<dcp::ReelSoundAsset>(ms, 0)
+ );
+
+ cpl->add(reel);
+ dcp->add(cpl);
+ dcp->set_annotation_text("A Test DCP");
+ dcp->write_xml();
+
+ vector<dcp::VerificationNote> expected = {
+ ok(dcp::VerificationNote::Code::NONE_ENCRYPTED, cpl),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::OK,
+ dcp::VerificationNote::Code::VALID_MAIN_PICTURE_ACTIVE_AREA,
+ string{"1998x1080"},
+ cpl->file().get()
+ ).set_cpl_id(cpl->id()),
+ ok(dcp::VerificationNote::Code::CORRECT_PICTURE_HASH, canonical(path / "video.mxf"), cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_PKL_ANNOTATION_TEXT_WITH_CPL, cpl),
+ ok(dcp::VerificationNote::Code::VALID_CPL_ANNOTATION_TEXT, string{"A Test DCP"}, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_CPL_HASHES, cpl),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::WARNING, dcp::VerificationNote::Code::MISSING_FFOC
+ ).set_cpl_id(cpl->id()),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::WARNING, dcp::VerificationNote::Code::MISSING_LFOC
+ ).set_cpl_id(cpl->id())
+ };
+
+ for (auto frame = 0; frame < 24; frame++) {
+ expected.push_back(
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_PICTURE_FRAME_SIZE_IN_BYTES, canonical(path / "video.mxf")
+ ).set_frame(frame).set_frame_rate(24).set_cpl_id(cpl->id())
+ );
+ }
+
+ int component_sizes[] = {
+ 1321816,
+ 1294414,
+ 1289881,
+ };
+
+ for (auto frame = 0; frame < 24; frame++) {
+ for (auto component = 0; component < 3; component++) {
+ expected.push_back(
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_JPEG2000_TILE_PART_SIZE
+ ).set_frame(frame).set_component(component).set_size(component_sizes[component]).set_cpl_id(cpl->id())
+ );
+ }
+ }
+
+ check_verify_result({ path }, {}, expected);
+}
+
+
+BOOST_AUTO_TEST_CASE(verify_too_many_subtitle_namespaces)
+{
+ boost::filesystem::path const dir = "test/ref/DCP/subtitle_namespace_test";
+ dcp::DCP dcp(dir);
+ dcp.read();
+ BOOST_REQUIRE(!dcp.cpls().empty());
+ auto cpl = dcp.cpls()[0];
+
+ check_verify_result(
+ { dir },
+ {},
+ {
+ ok(dcp::VerificationNote::Code::NONE_ENCRYPTED, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_PKL_ANNOTATION_TEXT_WITH_CPL, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_CPL_HASHES, cpl),
+ ok(dcp::VerificationNote::Code::VALID_CPL_ANNOTATION_TEXT, string{"Dcp_FTR-1_F_XX-XX_MOS_2K_20230407_SMPTE_OV"}, cpl),
+ ok(dcp::VerificationNote::Code::CORRECT_PICTURE_HASH, canonical(dir / "j2c_42b34dcd-caa5-4c7b-aa0f-66a590947ba1.mxf"), cpl),
+ ok(dcp::VerificationNote::Code::VALID_PICTURE_FRAME_SIZES_IN_BYTES, canonical(dir / "j2c_42b34dcd-caa5-4c7b-aa0f-66a590947ba1.mxf"), cpl),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE
+ ).set_cpl_id(cpl->id()),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE
+ ).set_cpl_id(cpl->id()),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::WARNING, dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME
+ ).set_cpl_id(cpl->id()),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE, canonical(find_file(dir, "sub_"))
+ ).set_cpl_id(cpl->id()),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_CPL_METADATA, canonical(find_file(dir, "cpl_"))
+ ).set_cpl_id(cpl->id()),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::WARNING, dcp::VerificationNote::Code::INCORRECT_SUBTITLE_NAMESPACE_COUNT, std::string{"315de731-1173-484c-9a35-bdacf5a9d99d"}
+ ).set_cpl_id(cpl->id()),
+ });
+}
+
+
+BOOST_AUTO_TEST_CASE(verify_missing_load_font_for_font)
+{
+ path const dir("build/test/verify_missing_load_font");
+ prepare_directory (dir);
+ copy_file ("test/data/subs1.xml", dir / "subs.xml");
+ {
+ Editor editor(dir / "subs.xml");
+ editor.delete_first_line_containing("LoadFont");
+ }
+ auto asset = make_shared<dcp::InteropSubtitleAsset>(dir / "subs.xml");
+ auto reel_asset = make_shared<dcp::ReelInteropSubtitleAsset>(asset, dcp::Fraction(24, 1), 16 * 24, 0);
+ auto cpl = write_dcp_with_single_asset(dir, reel_asset, dcp::Standard::INTEROP);
+
+ check_verify_result (
+ {dir},
+ {},
+ {
+ ok(dcp::VerificationNote::Code::NONE_ENCRYPTED, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_PKL_ANNOTATION_TEXT_WITH_CPL, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_CPL_HASHES, cpl),
+ { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::INVALID_STANDARD },
+ dcp::VerificationNote(dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISSING_LOAD_FONT_FOR_FONT).set_id("theFontId").set_cpl_id(cpl->id())
+ });
+
+}
+
+
+BOOST_AUTO_TEST_CASE(verify_missing_load_font)
+{
+ boost::filesystem::path const dir = "build/test/verify_missing_load_font";
+ prepare_directory(dir);
+ auto dcp = make_simple (dir, 1, 202);
+
+ string const xml =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<SubtitleReel xmlns=\"http://www.smpte-ra.org/schemas/428-7/2010/DCST\">"
+ "<Id>urn:uuid:e6a8ae03-ebbf-41ed-9def-913a87d1493a</Id>"
+ "<ContentTitleText>Content</ContentTitleText>"
+ "<AnnotationText>Annotation</AnnotationText>"
+ "<IssueDate>2018-10-02T12:25:14+02:00</IssueDate>"
+ "<ReelNumber>1</ReelNumber>"
+ "<EditRate>24 1</EditRate>"
+ "<TimeCodeRate>24</TimeCodeRate>"
+ "<StartTime>00:00:00:00</StartTime>"
+ "<Language>de-DE</Language>"
+ "<SubtitleList>"
+ "<Font ID=\"arial\" Color=\"FFFEFEFE\" Weight=\"normal\" Size=\"42\" Effect=\"border\" EffectColor=\"FF181818\" AspectAdjust=\"1.00\">"
+ "<Subtitle SpotNumber=\"1\" TimeIn=\"00:00:06:00\" TimeOut=\"00:00:08:10\" FadeUpTime=\"00:00:00:00\" FadeDownTime=\"00:00:00:00\">"
+ "<Text Hposition=\"0.0\" Halign=\"center\" Valign=\"bottom\" Vposition=\"13.5\" Direction=\"ltr\">Hello world</Text>"
+ "</Subtitle>"
+ "</Font>"
+ "</SubtitleList>"
+ "</SubtitleReel>";
+
+ dcp::File xml_file(dir / "subs.xml", "w");
+ BOOST_REQUIRE(xml_file);
+ xml_file.write(xml.c_str(), xml.size(), 1);
+ xml_file.close();
+ auto subs = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.xml");
+ subs->write(dir / "subs.mxf");
+
+ auto reel_subs = make_shared<dcp::ReelSMPTESubtitleAsset>(subs, dcp::Fraction(24, 1), 202, 0);
+ auto cpl = dcp->cpls()[0];
+ cpl->reels()[0]->add(reel_subs);
+ dcp->write_xml();
+
+ check_verify_result (
+ { dir },
+ {},
+ {
+ ok(dcp::VerificationNote::Code::NONE_ENCRYPTED, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_PKL_ANNOTATION_TEXT_WITH_CPL, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_CPL_HASHES, cpl),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::OK,
+ dcp::VerificationNote::Code::VALID_MAIN_PICTURE_ACTIVE_AREA,
+ string{"1998x1080"},
+ cpl->file().get()
+ ).set_cpl_id(cpl->id()),
+ ok(dcp::VerificationNote::Code::VALID_CPL_ANNOTATION_TEXT, string{"A Test DCP"}, cpl),
+ ok(dcp::VerificationNote::Code::CORRECT_PICTURE_HASH, canonical(dir / "video.mxf"), cpl),
+ ok(dcp::VerificationNote::Code::VALID_PICTURE_FRAME_SIZES_IN_BYTES, canonical(dir / "video.mxf"), cpl),
+ dcp::VerificationNote(dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISSING_LOAD_FONT).set_id(reel_subs->id()).set_cpl_id(cpl->id())
+ });
+}
+
+
+BOOST_AUTO_TEST_CASE(verify_spots_wrong_asset)
+{
+ boost::filesystem::path const dir = "build/test/verify_spots_wrong_asset";
+ boost::filesystem::remove_all(dir);
+
+ auto dcp1 = make_simple(dir / "1");
+ dcp1->write_xml();
+ auto cpl = dcp1->cpls()[0];
+
+ auto const asset_1 = dcp::MonoPictureAsset(dir / "1" / "video.mxf").id();
+
+ auto dcp2 = make_simple(dir / "2");
+ dcp2->write_xml();
+ auto const asset_2 = dcp::MonoPictureAsset(dir / "2" / "video.mxf").id();
+
+ boost::filesystem::remove(dir / "1" / "video.mxf");
+ boost::filesystem::copy_file(dir / "2" / "video.mxf", dir / "1" / "video.mxf");
+
+ check_verify_result(
+ {dir / "1"},
+ {},
+ {
+ ok(dcp::VerificationNote::Code::NONE_ENCRYPTED, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_PKL_ANNOTATION_TEXT_WITH_CPL, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_CPL_HASHES, cpl),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::OK,
+ dcp::VerificationNote::Code::VALID_MAIN_PICTURE_ACTIVE_AREA,
+ string{"1998x1080"},
+ cpl->file().get()
+ ).set_cpl_id(cpl->id()),
+ ok(dcp::VerificationNote::Code::VALID_CPL_ANNOTATION_TEXT, string{"A Test DCP"}, cpl),
+ dcp::VerificationNote(dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_ASSET_MAP_ID).set_id(asset_1).set_other_id(asset_2)
+ });
+}
+
+
+BOOST_AUTO_TEST_CASE(verify_cpl_content_version_label_text_empty)
+{
+ boost::filesystem::path const dir = "build/test/verify_cpl_content_version_label_text_empty";
+ boost::filesystem::remove_all(dir);
+
+ auto dcp = make_simple(dir);
+ BOOST_REQUIRE(dcp->cpls().size() == 1);
+ auto cpl = dcp->cpls()[0];
+ cpl->set_content_version(dcp::ContentVersion(""));
+ dcp->write_xml();
+
+ check_verify_result(
+ {dir},
+ {},
+ {
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::OK,
+ dcp::VerificationNote::Code::VALID_MAIN_PICTURE_ACTIVE_AREA,
+ string{"1998x1080"},
+ cpl->file().get()
+ ).set_cpl_id(cpl->id()),
+ ok(dcp::VerificationNote::Code::NONE_ENCRYPTED, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_PKL_ANNOTATION_TEXT_WITH_CPL, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_CPL_HASHES, cpl),
+ ok(dcp::VerificationNote::Code::VALID_CPL_ANNOTATION_TEXT, string{"A Test DCP"}, cpl),
+ ok(dcp::VerificationNote::Code::CORRECT_PICTURE_HASH, canonical(dir / "video.mxf"), cpl),
+ ok(dcp::VerificationNote::Code::VALID_PICTURE_FRAME_SIZES_IN_BYTES, canonical(dir / "video.mxf"), cpl),
+ dcp::VerificationNote(dcp::VerificationNote::Type::WARNING, dcp::VerificationNote::Code::EMPTY_CONTENT_VERSION_LABEL_TEXT, cpl->file().get()).set_cpl_id(cpl->id())
+ });
+}
+
+
+/** Check that we don't get any strange errors when verifying encrypted DCPs (DoM #2659) */
+BOOST_AUTO_TEST_CASE(verify_encrypted_smpte_dcp)
+{
+ auto const dir = path("build/test/verify_encrypted_smpte_dcp");
+ dcp::Key key;
+ auto key_id = dcp::make_uuid();
+ auto cpl = dcp_with_text<dcp::ReelSMPTESubtitleAsset>(dir, {{ 4 * 24, 5 * 24 }}, key, key_id);
+
+ dcp::DecryptedKDM kdm(dcp::LocalTime(), dcp::LocalTime(), "", "", "");
+ kdm.add_key(dcp::DecryptedKDMKey(string{"MDIK"}, key_id, key, cpl->id(), dcp::Standard::SMPTE));
+
+ path const pkl_file = find_file(dir, "pkl_");
+ path const cpl_file = find_file(dir, "cpl_");
+
+ check_verify_result(
+ { dir },
+ { kdm },
+ {
+ ok(dcp::VerificationNote::Code::MATCHING_PKL_ANNOTATION_TEXT_WITH_CPL, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_CPL_HASHES, cpl),
+ ok(dcp::VerificationNote::Code::VALID_CPL_ANNOTATION_TEXT, string{"hello"}, cpl),
+ ok(dcp::VerificationNote::Code::ALL_ENCRYPTED, cpl),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_CPL_METADATA, canonical(cpl_file)
+ ).set_cpl_id(cpl->id()),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::UNSIGNED_CPL_WITH_ENCRYPTED_CONTENT, canonical(cpl_file)
+ ).set_cpl_id(cpl->id()),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::UNSIGNED_PKL_WITH_ENCRYPTED_CONTENT, filename_to_id(pkl_file.filename()), canonical(pkl_file)
+ )
+ });
+}
+
+