X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=test%2Fdigest_test.cc;h=bfa8e62f65456f8b14f8fc00340f19b3480804c1;hb=4a2efeb3c35babad46eebfbb56fa9a0a7c215d3b;hp=7395fe46854841adc73c253a23d357388dae9eea;hpb=d25b0a20c8e52b5b76fed0d9c08b972a363e6cc6;p=dcpomatic.git diff --git a/test/digest_test.cc b/test/digest_test.cc index 7395fe468..bfa8e62f6 100644 --- a/test/digest_test.cc +++ b/test/digest_test.cc @@ -18,6 +18,11 @@ */ +/** @file test/digest_test.cc + * @brief Check computed DCP digests against references calculated by the `openssl` binary. + * @ingroup feature + */ + #include "lib/film.h" #include "lib/image_content.h" #include "lib/dcp_content_type.h" @@ -31,7 +36,7 @@ using std::list; using std::string; -using boost::shared_ptr; +using std::shared_ptr; static string openssl_hash (boost::filesystem::path file) @@ -58,33 +63,38 @@ BOOST_AUTO_TEST_CASE (digest_test) shared_ptr film = new_test_film ("digest_test"); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); film->set_name ("digest_test"); - shared_ptr r (new ImageContent (film, "test/data/flat_red.png")); - shared_ptr g (new ImageContent (film, "test/data/flat_green.png")); - shared_ptr b (new ImageContent (film, "test/data/flat_blue.png")); + shared_ptr r (new ImageContent("test/data/flat_red.png")); + shared_ptr g (new ImageContent("test/data/flat_green.png")); + shared_ptr b (new ImageContent("test/data/flat_blue.png")); film->examine_and_add_content (r); film->examine_and_add_content (g); film->examine_and_add_content (b); - film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT); - wait_for_jobs (); + film->set_reel_type (ReelType::BY_VIDEO_CONTENT); + BOOST_REQUIRE (!wait_for_jobs()); - Config::instance()->set_num_local_encoding_threads (4); + BOOST_CHECK (Config::instance()->master_encoding_threads() > 1); film->make_dcp (); - wait_for_jobs (); - Config::instance()->set_num_local_encoding_threads (1); + BOOST_REQUIRE (!wait_for_jobs()); dcp::DCP dcp (film->dir (film->dcp_name ())); dcp.read (); - BOOST_CHECK_EQUAL (dcp.cpls().size(), 1); - list > reels = dcp.cpls().front()->reels (); + BOOST_CHECK_EQUAL (dcp.cpls().size(), 1U); + auto reels = dcp.cpls()[0]->reels(); - list >::const_iterator i = reels.begin (); + auto i = reels.begin (); BOOST_REQUIRE (i != reels.end ()); + BOOST_REQUIRE ((*i)->main_picture()->hash()); + BOOST_REQUIRE ((*i)->main_picture()->asset()->file()); BOOST_CHECK_EQUAL ((*i)->main_picture()->hash().get(), openssl_hash ((*i)->main_picture()->asset()->file().get())); ++i; BOOST_REQUIRE (i != reels.end ()); + BOOST_REQUIRE ((*i)->main_picture()->hash()); + BOOST_REQUIRE ((*i)->main_picture()->asset()->file()); BOOST_CHECK_EQUAL ((*i)->main_picture()->hash().get(), openssl_hash ((*i)->main_picture()->asset()->file().get())); ++i; BOOST_REQUIRE (i != reels.end ()); + BOOST_REQUIRE ((*i)->main_picture()->hash()); + BOOST_REQUIRE ((*i)->main_picture()->asset()->file()); BOOST_CHECK_EQUAL ((*i)->main_picture()->hash().get(), openssl_hash ((*i)->main_picture()->asset()->file().get())); ++i; BOOST_REQUIRE (i == reels.end ());