Fix failing test due to header differences.
[dcpomatic.git] / test / client_server_test.cc
index e21f41c7998163ec7c5290e1b6aa0b3ba16797aa..1b40174838b758c2b11e1ecb521e845d3772e0a8 100644 (file)
@@ -20,6 +20,7 @@
 
 /** @file  test/client_server_test.cc
  *  @brief Test the server class.
+ *  @ingroup specific
  *
  *  Create a test image and then encode it using the standard mechanism
  *  and also using a EncodeServer object running on localhost.  Compare the resulting
@@ -114,7 +115,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb)
 
        EncodeServer* server = new EncodeServer (log, true, 2);
 
-       new thread (boost::bind (&EncodeServer::run, server));
+       thread* server_thread = new thread (boost::bind (&EncodeServer::run, server));
 
        /* Let the server get itself ready */
        dcpomatic_sleep (1);
@@ -134,6 +135,9 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb)
                delete *i;
        }
 
+       server->stop ();
+       server_thread->join ();
+       delete server_thread;
        delete server;
 }
 
@@ -193,7 +197,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv)
 
        EncodeServer* server = new EncodeServer (log, true, 2);
 
-       new thread (boost::bind (&EncodeServer::run, server));
+       thread* server_thread = new thread (boost::bind (&EncodeServer::run, server));
 
        /* Let the server get itself ready */
        dcpomatic_sleep (1);
@@ -213,6 +217,9 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv)
                delete *i;
        }
 
+       server->stop ();
+       server_thread->join ();
+       delete server_thread;
        delete server;
 }
 
@@ -283,7 +290,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k)
 
        EncodeServer* server = new EncodeServer (log, true, 2);
 
-       new thread (boost::bind (&EncodeServer::run, server));
+       thread* server_thread = new thread (boost::bind (&EncodeServer::run, server));
 
        /* Let the server get itself ready */
        dcpomatic_sleep (1);
@@ -303,5 +310,8 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k)
                delete *i;
        }
 
+       server->stop ();
+       server_thread->join ();
+       delete server_thread;
        delete server;
 }