Various playlist editor developments and fixes.
[dcpomatic.git] / test / video_mxf_content_test.cc
1 /*
2     Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
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.
10
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.
15
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/>.
18
19 */
20
21 /** @file  test/video_mxf_content_test.cc
22  *  @brief Test use of Video MXF content.
23  *  @ingroup specific
24  */
25
26 #include "lib/film.h"
27 #include "lib/video_mxf_content.h"
28 #include "lib/content_factory.h"
29 #include "lib/dcp_content_type.h"
30 #include "lib/ratio.h"
31 #include "test.h"
32 #include <dcp/mono_picture_asset.h>
33 #include <boost/test/unit_test.hpp>
34
35 using boost::shared_ptr;
36 using boost::dynamic_pointer_cast;
37
38 static boost::filesystem::path ref_mxf = "test/data/scaling_test_185_185/j2c_a41afbff-e1ad-41c4-9a84-de315b95dd0f.mxf";
39
40 static void note (dcp::NoteType, std::string)
41 {
42
43 }
44
45 /** Basic test of using video MXF content */
46 BOOST_AUTO_TEST_CASE (video_mxf_content_test)
47 {
48         shared_ptr<Film> film = new_test_film ("video_mxf_content_test");
49         film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
50         film->set_container (Ratio::from_id ("185"));
51         film->set_name ("video_mxf_content_test");
52
53         shared_ptr<Content> content = content_factory(ref_mxf).front();
54         shared_ptr<VideoMXFContent> check = dynamic_pointer_cast<VideoMXFContent> (content);
55         BOOST_REQUIRE (check);
56         film->examine_and_add_content (content);
57         BOOST_REQUIRE (!wait_for_jobs());
58         film->make_dcp ();
59         BOOST_REQUIRE (!wait_for_jobs());
60
61         shared_ptr<dcp::MonoPictureAsset> ref (new dcp::MonoPictureAsset (ref_mxf));
62         boost::filesystem::directory_iterator i ("build/test/video_mxf_content_test/video");
63         shared_ptr<dcp::MonoPictureAsset> comp (new dcp::MonoPictureAsset (*i));
64         dcp::EqualityOptions op;
65         BOOST_CHECK (ref->equals (comp, op, note));
66 }