diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-04-25 23:31:13 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-04-25 23:31:13 +0200 |
| commit | ef9671811920cbef50f0f01d063eab418de8925e (patch) | |
| tree | 0161463370f4a995f5e1b275b642de534b68f6d4 | |
| parent | 98227f0ca88034061092cd2a179c5cade2924f50 (diff) | |
Tidy up write_xml() API a little.
| -rw-r--r-- | src/asset_map.h | 16 | ||||
| -rw-r--r-- | src/combine.cc | 7 | ||||
| -rw-r--r-- | src/dcp.cc | 80 | ||||
| -rw-r--r-- | src/dcp.h | 21 | ||||
| -rw-r--r-- | src/pkl.h | 16 | ||||
| -rw-r--r-- | test/dcp_test.cc | 30 | ||||
| -rw-r--r-- | test/encryption_test.cc | 6 | ||||
| -rw-r--r-- | test/interop_subtitle_test.cc | 6 | ||||
| -rw-r--r-- | test/read_change_write_test.cc | 4 | ||||
| -rw-r--r-- | test/verify_test.cc | 263 |
10 files changed, 224 insertions, 225 deletions
diff --git a/src/asset_map.h b/src/asset_map.h index d135380f..cf91a95b 100644 --- a/src/asset_map.h +++ b/src/asset_map.h @@ -69,6 +69,22 @@ public: return _standard; } + void set_annotation_text(std::string annotation_text) { + _annotation_text = annotation_text; + } + + void set_issue_date(std::string issue_date) { + _issue_date = issue_date; + } + + void set_issuer(std::string issuer) { + _issuer = issuer; + } + + void set_creator(std::string creator) { + _creator = creator; + } + void clear_assets(); void add_asset(std::string id, boost::filesystem::path path, bool pkl); diff --git a/src/combine.cc b/src/combine.cc index e974c407..05ad519e 100644 --- a/src/combine.cc +++ b/src/combine.cc @@ -173,5 +173,10 @@ dcp::combine ( } } - output_dcp.write_xml (issuer, creator, issue_date, annotation_text, signer); + output_dcp.set_issuer(issuer); + output_dcp.set_creator(creator); + output_dcp.set_issue_date(issue_date); + output_dcp.set_annotation_text(annotation_text); + + output_dcp.write_xml(signer); } @@ -371,14 +371,7 @@ DCP::write_volindex (Standard standard) const void -DCP::write_xml ( - string issuer, - string creator, - string issue_date, - string annotation_text, - shared_ptr<const CertificateChain> signer, - NameFormat name_format - ) +DCP::write_xml (shared_ptr<const CertificateChain> signer, NameFormat name_format) { if (_cpls.empty()) { throw MiscError ("Cannot write DCP with no CPLs."); @@ -401,7 +394,15 @@ DCP::write_xml ( } if (_pkls.empty()) { - _pkls.push_back(make_shared<PKL>(standard, annotation_text, issue_date, issuer, creator)); + _pkls.push_back( + make_shared<PKL>( + standard, + _new_annotation_text.get_value_or(String::compose("Created by libdcp %1", dcp::version)), + _new_issue_date.get_value_or(LocalTime().as_string()), + _new_issuer.get_value_or(String::compose("libdcp %1", dcp::version)), + _new_creator.get_value_or(String::compose("libdcp %1", dcp::version)) + ) + ); } auto pkl = _pkls.front(); @@ -418,7 +419,13 @@ DCP::write_xml ( pkl->write (pkl_path, signer); if (!_asset_map) { - _asset_map = AssetMap(standard, annotation_text, issue_date, issuer, creator); + _asset_map = AssetMap( + standard, + _new_annotation_text.get_value_or(String::compose("Created by libdcp %1", dcp::version)), + _new_issue_date.get_value_or(LocalTime().as_string()), + _new_issuer.get_value_or(String::compose("libdcp %1", dcp::version)), + _new_creator.get_value_or(String::compose("libdcp %1", dcp::version)) + ); } /* The assets may have changed since we read the asset map, so re-add them */ @@ -490,3 +497,56 @@ DCP::directories_from_files (vector<boost::filesystem::path> files) } return d; } + + +void +DCP::set_issuer(string issuer) +{ + for (auto pkl: _pkls) { + pkl->set_issuer(issuer); + } + if (_asset_map) { + _asset_map->set_issuer(issuer); + } + _new_issuer = issuer; +} + + +void +DCP::set_creator(string creator) +{ + for (auto pkl: _pkls) { + pkl->set_creator(creator); + } + if (_asset_map) { + _asset_map->set_creator(creator); + } + _new_creator = creator; +} + + +void +DCP::set_issue_date(string issue_date) +{ + for (auto pkl: _pkls) { + pkl->set_issue_date(issue_date); + } + if (_asset_map) { + _asset_map->set_issue_date(issue_date); + } + _new_issue_date = issue_date; +} + + +void +DCP::set_annotation_text(string annotation_text) +{ + for (auto pkl: _pkls) { + pkl->set_annotation_text(annotation_text); + } + if (_asset_map) { + _asset_map->set_annotation_text(annotation_text); + } + _new_annotation_text = annotation_text; +} + @@ -142,20 +142,17 @@ public: */ void add (DecryptedKDM const &); - /** Write all the XML files for this DCP + void set_issuer(std::string issuer); + void set_creator(std::string creator); + void set_issue_date(std::string issue_date); + void set_annotation_text(std::string annotation_text); + + /** Write all the XML files for this DCP. * @param standand INTEROP or SMPTE - * @param issuer Value for the PKL and AssetMap <Issuer> tags - * @param creator Value for the PKL and AssetMap <Creator> tags - * @param issue_date Value for the PKL and AssetMap <IssueDate> tags - * @param annotation_text Value for the PKL and AssetMap <AnnotationText> tags * @param signer Signer to use * @param name_format Name format to use for the CPL and PKL filenames */ void write_xml ( - std::string issuer = String::compose("libdcp %1", dcp::version), - std::string creator = String::compose("libdcp %1", dcp::version), - std::string issue_date = LocalTime().as_string(), - std::string annotation_text = String::compose("Created by libdcp %1", dcp::version), std::shared_ptr<const CertificateChain> signer = std::shared_ptr<const CertificateChain>(), NameFormat name_format = NameFormat("%t") ); @@ -203,6 +200,12 @@ private: /** The PKLs that make up this DCP */ std::vector<std::shared_ptr<PKL>> _pkls; boost::optional<AssetMap> _asset_map; + + /* Metadata to use for newly created PKLs and AssetMaps */ + boost::optional<std::string> _new_issuer; + boost::optional<std::string> _new_creator; + boost::optional<std::string> _new_issue_date; + boost::optional<std::string> _new_annotation_text; }; @@ -73,6 +73,22 @@ public: return _annotation_text; } + void set_annotation_text(std::string annotation_text) { + _annotation_text = annotation_text; + } + + void set_issue_date(std::string issue_date) { + _issue_date = issue_date; + } + + void set_issuer(std::string issuer) { + _issuer = issuer; + } + + void set_creator(std::string creator) { + _creator = creator; + } + boost::optional<std::string> hash (std::string id) const; boost::optional<std::string> type (std::string id) const; diff --git a/test/dcp_test.cc b/test/dcp_test.cc index 0c246ad4..7618f2ee 100644 --- a/test/dcp_test.cc +++ b/test/dcp_test.cc @@ -67,9 +67,12 @@ BOOST_AUTO_TEST_CASE (dcp_test1) { RNGFixer fixer; - make_simple("build/test/DCP/dcp_test1")->write_xml( - "OpenDCP 0.0.25", "OpenDCP 0.0.25", "2012-07-17T04:45:18+00:00", "A Test DCP" - ); + auto dcp = make_simple("build/test/DCP/dcp_test1"); + dcp->set_issuer("OpenDCP 0.0.25"); + dcp->set_creator("OpenDCP 0.0.25"); + dcp->set_issue_date("2012-07-17T04:45:18+00:00"); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); /* build/test/DCP/dcp_test1 is checked against test/ref/DCP/dcp_test1 by run/tests */ } @@ -138,7 +141,11 @@ BOOST_AUTO_TEST_CASE (dcp_test2) d.add (cpl); - d.write_xml ("OpenDCP 0.0.25", "OpenDCP 0.0.25", "2012-07-17T04:45:18+00:00", "Created by libdcp"); + d.set_issuer("OpenDCP 0.0.25"); + d.set_creator("OpenDCP 0.0.25"); + d.set_issue_date("2012-07-17T04:45:18+00:00"); + d.set_annotation_text("Created by libdcp"); + d.write_xml(); /* build/test/DCP/dcp_test2 is checked against test/ref/DCP/dcp_test2 by run/tests */ } @@ -321,7 +328,11 @@ BOOST_AUTO_TEST_CASE (dcp_test5) d.add (cpl); - d.write_xml ("OpenDCP 0.0.25", "OpenDCP 0.0.25", "2012-07-17T04:45:18+00:00", "Created by libdcp"); + d.set_issuer("OpenDCP 0.0.25"); + d.set_creator("OpenDCP 0.0.25"); + d.set_issue_date("2012-07-17T04:45:18+00:00"); + d.set_annotation_text("Created by libdcp"); + d.write_xml(); /* build/test/DCP/dcp_test5 is checked against test/ref/DCP/dcp_test5 by run/tests */ } @@ -345,9 +356,12 @@ BOOST_AUTO_TEST_CASE (dcp_test7) { RNGFixer fix; - make_simple("build/test/DCP/dcp_test7", 1, 24, dcp::Standard::INTEROP)->write_xml( - "OpenDCP 0.0.25", "OpenDCP 0.0.25", "2012-07-17T04:45:18+00:00", "Created by libdcp" - ); + auto dcp = make_simple("build/test/DCP/dcp_test7", 1, 24, dcp::Standard::INTEROP); + dcp->set_issuer("OpenDCP 0.0.25"); + dcp->set_creator("OpenDCP 0.0.25"); + dcp->set_issue_date("2012-07-17T04:45:18+00:00"); + dcp->set_annotation_text("Created by libdcp"); + dcp->write_xml(); /* build/test/DCP/dcp_test7 is checked against test/ref/DCP/dcp_test7 by run/tests */ } diff --git a/test/encryption_test.cc b/test/encryption_test.cc index 4aea238f..dd7ccadb 100644 --- a/test/encryption_test.cc +++ b/test/encryption_test.cc @@ -137,7 +137,11 @@ BOOST_AUTO_TEST_CASE (encryption_test) d.add (cpl); - d.write_xml ("OpenDCP 0.0.25", "OpenDCP 0.0.25", "2012-07-17T04:45:18+00:00", "Created by libdcp", signer); + d.set_issuer("OpenDCP 0.0.25"); + d.set_creator("OpenDCP 0.0.25"); + d.set_issue_date("2012-07-17T04:45:18+00:00"); + d.set_annotation_text("Created by libdcp"); + d.write_xml(signer); dcp::DecryptedKDM kdm ( cpl, diff --git a/test/interop_subtitle_test.cc b/test/interop_subtitle_test.cc index 7a7e26b6..2d7c606a 100644 --- a/test/interop_subtitle_test.cc +++ b/test/interop_subtitle_test.cc @@ -917,7 +917,11 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test3) dcp::DCP dcp ("build/test/write_interop_subtitle_test3"); dcp.add (cpl); - dcp.write_xml (issuer, creator, issue_date, annotation_text); + dcp.set_issuer(issuer); + dcp.set_creator(creator); + dcp.set_issue_date(issue_date); + dcp.set_annotation_text(annotation_text); + dcp.write_xml(); check_xml ( dcp::file_to_string("test/ref/write_interop_subtitle_test3/subs.xml"), diff --git a/test/read_change_write_test.cc b/test/read_change_write_test.cc index aa9ef15d..6cd79a87 100644 --- a/test/read_change_write_test.cc +++ b/test/read_change_write_test.cc @@ -61,7 +61,9 @@ BOOST_AUTO_TEST_CASE(read_change_write_test) in_cpl->add(in_reel); dcp::DCP in_dcp(path); in_dcp.add(in_cpl); - in_dcp.write_xml("my great issuer", "the creator"); + in_dcp.set_issuer("my great issuer"); + in_dcp.set_creator("the creator"); + in_dcp.write_xml(); dcp::DCP work_dcp(path); work_dcp.read(); diff --git a/test/verify_test.cc b/test/verify_test.cc index 370204e9..76c20ffc 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -145,12 +145,8 @@ write_dcp_with_single_asset (path dir, shared_ptr<dcp::ReelAsset> reel_asset, dc cpl->add (reel); auto dcp = make_shared<dcp::DCP>(dir); dcp->add (cpl); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "hello" - ); + dcp->set_annotation_text("hello"); + dcp->write_xml (); return cpl; } @@ -903,12 +899,8 @@ BOOST_AUTO_TEST_CASE (verify_valid_cpl_metadata) dcp::DCP dcp (dir); dcp.add (cpl); - dcp.write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "hello" - ); + dcp.set_annotation_text("hello"); + dcp.write_xml (); } @@ -947,12 +939,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_cpl_metadata_bad_tag) dcp::DCP dcp (dir); dcp.add (cpl); - dcp.write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "hello" - ); + dcp.set_annotation_text("hello"); + dcp.write_xml(); { Editor e (find_cpl(dir)); @@ -998,12 +986,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_cpl_metadata_missing_tag) dcp::DCP dcp (dir); dcp.add (cpl); - dcp.write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "hello" - ); + dcp.set_annotation_text("hello"); + dcp.write_xml(); { Editor e (find_cpl(dir)); @@ -1091,12 +1075,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_language3) cpl->_release_territory = "fred-jim"; auto dcp = make_shared<dcp::DCP>(dir); dcp->add (cpl); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "hello" - ); + dcp->set_annotation_text("hello"); + dcp->write_xml(); check_verify_result ( { dir }, @@ -1157,12 +1137,8 @@ check_picture_size (int width, int height, int frame_rate, bool three_d) cpl->add (reel); d->add (cpl); - d->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + d->set_annotation_text("A Test DCP"); + d->write_xml(); return dcp::verify ({dcp_path}, &stage, &progress, xsd_test); } @@ -1403,12 +1379,8 @@ BOOST_AUTO_TEST_CASE (verify_missing_subtitle_language) auto reel_subs = make_shared<dcp::ReelSMPTESubtitleAsset>(subs, dcp::Fraction(24, 1), 106, 0); dcp->cpls()[0]->reels()[0]->add(reel_subs); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); check_verify_result ( { dir }, @@ -1444,12 +1416,8 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_subtitle_languages) cpl->reels()[1]->add(reel_subs); } - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); check_verify_result ( { path }, @@ -1486,12 +1454,8 @@ BOOST_AUTO_TEST_CASE (verify_multiple_closed_caption_languages_allowed) cpl->reels()[1]->add(reel_ccaps); } - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); check_verify_result ( { path }, @@ -1538,12 +1502,8 @@ BOOST_AUTO_TEST_CASE (verify_missing_subtitle_start_time) auto reel_subs = make_shared<dcp::ReelSMPTESubtitleAsset>(subs, dcp::Fraction(24, 1), 106, 0); dcp->cpls()[0]->reels()[0]->add(reel_subs); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); check_verify_result ( { dir }, @@ -1591,12 +1551,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_start_time) auto reel_subs = make_shared<dcp::ReelSMPTESubtitleAsset>(subs, dcp::Fraction(24, 1), 106, 0); dcp->cpls().front()->reels().front()->add(reel_subs); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); check_verify_result ( { dir }, @@ -1741,13 +1697,8 @@ BOOST_AUTO_TEST_CASE (verify_valid_subtitle_first_text_time_on_second_reel) cpl->add (reel2); auto dcp = make_shared<dcp::DCP>(dir); dcp->add (cpl); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "hello" - ); - + dcp->set_annotation_text("hello"); + dcp->write_xml(); check_verify_result ({dir}, {{ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_CPL_METADATA, cpl->id(), cpl->file().get() }}); } @@ -2150,12 +2101,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_sound_frame_rate) cpl->add (reel); auto dcp = make_shared<dcp::DCP>(dir); dcp->add (cpl); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "hello" - ); + dcp->set_annotation_text("hello"); + dcp->write_xml(); check_verify_result ( {dir}, @@ -2170,12 +2117,8 @@ BOOST_AUTO_TEST_CASE (verify_missing_cpl_annotation_text) { path const dir("build/test/verify_missing_cpl_annotation_text"); auto dcp = make_simple (dir); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); BOOST_REQUIRE_EQUAL (dcp->cpls().size(), 1U); @@ -2200,12 +2143,8 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_cpl_annotation_text) { path const dir("build/test/verify_mismatched_cpl_annotation_text"); auto dcp = make_simple (dir); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); BOOST_REQUIRE_EQUAL (dcp->cpls().size(), 1U); auto const cpl = dcp->cpls()[0]; @@ -2244,12 +2183,8 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_asset_duration) cpl->add (reel); dcp->add (cpl); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); check_verify_result ( {dir}, @@ -2309,12 +2244,8 @@ verify_subtitles_must_be_in_all_reels_check (path dir, bool add_to_reel1, bool a cpl->add (reel2); dcp->add (cpl); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); return cpl; } @@ -2395,12 +2326,8 @@ verify_closed_captions_must_be_in_all_reels_check (path dir, int caps_in_reel1, cpl->add (reel2); dcp->add (cpl); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); return cpl; } @@ -2463,12 +2390,8 @@ verify_text_entry_point_check (path dir, dcp::VerificationNote::Code code, boost cpl->add (reel); dcp->add (cpl); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); check_verify_result ( {dir}, @@ -2521,12 +2444,8 @@ BOOST_AUTO_TEST_CASE (verify_missing_hash) path const dir("build/test/verify_missing_hash"); auto dcp = make_simple (dir); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); BOOST_REQUIRE_EQUAL (dcp->cpls().size(), 1U); auto const cpl = dcp->cpls()[0]; @@ -2564,12 +2483,8 @@ verify_markers_test ( markers_asset->set (i.first, i.second); } dcp->cpls()[0]->reels()[0]->add(markers_asset); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); check_verify_result ({dir}, test_notes); } @@ -2665,12 +2580,8 @@ BOOST_AUTO_TEST_CASE (verify_missing_cpl_metadata_version_number) auto dcp = make_simple (dir); auto cpl = dcp->cpls()[0]; cpl->unset_version_number(); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); check_verify_result ({dir}, {{ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_CPL_METADATA_VERSION_NUMBER, cpl->id(), cpl->file().get() }}); } @@ -2680,12 +2591,8 @@ BOOST_AUTO_TEST_CASE (verify_missing_extension_metadata1) { path dir = "build/test/verify_missing_extension_metadata1"; auto dcp = make_simple (dir); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); BOOST_REQUIRE_EQUAL (dcp->cpls().size(), 1U); auto cpl = dcp->cpls()[0]; @@ -2708,12 +2615,8 @@ BOOST_AUTO_TEST_CASE (verify_missing_extension_metadata2) { path dir = "build/test/verify_missing_extension_metadata2"; auto dcp = make_simple (dir); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); auto cpl = dcp->cpls()[0]; @@ -2735,12 +2638,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_xml_cpl_extension_metadata3) { path dir = "build/test/verify_invalid_xml_cpl_extension_metadata3"; auto dcp = make_simple (dir); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); auto const cpl = dcp->cpls()[0]; @@ -2764,12 +2663,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_extension_metadata1) { path dir = "build/test/verify_invalid_extension_metadata1"; auto dcp = make_simple (dir); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); auto cpl = dcp->cpls()[0]; @@ -2791,12 +2686,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_extension_metadata2) { path dir = "build/test/verify_invalid_extension_metadata2"; auto dcp = make_simple (dir); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); auto cpl = dcp->cpls()[0]; @@ -2818,12 +2709,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_xml_cpl_extension_metadata6) { path dir = "build/test/verify_invalid_xml_cpl_extension_metadata6"; auto dcp = make_simple (dir); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); auto const cpl = dcp->cpls()[0]; @@ -2847,12 +2734,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_xml_cpl_extension_metadata7) { path dir = "build/test/verify_invalid_xml_cpl_extension_metadata7"; auto dcp = make_simple (dir); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); auto const cpl = dcp->cpls()[0]; @@ -2874,12 +2757,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_xml_cpl_extension_metadata8) { path dir = "build/test/verify_invalid_xml_cpl_extension_metadata8"; auto dcp = make_simple (dir); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); auto const cpl = dcp->cpls()[0]; @@ -2903,12 +2782,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_xml_cpl_extension_metadata9) { path dir = "build/test/verify_invalid_xml_cpl_extension_metadata9"; auto dcp = make_simple (dir); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); auto const cpl = dcp->cpls()[0]; @@ -3059,7 +2934,11 @@ BOOST_AUTO_TEST_CASE (verify_partially_encrypted) d.add (cpl); - d.write_xml ("OpenDCP 0.0.25", "OpenDCP 0.0.25", "2012-07-17T04:45:18+00:00", "A Test DCP", signer); + d.set_issuer("OpenDCP 0.0.25"); + d.set_creator("OpenDCP 0.0.25"); + d.set_issue_date("2012-07-17T04:45:18+00:00"); + d.set_annotation_text("A Test DCP"); + d.write_xml(signer); check_verify_result ( {dir}, @@ -3258,12 +3137,8 @@ BOOST_AUTO_TEST_CASE (verify_unexpected_things_in_main_markers) path dir = "build/test/verify_unexpected_things_in_main_markers"; prepare_directory (dir); auto dcp = make_simple (dir, 1, 24); - dcp->write_xml ( - dcp::String::compose("libdcp %1", dcp::version), - dcp::String::compose("libdcp %1", dcp::version), - dcp::LocalTime().as_string(), - "A Test DCP" - ); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); { Editor e (find_cpl(dir)); |
