#include "test.h"
#include <dcp/cpl.h>
#include <dcp/dcp.h>
+#include <dcp/equality_options.h>
#include <dcp/mono_picture_asset.h>
#include <dcp/mono_picture_frame.h>
#include <dcp/openjpeg_image.h>
return boost::filesystem::path(env);
}
- return boost::filesystem::canonical(boost::filesystem::path ("..") / boost::filesystem::path ("dcpomatic-test-private"));
+ auto relative = boost::filesystem::path ("..") / boost::filesystem::path ("dcpomatic-test-private");
+ if (!boost::filesystem::exists(relative)) {
+ std::cerr << "No private test data found! Tests may fail.\n";
+ return relative;
+ }
+
+ return boost::filesystem::canonical(relative);
}
auto decryption = make_shared<dcp::CertificateChain>(dcp::file_to_string("test/data/decryption_chain"));
decryption->set_key(dcp::file_to_string("test/data/decryption_key"));
Config::instance()->set_decryption_chain (decryption);
+ Config::instance()->set_dcp_asset_filename_format(dcp::NameFormat("%t"));
}
void
-check_dcp (boost::filesystem::path ref, boost::filesystem::path check)
+check_dcp(boost::filesystem::path ref, boost::filesystem::path check, bool sound_can_differ)
{
dcp::DCP ref_dcp (ref);
ref_dcp.read ();
options.cpl_annotation_texts_can_differ = true;
options.reel_annotation_texts_can_differ = true;
options.reel_hashes_can_differ = true;
+ options.asset_hashes_can_differ = true;
options.issue_dates_can_differ = true;
options.max_subtitle_vertical_position_error = 0.001;
+ options.sound_assets_can_differ = sound_can_differ;
BOOST_CHECK (ref_dcp.equals (check_dcp, options, boost::bind (note, _1, _2)));
}
void
-make_and_verify_dcp (shared_ptr<Film> film, vector<dcp::VerificationNote::Code> ignore)
+verify_dcp(boost::filesystem::path dir, vector<dcp::VerificationNote::Code> ignore)
{
- film->write_metadata ();
- make_dcp (film, TranscodeJob::ChangedBehaviour::IGNORE);
- BOOST_REQUIRE (!wait_for_jobs());
- auto notes = dcp::verify({film->dir(film->dcp_name())}, &stage, &progress, {}, TestPaths::xsd());
+ auto notes = dcp::verify({dir}, &stage, &progress, {}, TestPaths::xsd());
bool ok = true;
for (auto i: notes) {
if (find(ignore.begin(), ignore.end(), i.code()) == ignore.end()) {
}
+void
+make_and_verify_dcp (shared_ptr<Film> film, vector<dcp::VerificationNote::Code> ignore)
+{
+ film->write_metadata ();
+ make_dcp (film, TranscodeJob::ChangedBehaviour::IGNORE);
+ BOOST_REQUIRE (!wait_for_jobs());
+ verify_dcp({film->dir(film->dcp_name())}, ignore);
+}
+
+
void
check_int_close (int a, int b, int d)
{
boost::optional<boost::filesystem::path> found;
for (auto i: boost::filesystem::directory_iterator(dir)) {
if (i.path().filename().string().find(filename_part) != string::npos) {
- BOOST_REQUIRE (!found);
+ BOOST_REQUIRE_MESSAGE(!found, "File " << filename_part << " found more than once in " << dir);
found = i;
}
}
- BOOST_REQUIRE (found);
+ BOOST_REQUIRE_MESSAGE(found, "Could not find " << filename_part << " in " << dir);
return *found;
}