/*
- Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
#include "exceptions.h"
#include "language_tag.h"
#include "reel.h"
-#include "reel_subtitle_asset.h"
+#include "reel_smpte_subtitle_asset.h"
+#include "stream_operators.h"
#include "test.h"
#include <memory>
#include <boost/test/unit_test.hpp>
using std::list;
+using std::make_shared;
+using std::shared_ptr;
using std::string;
using std::vector;
-using std::shared_ptr;
BOOST_AUTO_TEST_CASE (cpl_metadata_bad_values_test)
{
- dcp::CPL cpl("", dcp::ContentKind::FEATURE);
+ dcp::CPL cpl("", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE);
BOOST_CHECK_THROW (cpl.set_version_number(-1), dcp::BadSettingError);
- vector<dcp::ContentVersion> cv;
- cv.push_back (dcp::ContentVersion("same-id", "version 1"));
- cv.push_back (dcp::ContentVersion("same-id", "version 2"));
+ vector<dcp::ContentVersion> cv = {
+ dcp::ContentVersion("same-id", "version 1"),
+ dcp::ContentVersion("same-id", "version 2")
+ };
BOOST_CHECK_THROW (cpl.set_content_versions(cv), dcp::DuplicateIdError);
}
BOOST_AUTO_TEST_CASE (luminance_test2)
{
- shared_ptr<cxml::Document> doc (new cxml::Document("Luminance"));
+ auto doc = make_shared<cxml::Document>("Luminance");
doc->read_string (
"<Luminance units=\"candela-per-square-metre\">4.5</Luminance>"
BOOST_AUTO_TEST_CASE (luminance_test3)
{
- shared_ptr<cxml::Document> doc (new cxml::Document("Luminance"));
+ auto doc = make_shared<cxml::Document>("Luminance");
doc->read_string (
"<Luminance units=\"candela-per-square-motre\">4.5</Luminance>"
BOOST_AUTO_TEST_CASE (luminance_test4)
{
- shared_ptr<cxml::Document> doc (new cxml::Document("Luminance"));
+ auto doc = make_shared<cxml::Document>("Luminance");
doc->read_string (
"<Luminance units=\"candela-per-square-metre\">-4.5</Luminance>"
BOOST_REQUIRE (reels.front()->main_subtitle()->language());
BOOST_CHECK_EQUAL (reels.front()->main_subtitle()->language().get(), "de-DE");
- vector<string> asl = cpl.additional_subtitle_languages();
+ auto asl = cpl.additional_subtitle_languages();
BOOST_REQUIRE_EQUAL (asl.size(), 2);
BOOST_CHECK_EQUAL (asl[0], "en-US");
BOOST_CHECK_EQUAL (asl[1], "fr-ZA");
{
RNGFixer fix;
- dcp::CPL cpl("", dcp::ContentKind::FEATURE);
+ dcp::CPL cpl("", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE);
cpl.set_issue_date ("2020-08-28T13:35:06+02:00");
- vector<dcp::ContentVersion> cv;
- cv.push_back (dcp::ContentVersion("some-id", "version 1"));
- cv.push_back (dcp::ContentVersion("another-id", "version 2"));
+ vector<dcp::ContentVersion> cv = {
+ dcp::ContentVersion("some-id", "version 1"),
+ dcp::ContentVersion("another-id", "version 2")
+ };;
cpl.set_content_versions (cv);
cpl.set_full_content_title_text ("full-content-title");
cpl.set_main_picture_stored_area (dcp::Size(1998, 1080));
cpl.set_main_picture_active_area (dcp::Size(1440, 1080));
- shared_ptr<cxml::Document> doc (new cxml::Document("MainSubtitle"));
+ auto doc = make_shared<cxml::Document>("MainSubtitle");
doc->read_string (
"<MainSubtitle>"
"</MainSubtitle>"
);
- shared_ptr<dcp::Reel> reel(new dcp::Reel());
+ auto reel = make_shared<dcp::Reel>();
reel->add (black_picture_asset("build/test/cpl_metadata_write_test1"));
- reel->add (shared_ptr<dcp::ReelSubtitleAsset>(new dcp::ReelSubtitleAsset(doc)));
+ reel->add (make_shared<dcp::ReelSMPTESubtitleAsset>(doc));
cpl.add (reel);
vector<dcp::LanguageTag> lt;
lt.push_back(dcp::LanguageTag("fr-ZA"));
cpl.set_additional_subtitle_languages (lt);
- cpl.write_xml ("build/test/cpl_metadata_write_test1.xml", dcp::Standard::SMPTE, shared_ptr<dcp::CertificateChain>());
+ cpl.write_xml ("build/test/cpl_metadata_write_test1.xml", shared_ptr<dcp::CertificateChain>());
check_xml (
dcp::file_to_string("test/ref/cpl_metadata_test1.xml"),
dcp::file_to_string("build/test/cpl_metadata_write_test1.xml"),
BOOST_AUTO_TEST_CASE (cpl_metadata_roundtrip_test_1)
{
dcp::CPL cpl ("test/ref/cpl_metadata_test1.xml");
- cpl.write_xml ("build/test/cpl_metadata_roundtrip_test1.xml", dcp::Standard::SMPTE, shared_ptr<dcp::CertificateChain>());
+ cpl.write_xml ("build/test/cpl_metadata_roundtrip_test1.xml", shared_ptr<dcp::CertificateChain>());
vector<string> ignore;
ignore.push_back ("Id");
check_xml (
{
RNGFixer fix;
- dcp::CPL cpl("", dcp::ContentKind::FEATURE);
+ dcp::CPL cpl("", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE);
cpl.set_issue_date ("2020-08-28T13:35:06+02:00");
cpl.set_content_version (dcp::ContentVersion("id", "version"));
cpl.set_issuer ("libdcp1.6.4devel");
reel->add (black_picture_asset("build/test/cpl_metadata_write_test1"));
cpl.add (reel);
- cpl.write_xml ("build/test/cpl_metadata_write_test2.xml", dcp::Standard::SMPTE, shared_ptr<dcp::CertificateChain>());
+ cpl.write_xml ("build/test/cpl_metadata_write_test2.xml", shared_ptr<dcp::CertificateChain>());
check_xml (
dcp::file_to_string("test/ref/cpl_metadata_test2.xml"),
dcp::file_to_string("build/test/cpl_metadata_write_test2.xml"),
BOOST_AUTO_TEST_CASE (cpl_metadata_roundtrip_test_2)
{
dcp::CPL cpl ("test/ref/cpl_metadata_test2.xml");
- cpl.write_xml ("build/test/cpl_metadata_roundtrip_test2.xml", dcp::Standard::SMPTE, shared_ptr<dcp::CertificateChain>());
- vector<string> ignore;
- ignore.push_back ("Id");
+ cpl.write_xml ("build/test/cpl_metadata_roundtrip_test2.xml", shared_ptr<dcp::CertificateChain>());
check_xml (
dcp::file_to_string("test/ref/cpl_metadata_test2.xml"),
dcp::file_to_string("build/test/cpl_metadata_roundtrip_test2.xml"),
- ignore
+ {"Id"}
);
}