X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=test%2Fisdcf_name_test.cc;h=c65340e1c3e8c7339dc369f694318621983f13d5;hb=f1b5f778c2a4d9ec29e5d61b896908c0669f07f9;hp=3341cc862e436929ea9c3f2f461ad6113d30b885;hpb=d60b9d006fee94fab80ee86fe1149de7f2e76750;p=dcpomatic.git diff --git a/test/isdcf_name_test.cc b/test/isdcf_name_test.cc index 3341cc862..c65340e1c 100644 --- a/test/isdcf_name_test.cc +++ b/test/isdcf_name_test.cc @@ -1,22 +1,28 @@ /* Copyright (C) 2014-2016 Carl Hetherington - This program is free software; you can redistribute it and/or modify + This file is part of DCP-o-matic. + + DCP-o-matic 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, + DCP-o-matic 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. + along with DCP-o-matic. If not, see . */ +/** @file test/isdcf_name_test.cc + * @brief Test creation of ISDCF names. + * @ingroup specific + */ + #include #include "lib/film.h" #include "lib/ratio.h" @@ -52,7 +58,7 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test) m.facility = "FA"; film->set_isdcf_metadata (m); film->set_interop (true); - BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilm_FTR-1_F_EN-XX_UK-PG_2K_ST_20140704_FA_IOP_OV"); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilm_FTR-1_F_EN-XX_UK-PG_MOS_2K_ST_20140704_FA_IOP_OV"); /* Test a long name and some different data */ @@ -71,26 +77,42 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test) m.facility = "PP"; film->set_isdcf_metadata (m); film->set_interop (false); - BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2_S_DE-fr_US-R_4K_DI_20140704_PP_SMPTE_OV"); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2_S_DE-fr_US-R_MOS_4K_DI_20140704_PP_SMPTE_OV"); + + /* Test to see that RU ratings like 6+ survive */ + m.rating = "6+"; + film->set_isdcf_metadata (m); + BOOST_CHECK_EQUAL (film->dcp_name(false), "MyNiceFilmWith_TLR-2_S_DE-fr_US-6+_MOS_4K_DI_20140704_PP_SMPTE_OV"); + m.rating = "R"; + film->set_isdcf_metadata (m); /* Test interior aspect ratio: shouldn't be shown with trailers */ - shared_ptr content (new ImageContent (film, "test/data/simple_testcard_640x480.png")); + shared_ptr content (new ImageContent ("test/data/simple_testcard_640x480.png")); film->examine_and_add_content (content); - wait_for_jobs (); + BOOST_REQUIRE (!wait_for_jobs()); content->video->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_DE-fr_US-R_4K_DI_20140704_PP_SMPTE_OV"); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2_F_DE-fr_US-R_MOS_4K_DI_20140704_PP_SMPTE_OV"); /* But should be shown for anything else */ film->set_dcp_content_type (DCPContentType::from_isdcf_name ("XSN")); - BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_XSN-2_F-133_DE-fr_US-R_4K_DI_20140704_PP_SMPTE_OV"); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_XSN-2_F-133_DE-fr_US-R_MOS_4K_DI_20140704_PP_SMPTE_OV"); + + /* And it should always be numeric */ + + content->video->set_scale (VideoContentScale (Ratio::from_id ("239"))); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_XSN-2_F-239_DE-fr_US-R_MOS_4K_DI_20140704_PP_SMPTE_OV"); + + content->video->set_scale (VideoContentScale (Ratio::from_id ("190"))); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_XSN-2_F-190_DE-fr_US-R_MOS_4K_DI_20140704_PP_SMPTE_OV"); + content->video->set_scale (VideoContentScale (Ratio::from_id ("133"))); /* Test 3D */ film->set_three_d (true); - BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_XSN-2-3D_F-133_DE-fr_US-R_4K_DI_20140704_PP_SMPTE-3D_OV"); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_XSN-2-3D_F-133_DE-fr_US-R_MOS_4K_DI_20140704_PP_SMPTE-3D_OV"); /* Test content type modifiers */ @@ -103,7 +125,7 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test) m.mastered_luminance = "4fl"; film->set_isdcf_metadata (m); film->set_video_frame_rate (48); - BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_XSN-2-Temp-Pre-RedBand-MyChain-2D-4fl-48_F-133_DE-fr_US-R_4K_DI_20140704_PP_SMPTE_OV"); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_XSN-2-Temp-Pre-RedBand-MyChain-2D-4fl-48_F-133_DE-fr_US-R_MOS_4K_DI_20140704_PP_SMPTE_OV"); /* Test a name which is already in camelCase */ @@ -117,19 +139,19 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test) film->set_isdcf_metadata (m); film->set_video_frame_rate (24); film->set_name ("IKnowCamels"); - BOOST_CHECK_EQUAL (film->isdcf_name(false), "IKnowCamels_XSN-2_F-133_DE-fr_US-R_4K_DI_20140704_PP_SMPTE_OV"); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "IKnowCamels_XSN-2_F-133_DE-fr_US-R_MOS_4K_DI_20140704_PP_SMPTE_OV"); /* And one in capitals */ film->set_name ("LIKE SHOUTING"); - BOOST_CHECK_EQUAL (film->isdcf_name(false), "LikeShouting_XSN-2_F-133_DE-fr_US-R_4K_DI_20140704_PP_SMPTE_OV"); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "LikeShouting_XSN-2_F-133_DE-fr_US-R_MOS_4K_DI_20140704_PP_SMPTE_OV"); /* Test audio channel markup */ film->set_audio_channels (6); - shared_ptr sound (new FFmpegContent (film, "test/data/sine_440.wav")); + shared_ptr sound (new FFmpegContent("test/data/sine_440.wav")); film->examine_and_add_content (sound); - wait_for_jobs (); + BOOST_REQUIRE (!wait_for_jobs()); BOOST_CHECK_EQUAL (film->isdcf_name(false), "LikeShouting_XSN-2_F-133_DE-fr_US-R_10_4K_DI_20140704_PP_SMPTE_OV"); AudioMapping mapping = sound->audio->mapping ();