2 Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
22 #include "lib/dcp_content.h"
23 #include "lib/ffmpeg_content.h"
25 #include <boost/test/unit_test.hpp>
26 #include <boost/foreach.hpp>
27 #include <boost/make_shared.hpp>
31 using boost::shared_ptr;
32 using boost::make_shared;
34 /** Test the logic which decides whether a DCP can be referenced or not */
35 BOOST_AUTO_TEST_CASE (vf_test1)
37 shared_ptr<Film> film = new_test_film ("vf_test1");
38 shared_ptr<DCPContent> dcp = make_shared<DCPContent> (film, "test/data/reels_test2");
39 film->examine_and_add_content (dcp);
42 /* Multi-reel DCP can't be referenced if we are using a single reel for the project */
43 film->set_reel_type (REELTYPE_SINGLE);
45 BOOST_CHECK (!dcp->can_reference_video(why_not));
46 BOOST_CHECK (!dcp->can_reference_audio(why_not));
47 BOOST_CHECK (!dcp->can_reference_subtitle(why_not));
49 /* Multi-reel DCP can be referenced if we are using by-video-content */
50 film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
51 BOOST_CHECK (dcp->can_reference_video(why_not));
52 BOOST_CHECK (dcp->can_reference_audio(why_not));
53 /* (but reels_test2 has no subtitles to reference) */
54 BOOST_CHECK (!dcp->can_reference_subtitle(why_not));
56 shared_ptr<FFmpegContent> other = make_shared<FFmpegContent> (film, "test/data/test.mp4");
57 film->examine_and_add_content (other);
60 /* Not possible if there is overlap */
61 other->set_position (DCPTime (0));
62 BOOST_CHECK (!dcp->can_reference_video(why_not));
63 BOOST_CHECK (!dcp->can_reference_audio(why_not));
64 BOOST_CHECK (!dcp->can_reference_subtitle(why_not));
66 /* This should not be considered an overlap */
67 other->set_position (dcp->end ());
68 BOOST_CHECK (dcp->can_reference_video(why_not));
69 BOOST_CHECK (dcp->can_reference_audio(why_not));
70 /* (reels_test2 has no subtitles to reference) */
71 BOOST_CHECK (!dcp->can_reference_subtitle(why_not));