Fix tests.
authorCarl Hetherington <cth@carlh.net>
Sat, 24 Nov 2018 15:00:53 +0000 (15:00 +0000)
committerCarl Hetherington <cth@carlh.net>
Sat, 24 Nov 2018 15:00:53 +0000 (15:00 +0000)
src/lib/dcp_content.cc
src/lib/dcp_content.h
test/optimise_stills_test.cc

index ac9f828996d286c20b15f849ff378dd5e5921035..419ffe69c4b7eef417598ee34d01fad25274f9d1 100644 (file)
@@ -150,16 +150,7 @@ DCPContent::DCPContent (cxml::ConstNodePtr node, int version)
 void
 DCPContent::read_directory (boost::filesystem::path p)
 {
-       LOG_GENERAL ("DCPContent::read_directory reads %1", p.string());
-       for (boost::filesystem::directory_iterator i(p); i != boost::filesystem::directory_iterator(); ++i) {
-               if (boost::filesystem::is_regular_file (i->path())) {
-                       LOG_GENERAL ("Inside there's regular file %1", i->path().string());
-                       add_path (i->path());
-               } else if (boost::filesystem::is_directory (i->path ())) {
-                       LOG_GENERAL ("Inside there's directory %1", i->path().string());
-                       read_directory (i->path());
-               }
-       }
+       read_sub_directory (p);
 
        bool have_assetmap = false;
        BOOST_FOREACH (boost::filesystem::path i, paths()) {
@@ -173,6 +164,21 @@ DCPContent::read_directory (boost::filesystem::path p)
        }
 }
 
+void
+DCPContent::read_sub_directory (boost::filesystem::path p)
+{
+       LOG_GENERAL ("DCPContent::read_sub_directory reads %1", p.string());
+       for (boost::filesystem::directory_iterator i(p); i != boost::filesystem::directory_iterator(); ++i) {
+               if (boost::filesystem::is_regular_file (i->path())) {
+                       LOG_GENERAL ("Inside there's regular file %1", i->path().string());
+                       add_path (i->path());
+               } else if (boost::filesystem::is_directory (i->path ())) {
+                       LOG_GENERAL ("Inside there's directory %1", i->path().string());
+                       read_sub_directory (i->path());
+               }
+       }
+}
+
 void
 DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
 {
index 656c96897177448aa37aad8bbf58cef988e83030..763b3e903358ff1809e289486bc1a6b504e8f7d5 100644 (file)
@@ -152,6 +152,7 @@ private:
        void add_properties (boost::shared_ptr<const Film> film, std::list<UserProperty>& p) const;
 
        void read_directory (boost::filesystem::path);
+       void read_sub_directory (boost::filesystem::path);
        std::list<DCPTimePeriod> reels (boost::shared_ptr<const Film> film) const;
        bool can_reference (
                boost::shared_ptr<const Film> film,
index 3e69c95b6173da4d717964a7ba15f037dbb94156..d9f8d262a1c17ad0353d018a56aefc3beaca2261 100644 (file)
@@ -28,6 +28,7 @@
 #include "lib/dcp_content_type.h"
 #include "lib/content.h"
 #include "lib/video_content.h"
+#include "lib/dcpomatic_log.h"
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 #include <boost/algorithm/string.hpp>
@@ -72,6 +73,7 @@ check (string name, int check_full, int check_repeat)
 BOOST_AUTO_TEST_CASE (optimise_stills_test1)
 {
        shared_ptr<Film> film = new_test_film ("optimise_stills_test1");
+       dcpomatic_log = film->log ();
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
@@ -88,6 +90,7 @@ BOOST_AUTO_TEST_CASE (optimise_stills_test1)
 BOOST_AUTO_TEST_CASE (optimise_stills_test2)
 {
        shared_ptr<Film> film = new_test_film ("optimise_stills_test2");
+       dcpomatic_log = film->log ();
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");