X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=test%2Ftest.cc;h=a12d79916463f7eb23589ef2e76b472d2e4a537f;hb=4673b12dcf6340862f9f4f72fc6dca8553130b55;hp=3395d9672ba66ecdce90a3beb3f448746485a80a;hpb=9bfa07293928c371d59db2091ba2b7e715ce5994;p=dcpomatic.git diff --git a/test/test.cc b/test/test.cc index 3395d9672..a12d79916 100644 --- a/test/test.cc +++ b/test/test.cc @@ -38,6 +38,7 @@ #include "lib/job.h" #include "lib/job_manager.h" #include "lib/log_entry.h" +#include "lib/make_dcp.h" #include "lib/ratio.h" #include "lib/signal_manager.h" #include "lib/util.h" @@ -99,10 +100,10 @@ boost::filesystem::path TestPaths::xsd () } -void +static void setup_test_config () { - Config::instance()->set_master_encoding_threads (boost::thread::hardware_concurrency()); + Config::instance()->set_master_encoding_threads (boost::thread::hardware_concurrency() / 2); Config::instance()->set_server_encoding_threads (1); Config::instance()->set_server_port_base (61921); Config::instance()->set_default_container (Ratio::from_id ("185")); @@ -129,7 +130,7 @@ class TestSignalManager : public SignalManager { public: /* No wakes in tests: we call ui_idle ourselves */ - void wake_ui () + void wake_ui () override { } @@ -364,12 +365,12 @@ double rms_error (boost::filesystem::path ref, boost::filesystem::path check) { FFmpegImageProxy ref_proxy (ref); - auto ref_image = ref_proxy.image(false).image; + auto ref_image = ref_proxy.image(Image::Alignment::COMPACT).image; FFmpegImageProxy check_proxy (check); - auto check_image = check_proxy.image(false).image; + auto check_image = check_proxy.image(Image::Alignment::COMPACT).image; BOOST_REQUIRE_EQUAL (ref_image->pixel_format(), check_image->pixel_format()); - AVPixelFormat const format = ref_image->pixel_format(); + auto const format = ref_image->pixel_format(); BOOST_REQUIRE (ref_image->size() == check_image->size()); int const width = ref_image->size().width; @@ -700,7 +701,7 @@ png_flush (png_structp) static void png_error_fn (png_structp png_ptr, char const * message) { - reinterpret_cast(png_get_error_ptr(png_ptr))->png_error (message); + throw EncodeError (String::compose("Error during PNG write: %1", message)); } @@ -893,7 +894,7 @@ void make_and_verify_dcp (shared_ptr film, vector ignore) { film->write_metadata (); - film->make_dcp (); + make_dcp (film, TranscodeJob::ChangedBehaviour::IGNORE); BOOST_REQUIRE (!wait_for_jobs()); auto notes = dcp::verify ({film->dir(film->dcp_name())}, &stage, &progress, TestPaths::xsd()); bool ok = true; @@ -920,3 +921,10 @@ check_int_close (std::pair a, std::pair b, int d) check_int_close (a.first, b.first, d); check_int_close (a.second, b.second, d); } + + +ConfigRestorer::~ConfigRestorer() +{ + setup_test_config(); +} +