diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-09-23 14:25:11 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-09-23 14:25:11 +0100 |
| commit | ce799a03297e4961dc203ceae0dcc41d80a44aa8 (patch) | |
| tree | 83504fdfd3761615898390a4a287ba27b136045e | |
| parent | 93c3365a547fbb7467b6c47571c5a68e17b31e0c (diff) | |
| parent | a8e064b831718a3b06035c12ae94c3caa7a1b4b3 (diff) | |
Fix merge of master.
| -rw-r--r-- | test/test.cc | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/test.cc b/test/test.cc index f564a8f86..06954822d 100644 --- a/test/test.cc +++ b/test/test.cc @@ -29,6 +29,11 @@ #include "exceptions.h" #include "dvd.h" #include "delay_line.h" +#include "image.h" +#include "log.h" +#include "dcp_video_frame.h" +#include "config.h" +#include "server.h" #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE dvdomatic_test #include <boost/test/unit_test.hpp> @@ -248,3 +253,47 @@ BOOST_AUTO_TEST_CASE (paths_test) s.content = "foo/bar/baz"; BOOST_CHECK_EQUAL (s.content_path(), "build/test/a/b/c/d/e/foo/bar/baz"); } + +BOOST_AUTO_TEST_CASE (client_server_test) +{ + shared_ptr<SimpleImage> image (new SimpleImage (PIX_FMT_RGB24, Size (1998, 1080))); + image->set_line_size (0, 1998 * 3); + + uint8_t* p = image->data()[0]; + + for (int y = 0; y < 1080; ++y) { + for (int x = 0; x < 1998; ++x) { + *p++ = x % 256; + *p++ = y % 256; + *p++ = (x + y) % 256; + } + } + + FileLog log ("build/test/client_server_test.log"); + + DCPVideoFrame frame ( + image, + Size (1998, 1080), + 0, + Scaler::from_id ("bicubic"), + 0, + 24, + "", + 0, + 200000000, + &log + ); + + shared_ptr<EncodedData> locally_encoded = frame.encode_locally (); + + Config::instance()->set_server_port (61920); + Server server (&log); + + thread t (boost::bind (&Server::run, &server, 1)); + + ServerDescription description ("localhost", 1); + shared_ptr<EncodedData> remotely_encoded = frame.encode_remotely (&description); + + BOOST_CHECK_EQUAL (locally_encoded->size(), remotely_encoded->size()); + BOOST_CHECK (memcmp (locally_encoded->data(), remotely_encoded->data(), locally_encoded->size()) == 0); +} |
