summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-06-10 17:14:17 +0100
committerCarl Hetherington <cth@carlh.net>2014-06-10 17:14:17 +0100
commitf0cc79a6c34b8198155f6e519d4464385ea30049 (patch)
tree7509eb1f3ff30187905d55bb8c48a765a9ee209f /test
parente7bc3bd16456c17bc6fe1d7981040b14e820505e (diff)
Support ISDCF naming convention version 9.
Reported-by: Elia Orselli
Diffstat (limited to 'test')
-rw-r--r--test/isdcf_name_test.cc100
-rw-r--r--test/wscript1
2 files changed, 101 insertions, 0 deletions
diff --git a/test/isdcf_name_test.cc b/test/isdcf_name_test.cc
new file mode 100644
index 000000000..65f89c0f4
--- /dev/null
+++ b/test/isdcf_name_test.cc
@@ -0,0 +1,100 @@
+/*
+ Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <boost/test/unit_test.hpp>
+#include "lib/film.h"
+#include "lib/ratio.h"
+#include "lib/dcp_content_type.h"
+#include "lib/image_content.h"
+#include "test.h"
+
+using std::cout;
+using boost::shared_ptr;
+
+BOOST_AUTO_TEST_CASE (isdcf_name_test)
+{
+ shared_ptr<Film> film = new_test_film ("isdcf_name_test");
+
+ /* A basic test */
+
+ film->set_name ("My Nice Film");
+ film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
+ film->set_container (Ratio::from_id ("185"));
+ film->_isdcf_date = boost::gregorian::date (2014, boost::gregorian::Jul, 4);
+ ISDCFMetadata m;
+ m.content_version = 1;
+ m.audio_language = "EN";
+ m.subtitle_language = "XX";
+ m.territory = "UK";
+ m.rating = "PG";
+ m.studio = "ST";
+ m.facility = "FA";
+ m.package_type = "OV";
+ film->set_isdcf_metadata (m);
+ film->set_interop (true);
+ BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilm_FTR-1_F_EN-XX_UK-PG_51_2K_ST_20140704_FA_IOP_OV");
+
+ /* Test a long name and some different data */
+
+ film->set_name ("My Nice Film With A Very Long Name");
+ film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
+ film->set_container (Ratio::from_id ("239"));
+ film->_isdcf_date = boost::gregorian::date (2014, boost::gregorian::Jul, 4);
+ film->set_audio_channels (1);
+ film->set_resolution (RESOLUTION_4K);
+ m.content_version = 2;
+ m.audio_language = "DE";
+ m.subtitle_language = "FR";
+ m.territory = "US";
+ m.rating = "R";
+ m.studio = "DI";
+ m.facility = "PP";
+ m.package_type = "VF";
+ film->set_isdcf_metadata (m);
+ film->set_interop (false);
+ BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2_S_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF");
+
+ /* Test interior aspect ratio */
+
+ shared_ptr<ImageContent> content (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
+ film->examine_and_add_content (content);
+ wait_for_jobs ();
+ content->set_scale (VideoContentScale (Ratio::from_id ("133")));
+ film->set_container (Ratio::from_id ("185"));
+ BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2_F-133_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF");
+
+ /* Test 3D */
+
+ film->set_three_d (true);
+ 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");
+
+ /* Test content type modifiers */
+
+ film->set_three_d (false);
+ m.temp_version = true;
+ m.pre_release = true;
+ m.red_band = true;
+ m.chain = "MyChain";
+ m.two_d_version_of_three_d = true;
+ m.mastered_luminance = "4fl";
+ film->set_isdcf_metadata (m);
+ film->set_video_frame_rate (48);
+ 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");
+}
+
diff --git a/test/wscript b/test/wscript
index 676f47104..09df14673 100644
--- a/test/wscript
+++ b/test/wscript
@@ -31,6 +31,7 @@ def build(bld):
film_metadata_test.cc
frame_rate_test.cc
image_test.cc
+ isdcf_name_test.cc
job_test.cc
make_black_test.cc
pixel_formats_test.cc