Move UTC offset for KDMs from the cinema to the point of KDM creation (#2300).
[dcpomatic.git] / test / kdm_naming_test.cc
index f53f4aba2102d1987a324400884c628883ac6aef..73e3d457edb1b0dd2381526bbdf7cd180bf74d26 100644 (file)
@@ -59,16 +59,14 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test)
 
        auto crypt_cert = c->decryption_chain()->leaf();
 
-       /* Cinema A: UTC +4:30 */
-       auto cinema_a = make_shared<Cinema>("Cinema A", list<string>(), "", 4, 30);
+       auto cinema_a = make_shared<Cinema>("Cinema A", list<string>(), "");
        cinema_a_screen_1 = std::make_shared<dcpomatic::Screen>("Screen 1", "", crypt_cert, boost::none, vector<TrustedDevice>());
        cinema_a->add_screen (cinema_a_screen_1);
        cinema_a_screen_2 = std::make_shared<dcpomatic::Screen>("Screen 2", "", crypt_cert, boost::none, vector<TrustedDevice>());
        cinema_a->add_screen (cinema_a_screen_2);
        c->add_cinema (cinema_a);
 
-       /* Cinema B: UTC -1:00 */
-       auto cinema_b = make_shared<Cinema>("Cinema B", list<string>(), "", -1, 0);
+       auto cinema_b = make_shared<Cinema>("Cinema B", list<string>(), "");
        cinema_b_screen_x = std::make_shared<dcpomatic::Screen>("Screen X", "", crypt_cert, boost::none, vector<TrustedDevice>());
        cinema_b->add_screen (cinema_b_screen_x);
        cinema_b_screen_y = std::make_shared<dcpomatic::Screen>("Screen Y", "", crypt_cert, boost::none, vector<TrustedDevice>());
@@ -81,7 +79,7 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test)
        boost::filesystem::remove_all ("build/test/single_kdm_naming_test");
        auto film = new_test_film2 ("single_kdm_naming_test");
        film->set_name ("my_great_film");
-       film->examine_and_add_content (content_factory("test/data/flat_black.png").front());
+       film->examine_and_add_content (content_factory("test/data/flat_black.png")[0]);
        BOOST_REQUIRE (!wait_for_jobs());
        film->set_encrypted (true);
        make_and_verify_dcp (film);
@@ -90,21 +88,20 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test)
 
        auto sign_cert = c->signer_chain()->leaf();
 
-       dcp::LocalTime from (sign_cert.not_before());
+       dcp::LocalTime from = sign_cert.not_before();
+       from.set_offset({ 4, 30 });
        from.add_months (2);
-       dcp::LocalTime until (sign_cert.not_after());
+       dcp::LocalTime until = sign_cert.not_after();
+       until.set_offset({ 4, 30 });
        until.add_months (-2);
 
-       auto const from_string = from.date() + " " + from.time_of_day(true, false);
-       auto const until_string = until.date() + " " + until.time_of_day(true, false);
-
        auto cpl = cpls.front().cpl_file;
        auto kdm = kdm_for_screen (
                        film,
                        cpls.front().cpl_file,
                        cinema_a_screen_1,
-                       boost::posix_time::time_from_string(from_string),
-                       boost::posix_time::time_from_string(until_string),
+                       from,
+                       until,
                        dcp::Formulation::MODIFIED_TRANSITIONAL_1,
                        false,
                        optional<int>()
@@ -136,7 +133,7 @@ BOOST_AUTO_TEST_CASE (directory_kdm_naming_test, * boost::unit_test::depends_on(
        boost::filesystem::remove_all ("build/test/directory_kdm_naming_test");
        auto film = new_test_film2 (
                "directory_kdm_naming_test",
-               { content_factory("test/data/flat_black.png").front() }
+               { content_factory("test/data/flat_black.png")[0] }
                );
 
        film->set_name ("my_great_film");
@@ -152,9 +149,6 @@ BOOST_AUTO_TEST_CASE (directory_kdm_naming_test, * boost::unit_test::depends_on(
        dcp::LocalTime until (sign_cert.not_after());
        until.add_months (-2);
 
-       string const from_string = from.date() + " " + from.time_of_day(true, false);
-       string const until_string = until.date() + " " + until.time_of_day(true, false);
-
        list<shared_ptr<dcpomatic::Screen>> screens = {
                cinema_a_screen_2, cinema_b_screen_x, cinema_a_screen_1, (cinema_b_screen_z)
        };
@@ -168,8 +162,8 @@ BOOST_AUTO_TEST_CASE (directory_kdm_naming_test, * boost::unit_test::depends_on(
                                film,
                                cpls.front().cpl_file,
                                i,
-                               boost::posix_time::time_from_string(from_string),
-                               boost::posix_time::time_from_string(until_string),
+                               from,
+                               until,
                                dcp::Formulation::MODIFIED_TRANSITIONAL_1,
                                false,
                                optional<int>()