X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=test%2Fkdm_naming_test.cc;h=f53f4aba2102d1987a324400884c628883ac6aef;hb=6dedc32363c10aa7ce85938ea00613af6c816c3c;hp=f692c165d6edde466efde8dcf97a58ea036c7e82;hpb=689fa55d1529ad88449ca464e9107c4dcc54d1cb;p=dcpomatic.git diff --git a/test/kdm_naming_test.cc b/test/kdm_naming_test.cc index f692c165d..f53f4aba2 100644 --- a/test/kdm_naming_test.cc +++ b/test/kdm_naming_test.cc @@ -57,23 +57,23 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test) { auto c = Config::instance(); - auto cert = c->decryption_chain()->leaf(); + auto crypt_cert = c->decryption_chain()->leaf(); /* Cinema A: UTC +4:30 */ auto cinema_a = make_shared("Cinema A", list(), "", 4, 30); - cinema_a_screen_1 = make_shared("Screen 1", "", cert, vector()); + cinema_a_screen_1 = std::make_shared("Screen 1", "", crypt_cert, boost::none, vector()); cinema_a->add_screen (cinema_a_screen_1); - cinema_a_screen_2 = make_shared("Screen 2", "", cert, vector()); + cinema_a_screen_2 = std::make_shared("Screen 2", "", crypt_cert, boost::none, vector()); cinema_a->add_screen (cinema_a_screen_2); c->add_cinema (cinema_a); /* Cinema B: UTC -1:00 */ auto cinema_b = make_shared("Cinema B", list(), "", -1, 0); - cinema_b_screen_x = make_shared("Screen X", "", cert, vector()); + cinema_b_screen_x = std::make_shared("Screen X", "", crypt_cert, boost::none, vector()); cinema_b->add_screen (cinema_b_screen_x); - cinema_b_screen_y = make_shared("Screen Y", "", cert, vector()); + cinema_b_screen_y = std::make_shared("Screen Y", "", crypt_cert, boost::none, vector()); cinema_b->add_screen (cinema_b_screen_y); - cinema_b_screen_z = make_shared("Screen Z", "", cert, vector()); + cinema_b_screen_z = std::make_shared("Screen Z", "", crypt_cert, boost::none, vector()); cinema_b->add_screen (cinema_b_screen_z); c->add_cinema (cinema_a); @@ -88,9 +88,11 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test) auto cpls = film->cpls (); BOOST_REQUIRE(cpls.size() == 1); - dcp::LocalTime from (cert.not_before()); + auto sign_cert = c->signer_chain()->leaf(); + + dcp::LocalTime from (sign_cert.not_before()); from.add_months (2); - dcp::LocalTime until (cert.not_after()); + dcp::LocalTime until (sign_cert.not_after()); until.add_months (-2); auto const from_string = from.date() + " " + from.time_of_day(true, false); @@ -120,7 +122,8 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test) auto until_time = until.time_of_day (true, false); boost::algorithm::replace_all (until_time, ":", "-"); - auto const ref = String::compose("KDM_Cinema_A_-_Screen_1_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time); + auto const dcp_date = boost::gregorian::to_iso_string(film->isdcf_date()); + auto const ref = String::compose("KDM_Cinema_A_-_Screen_1_-_MyGreatFilm_TST-1_F_XX-XX_MOS_2K_%1_SMPTE_OV_-_%2_%3_-_%4_%5.xml", dcp_date, from.date(), from_time, until.date(), until_time); BOOST_CHECK_MESSAGE (boost::filesystem::exists("build/test/single_kdm_naming_test/" + ref), "File " << ref << " not found"); } @@ -129,8 +132,6 @@ BOOST_AUTO_TEST_CASE (directory_kdm_naming_test, * boost::unit_test::depends_on( { using boost::filesystem::path; - auto cert = Config::instance()->decryption_chain()->leaf(); - /* Film */ boost::filesystem::remove_all ("build/test/directory_kdm_naming_test"); auto film = new_test_film2 ( @@ -144,9 +145,11 @@ BOOST_AUTO_TEST_CASE (directory_kdm_naming_test, * boost::unit_test::depends_on( auto cpls = film->cpls (); BOOST_REQUIRE(cpls.size() == 1); - dcp::LocalTime from (cert.not_before()); + auto sign_cert = Config::instance()->signer_chain()->leaf(); + + dcp::LocalTime from (sign_cert.not_before()); from.add_months (2); - dcp::LocalTime until (cert.not_after()); + dcp::LocalTime until (sign_cert.not_after()); until.add_months (-2); string const from_string = from.date() + " " + from.time_of_day(true, false); @@ -180,8 +183,8 @@ BOOST_AUTO_TEST_CASE (directory_kdm_naming_test, * boost::unit_test::depends_on( path("build/test/directory_kdm_naming_test"), dcp::NameFormat("%c - %s - %f - %b - %e"), #ifdef DCPOMATIC_WINDOWS - /* With %i in the format the path is too long for Windows */ - dcp::NameFormat("KDM %c - %s - %f - %b - %e"), + /* Use a shorter name on Windows so that the paths aren't too long */ + dcp::NameFormat("KDM %f"), #else dcp::NameFormat("KDM %c - %s - %f - %b - %e - %i"), #endif @@ -193,38 +196,42 @@ BOOST_AUTO_TEST_CASE (directory_kdm_naming_test, * boost::unit_test::depends_on( auto until_time = until.time_of_day (true, false); boost::algorithm::replace_all (until_time, ":", "-"); + auto const dcp_date = boost::gregorian::to_iso_string(film->isdcf_date()); + auto const dcp_name = String::compose("MyGreatFilm_TST-1_F_XX-XX_MOS_2K_%1_SMPTE_OV", dcp_date); + auto const common = String::compose("%1_-_%2_%3_-_%4_%5", dcp_name, from.date(), from_time, until.date(), until_time); + path const base = "build/test/directory_kdm_naming_test"; - path dir_a = String::compose("Cinema_A_-_%s_-_my_great_film_-_%1_%2_-_%3_%4", from.date(), from_time, until.date(), until_time); + path dir_a = String::compose("Cinema_A_-_%s_-_%1", common); BOOST_CHECK_MESSAGE (boost::filesystem::exists(base / dir_a), "Directory " << dir_a << " not found"); - path dir_b = String::compose("Cinema_B_-_%s_-_my_great_film_-_%1_%2_-_%3_%4", from.date(), from_time, until.date(), until_time); + path dir_b = String::compose("Cinema_B_-_%s_-_%1", common); BOOST_CHECK_MESSAGE (boost::filesystem::exists(base / dir_b), "Directory " << dir_b << " not found"); #ifdef DCPOMATIC_WINDOWS - path ref = String::compose("KDM_Cinema_A_-_Screen_2_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time); + path ref = String::compose("KDM_%1.xml", dcp_name); #else - path ref = String::compose("KDM_Cinema_A_-_Screen_2_-_my_great_film_-_%1_%2_-_%3_%4_-_%5.xml", from.date(), from_time, until.date(), until_time, cpl_id); + path ref = String::compose("KDM_Cinema_A_-_Screen_2_-_%1_-_%2.xml", common, cpl_id); #endif BOOST_CHECK_MESSAGE (boost::filesystem::exists(base / dir_a / ref), "File " << ref << " not found"); #ifdef DCPOMATIC_WINDOWS - ref = String::compose("KDM_Cinema_B_-_Screen_X_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time); + ref = String::compose("KDM_%1.xml", dcp_name); #else - ref = String::compose("KDM_Cinema_B_-_Screen_X_-_my_great_film_-_%1_%2_-_%3_%4_-_%5.xml", from.date(), from_time, until.date(), until_time, cpl_id); + ref = String::compose("KDM_Cinema_B_-_Screen_X_-_%1_-_%2.xml", common, cpl_id); #endif BOOST_CHECK_MESSAGE (boost::filesystem::exists(base / dir_b / ref), "File " << ref << " not found"); #ifdef DCPOMATIC_WINDOWS - ref = String::compose("KDM_Cinema_A_-_Screen_1_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time); + ref = String::compose("KDM_%1.xml", dcp_name); #else - ref = String::compose("KDM_Cinema_A_-_Screen_1_-_my_great_film_-_%1_%2_-_%3_%4_-_%5.xml", from.date(), from_time, until.date(), until_time, cpl_id); + ref = String::compose("KDM_Cinema_A_-_Screen_1_-_%1_-_%2.xml", common, cpl_id); #endif BOOST_CHECK_MESSAGE (boost::filesystem::exists(base / dir_a / ref), "File " << ref << " not found"); #ifdef DCPOMATIC_WINDOWS - ref = String::compose("KDM_Cinema_B_-_Screen_Z_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time); + ref = String::compose("KDM_%1.xml", dcp_name); #else - ref = String::compose("KDM_Cinema_B_-_Screen_Z_-_my_great_film_-_%1_%2_-_%3_%4_-_%5.xml", from.date(), from_time, until.date(), until_time, cpl_id); + ref = String::compose("KDM_Cinema_B_-_Screen_Z_-_%1_-_%2.xml", common, cpl_id); #endif BOOST_CHECK_MESSAGE (boost::filesystem::exists(base / dir_b / ref), "File " << ref << " not found"); }