Try again to fix ui signalling during tests.
authorCarl Hetherington <cth@carlh.net>
Thu, 29 Aug 2013 11:11:20 +0000 (12:11 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 29 Aug 2013 11:11:20 +0000 (12:11 +0100)
src/lib/examine_content_job.cc
src/lib/job_manager.cc
test/audio_delay_test.cc
test/test.cc

index 3cab9716de3783576d92cd9e441d50e6d1765df8..cbf180ffcb3bf451379e410039d5d28dfed75d80 100644 (file)
@@ -26,6 +26,7 @@
 #include "i18n.h"
 
 using std::string;
+using std::cout;
 using boost::shared_ptr;
 
 ExamineContentJob::ExamineContentJob (shared_ptr<const Film> f, shared_ptr<Content> c)
index 95961c3fcd99bb468c648adadde387fc3150c9f3..a841fa60bd553698a873e7105d5f2086e8e4040b 100644 (file)
@@ -30,6 +30,7 @@
 
 using std::string;
 using std::list;
+using std::cout;
 using boost::shared_ptr;
 using boost::weak_ptr;
 
index 929a941d6c7805cea218c19b79076f760c89ae2b..77243ea6d0e46d04b56dbeb34c33b5120977efc5 100644 (file)
@@ -29,6 +29,7 @@
 #include "test.h"
 
 using std::string;
+using std::cout;
 using boost::lexical_cast;
 using boost::shared_ptr;
 
index 1c7b7e245c11e967cf59dd8f02e497aa67cd3212..154510738e3200bd4ebc1b15cb52ce58763a42b0 100644 (file)
@@ -39,6 +39,16 @@ using std::cerr;
 using std::list;
 using boost::shared_ptr;
 
+class TestUISignaller : public UISignaller
+{
+public:
+       /* No wakes in tests: we call ui_idle ourselves */
+       void wake_ui ()
+       {
+
+       }
+};
+
 struct TestConfig
 {
        TestConfig()
@@ -52,7 +62,7 @@ struct TestConfig
                Config::instance()->set_default_container (static_cast<Ratio*> (0));
                Config::instance()->set_default_dcp_content_type (static_cast<DCPContentType*> (0));
 
-               ui_signaller = new UISignaller ();
+               ui_signaller = new TestUISignaller ();
        }
 };
 
@@ -141,7 +151,9 @@ void
 wait_for_jobs ()
 {
        JobManager* jm = JobManager::instance ();
-       while (jm->work_to_do ()) {}
+       while (jm->work_to_do ()) {
+               ui_signaller->ui_idle ();
+       }
        if (jm->errors ()) {
                for (list<shared_ptr<Job> >::iterator i = jm->_jobs.begin(); i != jm->_jobs.end(); ++i) {
                        if ((*i)->finished_in_error ()) {
@@ -153,6 +165,5 @@ wait_for_jobs ()
                
        BOOST_CHECK (!jm->errors());
 
-       /* Hack: wait for ui_signaller signals to fire */
-       dcpomatic_sleep (1);
+       ui_signaller->ui_idle ();
 }