Merge branch 'fix-early-audio-take2' into staging
authorCarl Hetherington <cth@carlh.net>
Mon, 15 Apr 2013 21:00:15 +0000 (22:00 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 15 Apr 2013 21:00:15 +0000 (22:00 +0100)
1  2 
test/test.cc

diff --combined test/test.cc
index 4c468e22d86331a55d834f1ad8f322121835a3d5,0e9cafcdfd765ef8275a96b2a155f868dc55cbeb..724b7ac00c6e2f6db28e40581b863d1e7977f0cc
@@@ -28,7 -28,6 +28,6 @@@
  #include "job_manager.h"
  #include "util.h"
  #include "exceptions.h"
- #include "delay_line.h"
  #include "image.h"
  #include "log.h"
  #include "dcp_video_frame.h"
@@@ -222,13 -221,11 +221,13 @@@ BOOST_AUTO_TEST_CASE (format_test
        
        Format const * f = Format::from_nickname ("Flat");
        BOOST_CHECK (f);
 -      BOOST_CHECK_EQUAL (f->ratio_as_integer(shared_ptr<const Film> ()), 185);
 +      BOOST_CHECK_EQUAL (f->dcp_size().width, 1998);
 +      BOOST_CHECK_EQUAL (f->dcp_size().height, 1080);
        
        f = Format::from_nickname ("Scope");
        BOOST_CHECK (f);
 -      BOOST_CHECK_EQUAL (f->ratio_as_integer(shared_ptr<const Film> ()), 239);
 +      BOOST_CHECK_EQUAL (f->dcp_size().width, 2048);
 +      BOOST_CHECK_EQUAL (f->dcp_size().height, 858);
  }
  
  /* Test VariableFormat-based scaling of content */
@@@ -280,101 -277,6 +279,6 @@@ public
        void do_log (string) {}
  };
  
- void
- do_positive_delay_line_test (int delay_length, int data_length)
- {
-       shared_ptr<NullLog> log (new NullLog);
-       
-       DelayLine d (log, 6, delay_length);
-       shared_ptr<AudioBuffers> data (new AudioBuffers (6, data_length));
-       int in = 0;
-       int out = 0;
-       int returned = 0;
-       int zeros = 0;
-       
-       for (int i = 0; i < 64; ++i) {
-               for (int j = 0; j < data_length; ++j) {
-                       for (int c = 0; c < 6; ++c ) {
-                               data->data(c)[j] = in;
-                               ++in;
-                       }
-               }
-               /* This only works because the delay line modifies the parameter */
-               d.process_audio (data);
-               returned += data->frames ();
-               for (int j = 0; j < data->frames(); ++j) {
-                       if (zeros < delay_length) {
-                               for (int c = 0; c < 6; ++c) {
-                                       BOOST_CHECK_EQUAL (data->data(c)[j], 0);
-                               }
-                               ++zeros;
-                       } else {
-                               for (int c = 0; c < 6; ++c) {
-                                       BOOST_CHECK_EQUAL (data->data(c)[j], out);
-                                       ++out;
-                               }
-                       }
-               }
-       }
-       BOOST_CHECK_EQUAL (returned, 64 * data_length);
- }
- void
- do_negative_delay_line_test (int delay_length, int data_length)
- {
-       shared_ptr<NullLog> log (new NullLog);
-       DelayLine d (log, 6, delay_length);
-       shared_ptr<AudioBuffers> data (new AudioBuffers (6, data_length));
-       int in = 0;
-       int out = -delay_length * 6;
-       int returned = 0;
-       
-       for (int i = 0; i < 256; ++i) {
-               data->set_frames (data_length);
-               for (int j = 0; j < data_length; ++j) {
-                       for (int c = 0; c < 6; ++c) {
-                               data->data(c)[j] = in;
-                               ++in;
-                       }
-               }
-               /* This only works because the delay line modifies the parameter */
-               d.process_audio (data);
-               returned += data->frames ();
-               for (int j = 0; j < data->frames(); ++j) {
-                       for (int c = 0; c < 6; ++c) {
-                               BOOST_CHECK_EQUAL (data->data(c)[j], out);
-                               ++out;
-                       }
-               }
-       }
-       returned += -delay_length;
-       BOOST_CHECK_EQUAL (returned, 256 * data_length);
- }
- BOOST_AUTO_TEST_CASE (delay_line_test)
- {
-       do_positive_delay_line_test (64, 128);
-       do_positive_delay_line_test (128, 64);
-       do_positive_delay_line_test (3, 512);
-       do_positive_delay_line_test (512, 3);
-       do_positive_delay_line_test (0, 64);
-       do_negative_delay_line_test (-64, 128);
-       do_negative_delay_line_test (-128, 64);
-       do_negative_delay_line_test (-3, 512);
-       do_negative_delay_line_test (-512, 3);
- }
  BOOST_AUTO_TEST_CASE (md5_digest_test)
  {
        string const t = md5_digest ("test/md5.test");