Add some tests; fix failure to make DCP when there is a bit of audio right at the...
[dcpomatic.git] / test / reels_test.cc
index 6c617d6b206d6d918fa0b958eb49fbd58db84000..72a3fe7d3545773e68ba9355a044418d81f8c5d7 100644 (file)
 #include "lib/dcp_content.h"
 #include "lib/video_content.h"
 #include "lib/text_subtitle_content.h"
+#include "lib/content_factory.h"
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 #include <boost/foreach.hpp>
 
 using std::list;
+using std::cout;
 using boost::shared_ptr;
 
 /** Test Film::reels() */
@@ -307,14 +309,20 @@ BOOST_AUTO_TEST_CASE (reels_test7)
        film->set_name ("reels_test7");
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
-       shared_ptr<FFmpegContent> A (new FFmpegContent (film, "test/data/flat_red.png"));
+       shared_ptr<Content> A = content_factory(film, "test/data/flat_red.png").front();
        film->examine_and_add_content (A);
        BOOST_REQUIRE (!wait_for_jobs ());
-       shared_ptr<FFmpegContent> B (new FFmpegContent (film, "test/data/awkward_length.wav"));
+       shared_ptr<Content> B = content_factory(film, "test/data/awkward_length.wav").front();
        film->examine_and_add_content (B);
        BOOST_REQUIRE (!wait_for_jobs ());
+       film->set_video_frame_rate (24);
+       A->video->set_length (3 * 24);
 
        film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
+       BOOST_REQUIRE_EQUAL (film->reels().size(), 2);
+       BOOST_CHECK (film->reels().front() == DCPTimePeriod(DCPTime(0), DCPTime::from_frames(3 * 24, 24)));
+       BOOST_CHECK (film->reels().back() == DCPTimePeriod(DCPTime::from_frames(3 * 24, 24), DCPTime::from_frames(3 * 24 + 1, 24)));
+
        film->make_dcp ();
        BOOST_REQUIRE (!wait_for_jobs ());
 }