2 Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include "lib/dcp_content.h"
22 #include "lib/ffmpeg_content.h"
24 #include <boost/test/unit_test.hpp>
28 using boost::shared_ptr;
30 /** Test the logic which decides whether a DCP can be referenced or not */
31 BOOST_AUTO_TEST_CASE (vf_test1)
33 shared_ptr<Film> film = new_test_film ("vf_test1");
34 shared_ptr<DCPContent> dcp (new DCPContent (film, "test/data/reels_test2"));
35 film->examine_and_add_content (dcp);
38 /* Multi-reel DCP can't be referenced if we are using a single reel for the project */
39 film->set_reel_type (REELTYPE_SINGLE);
41 BOOST_CHECK (!dcp->can_reference_video(why_not));
42 BOOST_CHECK (!dcp->can_reference_audio(why_not));
43 BOOST_CHECK (!dcp->can_reference_subtitle(why_not));
45 /* Multi-reel DCP can be referenced if we are using by-video-content */
46 film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
47 BOOST_CHECK (dcp->can_reference_video(why_not));
48 BOOST_CHECK (dcp->can_reference_audio(why_not));
49 BOOST_CHECK (dcp->can_reference_subtitle(why_not));
51 shared_ptr<FFmpegContent> other (new FFmpegContent (film, "test/data/test.mp4"));
52 film->examine_and_add_content (other);
55 /* Not possible if there is overlap */
56 other->set_position (DCPTime (0));
57 BOOST_CHECK (!dcp->can_reference_video(why_not));
58 BOOST_CHECK (!dcp->can_reference_audio(why_not));
59 BOOST_CHECK (!dcp->can_reference_subtitle(why_not));
61 /* This should not be considered an overlap */
62 other->set_position (dcp->end ());
63 BOOST_CHECK (dcp->can_reference_video(why_not));
64 BOOST_CHECK (dcp->can_reference_audio(why_not));
65 BOOST_CHECK (dcp->can_reference_subtitle(why_not));