Add failing test for one short-reel possibility.
authorCarl Hetherington <cth@carlh.net>
Mon, 9 Mar 2020 15:42:30 +0000 (16:42 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 11 Mar 2020 21:24:28 +0000 (22:24 +0100)
test/reels_test.cc
test/test.cc
test/test.h

index 3d79017f0abdaec7be8024e313a2c6163a0aff88..8d15aba5291b28e30a5e661fd9c87d87dee244f4 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2015-2019 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2015-2020 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
 
 using std::list;
 using std::cout;
 
 using std::list;
 using std::cout;
+using std::vector;
+using std::string;
 using boost::shared_ptr;
 using boost::shared_ptr;
+using boost::function;
 using namespace dcpomatic;
 
 /** Test Film::reels() */
 using namespace dcpomatic;
 
 /** Test Film::reels() */
@@ -482,3 +485,32 @@ BOOST_AUTO_TEST_CASE (reels_test12)
        BOOST_CHECK_EQUAL (i->from.get(), DCPTime::from_seconds(14).get());
        BOOST_CHECK_EQUAL (i->to.get(),   DCPTime::from_seconds(19).get());
 }
        BOOST_CHECK_EQUAL (i->from.get(), DCPTime::from_seconds(14).get());
        BOOST_CHECK_EQUAL (i->to.get(),   DCPTime::from_seconds(19).get());
 }
+
+static void
+no_op ()
+{
+
+}
+
+
+/** Using less than 1 second's worth of content should not result in a reel
+ *  of less than 1 second's duration.
+ */
+BOOST_AUTO_TEST_CASE (reels_should_not_be_short1)
+{
+       shared_ptr<Film> film = new_test_film2 ("reels_should_not_be_short1");
+       film->set_video_frame_rate (24);
+
+       shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
+       film->examine_and_add_content (A);
+       BOOST_REQUIRE (!wait_for_jobs());
+       A->video->set_length (23);
+
+       film->make_dcp ();
+       BOOST_REQUIRE (!wait_for_jobs());
+
+       vector<boost::filesystem::path> dirs;
+       dirs.push_back (film->dir(film->dcp_name(false)));
+       BOOST_REQUIRE (dcp::verify(dirs, boost::bind(&no_op), boost::bind(&no_op), TestPaths::xsd).empty());
+}
+
index c0d5d776f17b89a0a00e738aa44a2f8526caee18..b111a3b6b85a62dfe591e81aac2c78c2aae822b1 100644 (file)
@@ -72,6 +72,7 @@ using boost::scoped_array;
 using boost::dynamic_pointer_cast;
 
 boost::filesystem::path private_data = boost::filesystem::canonical(boost::filesystem::path ("..") / boost::filesystem::path ("dcpomatic-test-private"));
 using boost::dynamic_pointer_cast;
 
 boost::filesystem::path private_data = boost::filesystem::canonical(boost::filesystem::path ("..") / boost::filesystem::path ("dcpomatic-test-private"));
+boost::filesystem::path TestPaths::xsd = boost::filesystem::canonical(boost::filesystem::path("..") / boost::filesystem::path("libdcp") / boost::filesystem::path("xsd"));
 
 void
 setup_test_config ()
 
 void
 setup_test_config ()
index 3a11effa101b1628efc1022012d9ff944b1bb265..c94bad595de4f9b3581bcb1869bbe772b369daab 100644 (file)
@@ -26,6 +26,12 @@ class Image;
 
 extern boost::filesystem::path private_data;
 
 
 extern boost::filesystem::path private_data;
 
+class TestPaths
+{
+public:
+       static boost::filesystem::path xsd;
+};
+
 extern bool wait_for_jobs ();
 extern void setup_test_config ();
 extern boost::shared_ptr<Film> new_test_film (std::string);
 extern bool wait_for_jobs ();
 extern void setup_test_config ();
 extern boost::shared_ptr<Film> new_test_film (std::string);