diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-09-25 20:41:45 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-09-25 20:41:45 +0100 |
| commit | f76647abae551840a43bb8f07189051ec20bab6d (patch) | |
| tree | 12d67e33c71516480cb71381bc426dfe18513821 /test | |
| parent | e8530ea06f0b0883e5e19dd18beed70732ac5d3c (diff) | |
Switch away from the many-constructor-arguments approach to a hopefully simpler API.
Diffstat (limited to 'test')
| -rw-r--r-- | test/dcp_test.cc | 38 | ||||
| -rw-r--r-- | test/encryption_test.cc | 49 | ||||
| -rw-r--r-- | test/error_test.cc | 13 | ||||
| -rw-r--r-- | test/recovery_test.cc | 12 | ||||
| -rw-r--r-- | test/round_trip_test.cc | 15 | ||||
| -rw-r--r-- | test/wscript | 2 |
6 files changed, 63 insertions, 66 deletions
diff --git a/test/dcp_test.cc b/test/dcp_test.cc index 9d3b8171..b9c94bd8 100644 --- a/test/dcp_test.cc +++ b/test/dcp_test.cc @@ -50,29 +50,23 @@ BOOST_AUTO_TEST_CASE (dcp_test) libdcp::DCP d ("build/test/foo"); shared_ptr<libdcp::CPL> cpl (new libdcp::CPL ("build/test/foo", "A Test DCP", libdcp::FEATURE, 24, 24)); - shared_ptr<libdcp::MonoPictureAsset> mp (new libdcp::MonoPictureAsset ( - j2c, - "build/test/foo", - "video.mxf", - &d.Progress, - 24, - 24, - libdcp::Size (32, 32), - false, - mxf_meta - )); + shared_ptr<libdcp::MonoPictureAsset> mp (new libdcp::MonoPictureAsset ("build/test/foo", "video.mxf")); + mp->set_progress (&d.Progress); + mp->set_edit_rate (24); + mp->set_intrinsic_duration (24); + mp->set_duration (24); + mp->set_size (libdcp::Size (32, 32)); + mp->set_metadata (mxf_meta); + mp->create (j2c); - shared_ptr<libdcp::SoundAsset> ms (new libdcp::SoundAsset ( - wav, - "build/test/foo", - "audio.mxf", - &(d.Progress), - 24, - 24, - 2, - false, - mxf_meta - )); + shared_ptr<libdcp::SoundAsset> ms (new libdcp::SoundAsset ("build/test/foo", "audio.mxf")); + ms->set_progress (&d.Progress); + ms->set_edit_rate (24); + ms->set_intrinsic_duration (24); + ms->set_duration (24); + ms->set_channels (2); + ms->set_metadata (mxf_meta); + ms->create (wav); cpl->add_reel (shared_ptr<libdcp::Reel> (new libdcp::Reel (mp, ms, shared_ptr<libdcp::SubtitleAsset> ()))); d.add_cpl (cpl); diff --git a/test/encryption_test.cc b/test/encryption_test.cc index 82d5fe27..aa83d3ec 100644 --- a/test/encryption_test.cc +++ b/test/encryption_test.cc @@ -29,6 +29,7 @@ #include "sound_asset.h" #include "reel.h" #include "test.h" +#include "signer_chain.h" using boost::shared_ptr; @@ -37,6 +38,10 @@ using boost::shared_ptr; */ BOOST_AUTO_TEST_CASE (encryption) { + boost::filesystem::remove_all ("build/test/signer"); + boost::filesystem::create_directory ("build/test/signer"); + libdcp::make_signer_chain ("build/test/signer"); + Kumu::libdcp_test = true; libdcp::MXFMetadata mxf_metadata; @@ -66,36 +71,28 @@ BOOST_AUTO_TEST_CASE (encryption) ); shared_ptr<libdcp::CPL> cpl (new libdcp::CPL ("build/test/bar", "A Test DCP", libdcp::FEATURE, 24, 24)); - - shared_ptr<libdcp::MonoPictureAsset> mp (new libdcp::MonoPictureAsset ( - j2c, - "build/test/bar", - "video.mxf", - &d.Progress, - 24, - 24, - libdcp::Size (32, 32), - false, - mxf_metadata - )); libdcp::Key key; - + + shared_ptr<libdcp::MonoPictureAsset> mp (new libdcp::MonoPictureAsset ("build/test/bar", "video.mxf")); + mp->set_progress (&d.Progress); + mp->set_edit_rate (24); + mp->set_intrinsic_duration (24); + mp->set_duration (24); + mp->set_size (libdcp::Size (32, 32)); + mp->set_metadata (mxf_metadata); mp->set_key (key); - - shared_ptr<libdcp::SoundAsset> ms (new libdcp::SoundAsset ( - wav, - "build/test/bar", - "audio.mxf", - &(d.Progress), - 24, - 24, - 2, - false, - mxf_metadata - )); - + mp->create (j2c); + + shared_ptr<libdcp::SoundAsset> ms (new libdcp::SoundAsset ("build/test/bar", "audio.mxf")); + ms->set_progress (&d.Progress); + ms->set_edit_rate (24); + ms->set_intrinsic_duration (24); + mp->set_duration (24); + ms->set_channels (2); + ms->set_metadata (mxf_metadata); ms->set_key (key); + ms->create (wav); cpl->add_reel (shared_ptr<libdcp::Reel> (new libdcp::Reel (mp, ms, shared_ptr<libdcp::SubtitleAsset> ()))); d.add_cpl (cpl); diff --git a/test/error_test.cc b/test/error_test.cc index a0f6a0f3..f01fbdd0 100644 --- a/test/error_test.cc +++ b/test/error_test.cc @@ -38,13 +38,10 @@ BOOST_AUTO_TEST_CASE (error_test) p.push_back ("frobozz"); /* Trying to create video/audio MXFs using a non-existant file should throw an exception */ - BOOST_CHECK_THROW ( - new libdcp::MonoPictureAsset (p, "build/test/fred", "video.mxf", &d.Progress, 24, 24, libdcp::Size (32, 32), false), - libdcp::FileError - ); + libdcp::MonoPictureAsset pa ("build/test/fred", "video.mxf"); + BOOST_CHECK_THROW (pa.create (p), libdcp::FileError); - BOOST_CHECK_THROW ( - new libdcp::SoundAsset (p, "build/test/fred", "audio.mxf", &d.Progress, 24, 24, false), - libdcp::FileError - ); + libdcp::SoundAsset sa ("build/test/fred", "audio.mxf"); + sa.set_channels (1); + BOOST_CHECK_THROW (sa.create (p), libdcp::FileError); } diff --git a/test/recovery_test.cc b/test/recovery_test.cc index 43858b10..206fe200 100644 --- a/test/recovery_test.cc +++ b/test/recovery_test.cc @@ -48,8 +48,10 @@ BOOST_AUTO_TEST_CASE (recovery) boost::filesystem::remove_all ("build/test/baz"); boost::filesystem::create_directories ("build/test/baz"); - shared_ptr<libdcp::MonoPictureAsset> mp (new libdcp::MonoPictureAsset ("build/test/baz", "video1.mxf", 24, libdcp::Size (32, 32))); - shared_ptr<libdcp::PictureAssetWriter> writer = mp->start_write (false, false); + shared_ptr<libdcp::MonoPictureAsset> mp (new libdcp::MonoPictureAsset ("build/test/baz", "video1.mxf")); + mp->set_edit_rate (24); + mp->set_size (libdcp::Size (32, 32)); + shared_ptr<libdcp::PictureAssetWriter> writer = mp->start_write (false); int written_size = 0; for (int i = 0; i < 24; ++i) { @@ -76,8 +78,10 @@ BOOST_AUTO_TEST_CASE (recovery) Kumu::ResetTestRNG (); #endif - mp.reset (new libdcp::MonoPictureAsset ("build/test/baz", "video2.mxf", 24, libdcp::Size (32, 32))); - writer = mp->start_write (true, false); + mp.reset (new libdcp::MonoPictureAsset ("build/test/baz", "video2.mxf")); + mp->set_edit_rate (24); + mp->set_size (libdcp::Size (32, 32)); + writer = mp->start_write (true); writer->write (data, size); diff --git a/test/round_trip_test.cc b/test/round_trip_test.cc index 96563ee8..82f6223c 100644 --- a/test/round_trip_test.cc +++ b/test/round_trip_test.cc @@ -29,12 +29,17 @@ #include "cpl.h" #include "picture_frame.h" #include "argb_frame.h" +#include "signer_chain.h" using boost::shared_ptr; /* Build an encrypted picture MXF and a KDM for it and check that the KDM can be decrypted */ BOOST_AUTO_TEST_CASE (round_trip_test) { + boost::filesystem::remove_all ("build/test/signer"); + boost::filesystem::create_directory ("build/test/signer"); + libdcp::make_signer_chain ("build/test/signer"); + libdcp::CertificateChain chain; chain.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate (boost::filesystem::path ("build/test/signer/ca.self-signed.pem")))); chain.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate (boost::filesystem::path ("build/test/signer/intermediate.signed.pem")))); @@ -50,11 +55,11 @@ BOOST_AUTO_TEST_CASE (round_trip_test) boost::filesystem::path work_dir = "build/test/round_trip_test"; boost::filesystem::create_directory (work_dir); - libdcp::MXFMetadata mxf_metadata; - - shared_ptr<libdcp::MonoPictureAsset> asset_A ( - new libdcp::MonoPictureAsset (j2c, work_dir, "video.mxf", 0, 24, 24, libdcp::Size (32, 32), false, mxf_metadata) - ); + shared_ptr<libdcp::MonoPictureAsset> asset_A (new libdcp::MonoPictureAsset (work_dir, "video.mxf")); + asset_A->set_edit_rate (24); + asset_A->set_intrinsic_duration (24); + asset_A->set_size (libdcp::Size (32, 32)); + asset_A->create (j2c); libdcp::Key key; diff --git a/test/wscript b/test/wscript index c0250255..1b2a1055 100644 --- a/test/wscript +++ b/test/wscript @@ -21,7 +21,7 @@ def build(bld): obj.uselib = 'BOOST_TEST OPENJPEG CXML XMLSEC1' obj.use = 'libdcp' obj.source = """ - test.cc + test.cc certificates_test.cc dcp_test.cc encryption_test.cc |
