summaryrefslogtreecommitdiff
path: root/test/digest_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-02-26 01:24:48 +0100
committerCarl Hetherington <cth@carlh.net>2021-02-26 01:24:48 +0100
commitea63ad9560757e56505551db3bf2e1c31be5c76c (patch)
treeec0f539b89d9c8ac627e65886241cc086246ab09 /test/digest_test.cc
parentcbb8260e395058da76b3de518ebc535a114c54b1 (diff)
More verification of DCPs during tests.
Diffstat (limited to 'test/digest_test.cc')
-rw-r--r--test/digest_test.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/test/digest_test.cc b/test/digest_test.cc
index bfa8e62f6..59a8cb7a7 100644
--- a/test/digest_test.cc
+++ b/test/digest_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,11 +18,13 @@
*/
+
/** @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"
@@ -34,14 +36,17 @@
#include <dcp/reel_picture_asset.h>
#include <boost/test/unit_test.hpp>
+
using std::list;
using std::string;
using std::shared_ptr;
+using std::make_shared;
+
static string
openssl_hash (boost::filesystem::path file)
{
- FILE* pipe = popen (String::compose ("openssl sha1 -binary %1 | openssl base64 -e", file.string()).c_str (), "r");
+ auto pipe = popen (String::compose ("openssl sha1 -binary %1 | openssl base64 -e", file.string()).c_str (), "r");
BOOST_REQUIRE (pipe);
char buffer[128];
string output;
@@ -57,15 +62,16 @@ openssl_hash (boost::filesystem::path file)
return output;
}
+
/** Test the digests made by the DCP writing code on a multi-reel DCP */
BOOST_AUTO_TEST_CASE (digest_test)
{
- shared_ptr<Film> film = new_test_film ("digest_test");
+ auto film = new_test_film ("digest_test");
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
film->set_name ("digest_test");
- shared_ptr<ImageContent> r (new ImageContent("test/data/flat_red.png"));
- shared_ptr<ImageContent> g (new ImageContent("test/data/flat_green.png"));
- shared_ptr<ImageContent> b (new ImageContent("test/data/flat_blue.png"));
+ auto r = make_shared<ImageContent>("test/data/flat_red.png");
+ auto g = make_shared<ImageContent>("test/data/flat_green.png");
+ auto b = make_shared<ImageContent>("test/data/flat_blue.png");
film->examine_and_add_content (r);
film->examine_and_add_content (g);
film->examine_and_add_content (b);
@@ -73,8 +79,7 @@ BOOST_AUTO_TEST_CASE (digest_test)
BOOST_REQUIRE (!wait_for_jobs());
BOOST_CHECK (Config::instance()->master_encoding_threads() > 1);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
dcp::DCP dcp (film->dir (film->dcp_name ()));
dcp.read ();