Rename test method.
[dcpomatic.git] / test / test.cc
index 3858dff11af091cc248d09eeb82a28dd3661e23d..7e0f5734035bcd54dc8c9c0ec721e3e9e66d6c4e 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2017 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -72,7 +72,8 @@ struct TestConfig
        {
                dcpomatic_setup ();
 
-               Config::instance()->set_num_local_encoding_threads (1);
+               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"));
@@ -119,7 +120,7 @@ new_test_film (string name)
 }
 
 void
-check_audio_file (boost::filesystem::path ref, boost::filesystem::path check)
+check_wav_file (boost::filesystem::path ref, boost::filesystem::path check)
 {
        SF_INFO ref_info;
        ref_info.format = 0;
@@ -161,6 +162,22 @@ check_audio_file (boost::filesystem::path ref, boost::filesystem::path check)
        }
 }
 
+void
+check_image (boost::filesystem::path ref, boost::filesystem::path check)
+{
+#ifdef DCPOMATIC_IMAGE_MAGICK
+       using namespace MagickCore;
+#else
+       using namespace MagickLib;
+#endif
+
+       Magick::Image ref_image;
+       ref_image.read (ref.string ());
+       Magick::Image check_image;
+       check_image.read (check.string ());
+       BOOST_CHECK_MESSAGE (ref_image.compare (check_image), ref << " differs from " << check);
+}
+
 void
 check_file (boost::filesystem::path ref, boost::filesystem::path check)
 {
@@ -332,7 +349,7 @@ wait_for_jobs ()
 }
 
 void
-write_image (shared_ptr<const Image> image, boost::filesystem::path file)
+write_image (shared_ptr<const Image> image, boost::filesystem::path file, string format)
 {
 #ifdef DCPOMATIC_IMAGE_MAGICK
                using namespace MagickCore;
@@ -340,6 +357,6 @@ write_image (shared_ptr<const Image> image, boost::filesystem::path file)
                using namespace MagickLib;
 #endif
 
-       Magick::Image m (image->size().width, image->size().height, "ARGB", CharPixel, (void *) image->data()[0]);
+       Magick::Image m (image->size().width, image->size().height, format.c_str(), CharPixel, (void *) image->data()[0]);
        m.write (file.string ());
 }