Pass through <Ruby> tags in subtitles (#2635) (GH#23).
[dcpomatic.git] / test / test.cc
index 1739e8e899e4750ff1021f7264ea0dfe65e4fce7..2bd31292a562ffab3dd49522810935257c089e18 100644 (file)
@@ -46,6 +46,7 @@
 #include <dcp/cpl.h>
 #include <dcp/dcp.h>
 #include <dcp/equality_options.h>
+#include <dcp/filesystem.h>
 #include <dcp/mono_picture_asset.h>
 #include <dcp/mono_picture_frame.h>
 #include <dcp/openjpeg_image.h>
@@ -107,7 +108,7 @@ TestPaths::TestPaths::private_data ()
 
 boost::filesystem::path TestPaths::xsd ()
 {
-       return boost::filesystem::canonical(boost::filesystem::path("..") / boost::filesystem::path("libdcp") / boost::filesystem::path("xsd"));
+       return boost::filesystem::current_path().parent_path() / "libdcp" / "xsd";
 }
 
 
@@ -135,6 +136,7 @@ setup_test_config ()
        decryption->set_key(dcp::file_to_string("test/data/decryption_key"));
        Config::instance()->set_decryption_chain (decryption);
        Config::instance()->set_dcp_asset_filename_format(dcp::NameFormat("%t"));
+       Config::instance()->set_cinemas_file("test/data/empty_cinemas.xml");
 }
 
 
@@ -157,6 +159,7 @@ struct TestConfig
 
                dcpomatic_setup ();
                setup_test_config ();
+               capture_ffmpeg_logs();
 
                EncodeServerFinder::instance()->stop ();
 
@@ -565,7 +568,7 @@ check_dcp(boost::filesystem::path ref, boost::filesystem::path check, bool sound
        options.max_subtitle_vertical_position_error = 0.001;
        options.sound_assets_can_differ = sound_can_differ;
 
-       BOOST_CHECK (ref_dcp.equals (check_dcp, options, boost::bind (note, _1, _2)));
+       BOOST_CHECK_MESSAGE(ref_dcp.equals(check_dcp, options, boost::bind (note, _1, _2)), check << " does not match " << ref);
 }
 
 void
@@ -840,7 +843,7 @@ dcp_file (shared_ptr<const Film> film, string prefix)
 
        vector<directory_entry> matches;
        std::copy_if(recursive_directory_iterator(film->dir(film->dcp_name())), recursive_directory_iterator(), std::back_inserter(matches), [&prefix](directory_entry const& entry) {
-               return boost::algorithm::starts_with(entry.path().leaf().string(), prefix);
+               return boost::algorithm::starts_with(entry.path().filename().string(), prefix);
        });
 
        BOOST_REQUIRE_MESSAGE(matches.size() == 1, "Found " << matches.size() << " files with prefix " << prefix);
@@ -851,7 +854,7 @@ boost::filesystem::path
 subtitle_file (shared_ptr<Film> film)
 {
        for (auto i: boost::filesystem::recursive_directory_iterator(film->directory().get() / film->dcp_name(false))) {
-               if (boost::algorithm::starts_with(i.path().leaf().string(), "sub_")) {
+               if (boost::algorithm::starts_with(i.path().filename().string(), "sub_")) {
                        return i.path();
                }
        }