diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-09-16 10:10:46 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-09-18 10:41:19 +0200 |
| commit | a9cb7313f7846f8b2bf9f96d19cf28abd7caf7fc (patch) | |
| tree | 020b1ed7922e97c9711641209efdab845cdf65fc /test | |
| parent | 5c5da23c412e9b922154f8934e16f3a51ff48bdc (diff) | |
Fix thinko in relative path change.
We have to canonicalise relative paths with respect to the film's
directory on load, otherwise we try to use the relative path and it's
interpreted against the current working directory.
This unfortunately requires the film's directory to be piped into quite
a lot of new places.
Diffstat (limited to 'test')
| -rw-r--r-- | test/relative_paths_test.cc | 44 | ||||
| -rw-r--r-- | test/time_calculation_test.cc | 8 | ||||
| -rw-r--r-- | test/wscript | 1 |
3 files changed, 49 insertions, 4 deletions
diff --git a/test/relative_paths_test.cc b/test/relative_paths_test.cc new file mode 100644 index 000000000..cf40a8465 --- /dev/null +++ b/test/relative_paths_test.cc @@ -0,0 +1,44 @@ +/* + Copyright (C) 2024 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + + +#include "lib/content.h" +#include "lib/content_factory.h" +#include "lib/config.h" +#include "lib/film.h" +#include "test.h" +#include <boost/test/unit_test.hpp> + + +BOOST_AUTO_TEST_CASE(relative_paths_test) +{ + ConfigRestorer cr; + Config::instance()->set_relative_paths(true); + + auto picture = content_factory("test/data/flat_red.png")[0]; + auto film = new_test_film("relative_paths_test", { picture }); + film->write_metadata(); + + auto film2 = std::make_shared<Film>(boost::filesystem::path("build/test/relative_paths_test")); + film2->read_metadata(); + BOOST_REQUIRE_EQUAL(film2->content().size(), 1U); + BOOST_REQUIRE(film2->content()[0]->paths_valid()); +} + diff --git a/test/time_calculation_test.cc b/test/time_calculation_test.cc index 0e09ae2c3..28a1c61ab 100644 --- a/test/time_calculation_test.cc +++ b/test/time_calculation_test.cc @@ -138,7 +138,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_time_calculation_test) doc->read_string (xml); list<string> notes; - auto content = make_shared<FFmpegContent>(doc, film->state_version(), notes); + auto content = std::make_shared<FFmpegContent>(doc, boost::none, film->state_version(), notes); /* 25fps content, 25fps DCP */ film->set_video_frame_rate (25); @@ -192,7 +192,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) doc->read_string (xml); list<string> notes; - auto content = make_shared<FFmpegContent>(doc, film->state_version(), notes); + auto content = std::make_shared<FFmpegContent>(doc, boost::none, film->state_version(), notes); film->set_sequence (false); film->add_content (content); @@ -398,7 +398,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) doc->read_string (xml); list<string> notes; - auto content = make_shared<FFmpegContent>(doc, film->state_version(), notes); + auto content = std::make_shared<FFmpegContent>(doc, boost::none, film->state_version(), notes); film->set_sequence (false); film->add_content (content); @@ -574,7 +574,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) doc->read_string (xml); list<string> notes; - auto content = make_shared<FFmpegContent>(doc, film->state_version(), notes); + auto content = std::make_shared<FFmpegContent>(doc, boost::none, film->state_version(), notes); auto stream = content->audio->streams().front(); film->set_sequence (false); film->add_content (content); diff --git a/test/wscript b/test/wscript index 2802a4678..e9f24f0fe 100644 --- a/test/wscript +++ b/test/wscript @@ -132,6 +132,7 @@ def build(bld): playlist_test.cc pulldown_detect_test.cc ratio_test.cc + relative_paths_test.cc release_notes_test.cc repeat_frame_test.cc recover_test.cc |
