Recover test config after config_test.cc runs.
authorCarl Hetherington <cth@carlh.net>
Tue, 13 Feb 2018 01:10:03 +0000 (01:10 +0000)
committerCarl Hetherington <cth@carlh.net>
Tue, 13 Feb 2018 01:10:03 +0000 (01:10 +0000)
test/config_test.cc
test/data
test/test.cc
test/test.h

index 25e8c7d..dad545a 100644 (file)
@@ -19,6 +19,7 @@
 */
 
 #include "lib/config.h"
+#include "test.h"
 #include <boost/test/unit_test.hpp>
 #include <fstream>
 
@@ -87,4 +88,9 @@ BOOST_AUTO_TEST_CASE (config_backup_test)
        BOOST_CHECK (boost::filesystem::exists ("build/test/config.xml.2"));
        BOOST_CHECK (boost::filesystem::exists ("build/test/config.xml.3"));
        BOOST_CHECK (boost::filesystem::exists ("build/test/config.xml.4"));
+
+       /* This test has called Config::set_defaults(), so take us back
+          to the config that we want for our tests.
+       */
+       setup_test_config ();
 }
index 4e9eb33..22ba7b1 160000 (submodule)
--- a/test/data
+++ b/test/data
@@ -1 +1 @@
-Subproject commit 4e9eb33fcd08820325f40446e089e10928fe3c59
+Subproject commit 22ba7b14571926f6c3fd860df57ad2146d9ba404
index 76678b7..551f64d 100644 (file)
@@ -69,6 +69,23 @@ using boost::dynamic_pointer_cast;
 
 boost::filesystem::path private_data = boost::filesystem::path ("..") / boost::filesystem::path ("dcpomatic-test-private");
 
+void
+setup_test_config ()
+{
+       Config::instance()->set_master_encoding_threads (1);
+       Config::instance()->set_server_encoding_threads (1);
+       Config::instance()->set_server_port_base (61921);
+       Config::instance()->set_default_isdcf_metadata (ISDCFMetadata ());
+       Config::instance()->set_default_container (Ratio::from_id ("185"));
+       Config::instance()->set_default_dcp_content_type (static_cast<DCPContentType*> (0));
+       Config::instance()->set_default_audio_delay (0);
+       Config::instance()->set_default_j2k_bandwidth (100000000);
+       Config::instance()->set_default_interop (false);
+       Config::instance()->set_default_still_length (10);
+       Config::instance()->set_log_types (LogEntry::TYPE_GENERAL | LogEntry::TYPE_WARNING | LogEntry::TYPE_ERROR);
+       Config::instance()->set_automatic_audio_analysis (false);
+}
+
 class TestSignalManager : public SignalManager
 {
 public:
@@ -84,19 +101,7 @@ struct TestConfig
        TestConfig ()
        {
                dcpomatic_setup ();
-
-               Config::instance()->set_master_encoding_threads (1);
-               Config::instance()->set_server_encoding_threads (1);
-               Config::instance()->set_server_port_base (61921);
-               Config::instance()->set_default_isdcf_metadata (ISDCFMetadata ());
-               Config::instance()->set_default_container (Ratio::from_id ("185"));
-               Config::instance()->set_default_dcp_content_type (static_cast<DCPContentType*> (0));
-               Config::instance()->set_default_audio_delay (0);
-               Config::instance()->set_default_j2k_bandwidth (100000000);
-               Config::instance()->set_default_interop (false);
-               Config::instance()->set_default_still_length (10);
-               Config::instance()->set_log_types (LogEntry::TYPE_GENERAL | LogEntry::TYPE_WARNING | LogEntry::TYPE_ERROR);
-               Config::instance()->set_automatic_audio_analysis (false);
+               setup_test_config ();
 
                EncodeServerFinder::instance()->stop ();
 
index 96e8505..ff5a2a3 100644 (file)
@@ -26,6 +26,7 @@ class Image;
 extern boost::filesystem::path private_data;
 
 extern bool wait_for_jobs ();
+extern void setup_test_config ();
 extern boost::shared_ptr<Film> new_test_film (std::string);
 extern boost::shared_ptr<Film> new_test_film2 (std::string);
 extern void check_dcp (boost::filesystem::path, boost::filesystem::path);