Config::drop ();
Config::instance()->write();
- check_file ("test/data/utf8_config.xml", "build/test/config.xml");
+ check_file ("test/data/utf8_config.xml", "build/test/config.xml", false);
/* This test has called Config::set_defaults(), so take us back
to the config that we want for our tests.
/*
- Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
+
/** @file test/test.cc
* @brief Overall test stuff and useful methods for tests.
*/
+
#include "lib/compose.hpp"
#include "lib/config.h"
#include "lib/cross.h"
#include <list>
#include <vector>
+
using std::abs;
using std::cerr;
using std::cout;
Config::instance()->set_decryption_chain (decryption);
}
+
class TestSignalManager : public SignalManager
{
public:
}
};
+
BOOST_GLOBAL_FIXTURE (TestConfig);
+
boost::filesystem::path
test_film_dir (string name)
{
return p;
}
+
shared_ptr<Film>
new_test_film (string name)
{
return film;
}
+
shared_ptr<Film>
new_test_film2 (string name, vector<shared_ptr<Content>> content, Cleanup* cleanup)
{
return film;
}
+
void
check_wav_file (boost::filesystem::path ref, boost::filesystem::path check)
{
}
}
+
void
check_mxf_audio_file (boost::filesystem::path ref, boost::filesystem::path check)
{
void
-check_file (boost::filesystem::path ref, boost::filesystem::path check)
+check_file (boost::filesystem::path ref, boost::filesystem::path check, bool binary_mode)
{
auto N = boost::filesystem::file_size (ref);
BOOST_CHECK_EQUAL (N, boost::filesystem::file_size (check));
- auto ref_file = fopen_boost (ref, "rb");
+ auto ref_file = fopen_boost (ref, binary_mode ? "rb" : "r");
BOOST_CHECK (ref_file);
- auto check_file = fopen_boost (check, "rb");
+ auto check_file = fopen_boost (check, binary_mode ? "rb" : "r");
BOOST_CHECK (check_file);
int const buffer_size = 65536;
fclose (check_file);
}
+
static void
note (dcp::NoteType t, string n)
{
extern std::shared_ptr<Film> new_test_film2 (std::string, std::vector<std::shared_ptr<Content>> content = {}, Cleanup* cleanup = nullptr);
extern void check_dcp (boost::filesystem::path, boost::filesystem::path);
extern void check_dcp (boost::filesystem::path, std::shared_ptr<const Film>);
-extern void check_file (boost::filesystem::path ref, boost::filesystem::path check);
+extern void check_file (boost::filesystem::path ref, boost::filesystem::path check, bool binary_mode = true);
+extern void check_text_file (boost::filesystem::path ref, boost::filesystem::path check);
extern void check_wav_file (boost::filesystem::path ref, boost::filesystem::path check);
extern void check_mxf_audio_file (boost::filesystem::path ref, boost::filesystem::path check);
extern bool mxf_atmos_files_same (boost::filesystem::path ref, boost::filesystem::path check, bool verbose = false);
extern void check_xml (boost::filesystem::path, boost::filesystem::path, std::list<std::string>);
-extern void check_file (boost::filesystem::path, boost::filesystem::path);
extern void check_ffmpeg (boost::filesystem::path, boost::filesystem::path, int audio_tolerance);
extern void check_image (boost::filesystem::path, boost::filesystem::path, double threshold = 4);
extern boost::filesystem::path test_film_dir (std::string);