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>
30 using boost::shared_ptr;
32 /** Test the logic which decides whether a DCP can be referenced or not */
33 BOOST_AUTO_TEST_CASE (vf_test1)
35 shared_ptr<Film> film = new_test_film ("vf_test1");
36 shared_ptr<DCPContent> dcp (new DCPContent (film, "test/data/reels_test2"));
37 film->examine_and_add_content (dcp);
40 /* Multi-reel DCP can't be referenced if we are using a single reel for the project */
41 film->set_reel_type (REELTYPE_SINGLE);
43 BOOST_CHECK (!dcp->can_reference_video(why_not));
44 BOOST_CHECK (!dcp->can_reference_audio(why_not));
45 BOOST_CHECK (!dcp->can_reference_subtitle(why_not));
47 /* Multi-reel DCP can be referenced if we are using by-video-content */
48 film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
49 BOOST_CHECK (dcp->can_reference_video(why_not));
50 BOOST_CHECK (dcp->can_reference_audio(why_not));
51 /* (but reels_test2 has no subtitles to reference) */
52 BOOST_CHECK (!dcp->can_reference_subtitle(why_not));
54 shared_ptr<FFmpegContent> other (new FFmpegContent (film, "test/data/test.mp4"));
55 film->examine_and_add_content (other);
58 /* Not possible if there is overlap */
59 other->set_position (DCPTime (0));
60 BOOST_CHECK (!dcp->can_reference_video(why_not));
61 BOOST_CHECK (!dcp->can_reference_audio(why_not));
62 BOOST_CHECK (!dcp->can_reference_subtitle(why_not));
64 /* This should not be considered an overlap */
65 other->set_position (dcp->end ());
66 BOOST_CHECK (dcp->can_reference_video(why_not));
67 BOOST_CHECK (dcp->can_reference_audio(why_not));
68 /* (reels_test2 has no subtitles to reference) */
69 BOOST_CHECK (!dcp->can_reference_subtitle(why_not));