Speculative support for multi-part subtitles (#709).
[dcpomatic.git] / test / test.cc
index 1080aec793f4ecd1b5f4efa9f9d5ccb33297e1e7..acc3e4ca485a4343aae186f4e94a4b3d98698939 100644 (file)
  *  @brief Overall test stuff and useful methods for tests.
  */
 
-#include <vector>
-#include <list>
-#include <Magick++.h>
-#include <sndfile.h>
-#include <libxml++/libxml++.h>
-#include <dcp/dcp.h>
 #include "lib/config.h"
 #include "lib/util.h"
 #include "lib/signal_manager.h"
 #include "lib/cross.h"
 #include "lib/server_finder.h"
 #include "lib/image.h"
+#include "lib/ratio.h"
+#include <dcp/dcp.h>
+#include <sndfile.h>
+#include <libxml++/libxml++.h>
+#include <Magick++.h>
 #define BOOST_TEST_DYN_LINK
 #define BOOST_TEST_MODULE dcpomatic_test
 #include <boost/test/unit_test.hpp>
+#include <list>
+#include <vector>
+#include <iostream>
 
 using std::string;
 using std::vector;
@@ -144,7 +146,10 @@ check_audio_file (boost::filesystem::path ref, boost::filesystem::path check)
                BOOST_CHECK_EQUAL (r, this_time);
 
                for (sf_count_t i = 0; i < this_time; ++i) {
-                       BOOST_REQUIRE (abs (ref_buffer[i] - check_buffer[i]) <= 65536);
+                       BOOST_REQUIRE_MESSAGE (
+                               abs (ref_buffer[i] - check_buffer[i]) <= 65536,
+                               ref << " differs from " << check << " at " << (ref_info.frames - N + i) << " of " << ref_info.frames
+                               );
                }
 
                N -= this_time;
@@ -288,10 +293,9 @@ wait_for_jobs ()
        JobManager* jm = JobManager::instance ();
        while (jm->work_to_do ()) {
                signal_manager->ui_idle ();
+               dcpomatic_sleep (1);
        }
 
-       cout << "Waiting for jobs: all finished; errors=" << jm->errors() << ".\n";
-
        if (jm->errors ()) {
                int N = 0;
                for (list<shared_ptr<Job> >::iterator i = jm->_jobs.begin(); i != jm->_jobs.end(); ++i) {
@@ -313,10 +317,7 @@ wait_for_jobs ()
        signal_manager->ui_idle ();
 
        if (jm->errors ()) {
-               cout << "Dropping JobManager\n";
                JobManager::drop ();
-       } else {
-               cout << "Not dropping JobManager\n";
        }
 }