projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge master; fix destruction of Server; some test cleanups.
[dcpomatic.git]
/
test
/
test.cc
diff --git
a/test/test.cc
b/test/test.cc
index e76c98d8bcdfb357f19c5746a611346115189a49..32f74a7d2fb62b8243056d11c11b84eeb5eea0b1 100644
(file)
--- a/
test/test.cc
+++ b/
test/test.cc
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012
-2014
Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-17,11
+17,15
@@
*/
*/
+/** @file test/test.cc
+ * @brief Overall test stuff and useful methods for tests.
+ */
+
#include <vector>
#include <list>
#include <Magick++.h>
#include <libxml++/libxml++.h>
#include <vector>
#include <list>
#include <Magick++.h>
#include <libxml++/libxml++.h>
-#include <
lib
dcp/dcp.h>
+#include <dcp/dcp.h>
#include "lib/config.h"
#include "lib/util.h"
#include "lib/ui_signaller.h"
#include "lib/config.h"
#include "lib/util.h"
#include "lib/ui_signaller.h"
@@
-43,6
+47,8
@@
using std::cerr;
using std::list;
using boost::shared_ptr;
using std::list;
using boost::shared_ptr;
+boost::filesystem::path private_data = boost::filesystem::path ("test") / boost::filesystem::path ("private");
+
class TestUISignaller : public UISignaller
{
public:
class TestUISignaller : public UISignaller
{
public:
@@
-55,20
+61,26
@@
public:
struct TestConfig
{
struct TestConfig
{
- TestConfig()
+ TestConfig
()
{
{
- dcpomatic_setup();
+ dcpomatic_setup
();
Config::instance()->set_num_local_encoding_threads (1);
Config::instance()->set_server_port_base (61920);
Config::instance()->set_num_local_encoding_threads (1);
Config::instance()->set_server_port_base (61920);
- Config::instance()->set_default_
dci_metadata (DCI
Metadata ());
+ Config::instance()->set_default_
isdcf_metadata (ISDCF
Metadata ());
Config::instance()->set_default_container (static_cast<Ratio*> (0));
Config::instance()->set_default_dcp_content_type (static_cast<DCPContentType*> (0));
Config::instance()->set_default_container (static_cast<Ratio*> (0));
Config::instance()->set_default_dcp_content_type (static_cast<DCPContentType*> (0));
+ Config::instance()->set_default_audio_delay (0);
ServerFinder::instance()->disable ();
ui_signaller = new TestUISignaller ();
}
ServerFinder::instance()->disable ();
ui_signaller = new TestUISignaller ();
}
+
+ ~TestConfig ()
+ {
+ JobManager::drop ();
+ }
};
BOOST_GLOBAL_FIXTURE (TestConfig);
};
BOOST_GLOBAL_FIXTURE (TestConfig);
@@
-97,13
+109,13
@@
new_test_film (string name)
}
void
}
void
-check_file (
string ref, string
check)
+check_file (
boost::filesystem::path ref, boost::filesystem::path
check)
{
uintmax_t N = boost::filesystem::file_size (ref);
{
uintmax_t N = boost::filesystem::file_size (ref);
- BOOST_CHECK_EQUAL (N, boost::filesystem::file_size(check));
+ BOOST_CHECK_EQUAL (N, boost::filesystem::file_size
(check));
FILE* ref_file = fopen (ref.c_str(), "rb");
BOOST_CHECK (ref_file);
FILE* ref_file = fopen (ref.c_str(), "rb");
BOOST_CHECK (ref_file);
- FILE* check_file = fopen
(check.c_str()
, "rb");
+ FILE* check_file = fopen
_boost (check
, "rb");
BOOST_CHECK (check_file);
int const buffer_size = 65536;
BOOST_CHECK (check_file);
int const buffer_size = 65536;
@@
-129,26
+141,26
@@
check_file (string ref, string check)
}
static void
}
static void
-note (
lib
dcp::NoteType t, string n)
+note (dcp::NoteType t, string n)
{
{
- if (t ==
libdcp::
ERROR) {
+ if (t ==
dcp::DCP_
ERROR) {
cerr << n << "\n";
}
}
void
cerr << n << "\n";
}
}
void
-check_dcp (
string ref, string
check)
+check_dcp (
boost::filesystem::path ref, boost::filesystem::path
check)
{
{
-
lib
dcp::DCP ref_dcp (ref);
+ dcp::DCP ref_dcp (ref);
ref_dcp.read ();
ref_dcp.read ();
-
lib
dcp::DCP check_dcp (check);
+ dcp::DCP check_dcp (check);
check_dcp.read ();
check_dcp.read ();
-
lib
dcp::EqualityOptions options;
+ dcp::EqualityOptions options;
options.max_mean_pixel_error = 5;
options.max_std_dev_pixel_error = 5;
options.max_audio_sample_error = 255;
options.max_mean_pixel_error = 5;
options.max_std_dev_pixel_error = 5;
options.max_audio_sample_error = 255;
- options.cpl_
name
s_can_differ = true;
+ options.cpl_
annotation_text
s_can_differ = true;
options.mxf_names_can_differ = true;
BOOST_CHECK (ref_dcp.equals (check_dcp, options, boost::bind (note, _1, _2)));
options.mxf_names_can_differ = true;
BOOST_CHECK (ref_dcp.equals (check_dcp, options, boost::bind (note, _1, _2)));
@@
-220,10
+232,19
@@
wait_for_jobs ()
ui_signaller->ui_idle ();
}
if (jm->errors ()) {
ui_signaller->ui_idle ();
}
if (jm->errors ()) {
+ int N = 0;
+ for (list<shared_ptr<Job> >::iterator i = jm->_jobs.begin(); i != jm->_jobs.end(); ++i) {
+ if ((*i)->finished_in_error ()) {
+ ++N;
+ }
+ }
+ cerr << N << " errors.\n";
+
for (list<shared_ptr<Job> >::iterator i = jm->_jobs.begin(); i != jm->_jobs.end(); ++i) {
if ((*i)->finished_in_error ()) {
for (list<shared_ptr<Job> >::iterator i = jm->_jobs.begin(); i != jm->_jobs.end(); ++i) {
if ((*i)->finished_in_error ()) {
- cerr << (*i)->error_summary () << "\n"
- << (*i)->error_details () << "\n";
+ cerr << (*i)->name() << ":\n"
+ << "\tsummary: " << (*i)->error_summary () << "\n"
+ << "\tdetails: " << (*i)->error_details () << "\n";
}
}
}
}
}
}