2 Copyright (C) 2014 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.
20 #include <boost/test/unit_test.hpp>
22 #include "lib/ratio.h"
23 #include "lib/dcp_content_type.h"
24 #include "lib/image_content.h"
28 using boost::shared_ptr;
30 BOOST_AUTO_TEST_CASE (isdcf_name_test)
32 shared_ptr<Film> film = new_test_film ("isdcf_name_test");
36 film->set_name ("My Nice Film");
37 film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
38 film->set_container (Ratio::from_id ("185"));
39 film->_isdcf_date = boost::gregorian::date (2014, boost::gregorian::Jul, 4);
41 m.content_version = 1;
42 m.audio_language = "EN";
43 m.subtitle_language = "XX";
48 m.package_type = "OV";
49 film->set_isdcf_metadata (m);
50 film->set_interop (true);
51 BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilm_FTR-1_F_EN-XX_UK-PG_51_2K_ST_20140704_FA_IOP_OV");
53 /* Test a long name and some different data */
55 film->set_name ("My Nice Film With A Very Long Name");
56 film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
57 film->set_container (Ratio::from_id ("239"));
58 film->_isdcf_date = boost::gregorian::date (2014, boost::gregorian::Jul, 4);
59 film->set_audio_channels (1);
60 film->set_resolution (RESOLUTION_4K);
61 m.content_version = 2;
62 m.audio_language = "DE";
63 m.subtitle_language = "FR";
68 m.package_type = "VF";
69 film->set_isdcf_metadata (m);
70 film->set_interop (false);
71 BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2_S_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF");
73 /* Test interior aspect ratio */
75 shared_ptr<ImageContent> content (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
76 film->examine_and_add_content (content);
78 content->set_scale (VideoContentScale (Ratio::from_id ("133")));
79 film->set_container (Ratio::from_id ("185"));
80 BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2_F-133_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF");
84 film->set_three_d (true);
85 BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2-3D_F-133_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE-3D_VF");
87 /* Test content type modifiers */
89 film->set_three_d (false);
90 m.temp_version = true;
94 m.two_d_version_of_three_d = true;
95 m.mastered_luminance = "4fl";
96 film->set_isdcf_metadata (m);
97 film->set_video_frame_rate (48);
98 BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2-Temp-Pre-RedBand-MyChain-2D-4fl-48_F-133_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF");