/* Copyright (C) 2025 Carl Hetherington 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. 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 DCP-o-matic. If not, see . */ #include "lib/content_factory.h" #include "lib/copy_dcp_details_to_film.h" #include "lib/dcp_content.h" #include "lib/film.h" #include "test.h" #include #include using std::make_shared; using std::shared_ptr; using std::string; using std::vector; BOOST_AUTO_TEST_CASE(copy_audio_language_to_film) { auto content = content_factory("test/data/sine_440.wav")[0]; auto film1 = new_test_film("copy_audio_language_to_film1", { content }); film1->set_audio_language(dcp::LanguageTag("de-DE")); make_and_verify_dcp( film1, { dcp::VerificationNote::Code::MISSING_CPL_METADATA }); auto dcp = make_shared(film1->dir(film1->dcp_name())); auto film2 = new_test_film("copy_audio_language_to_film2", { dcp }); copy_dcp_settings_to_film(dcp, film2); BOOST_REQUIRE(film2->audio_language()); BOOST_CHECK_EQUAL(film2->audio_language()->as_string(), "de-DE"); } BOOST_AUTO_TEST_CASE(test_copy_dcp_markers_to_film) { auto video = vector>{ content_factory("test/data/flat_red.png")[0], content_factory("test/data/flat_red.png")[0], content_factory("test/data/flat_red.png")[0] }; auto film = new_test_film("test_copy_dcp_markers_to_film", video); film->set_reel_type(ReelType::BY_VIDEO_CONTENT); film->set_marker(dcp::Marker::FFEC, dcpomatic::DCPTime::from_seconds(22)); make_and_verify_dcp(film); auto dcp = make_shared(film->dir(film->dcp_name())); auto film2 = new_test_film("test_copy_dcp_markers_to_film2", { dcp }); copy_dcp_markers_to_film(dcp, film2); BOOST_CHECK(film2->marker(dcp::Marker::FFEC) == dcpomatic::DCPTime::from_seconds(22)); } BOOST_AUTO_TEST_CASE(copy_metadata_to_film) { auto picture = content_factory("test/data/flat_red.png")[0]; auto sound = content_factory("test/data/sine_440.wav")[0]; auto film1 = new_test_film("copy_metadata_to_film", { picture, sound }); film1->set_chain(string{"Carl's Cinemas"}); film1->set_distributor(string{"IPoAC Film Distribution"}); film1->set_facility(string{"Hand-Rolled JPEG2000 Mastering"}); film1->set_luminance(dcp::Luminance(9, dcp::Luminance::Unit::FOOT_LAMBERT)); make_and_verify_dcp( film1, { dcp::VerificationNote::Code::MISSING_CPL_METADATA }); auto dcp = make_shared(film1->dir(film1->dcp_name())); auto film2 = new_test_film("copy_metadata_to_film2", { dcp }); copy_dcp_settings_to_film(dcp, film2); film2->write_metadata(); BOOST_CHECK_EQUAL(film2->chain().get_value_or(""), "Carl's Cinemas"); BOOST_CHECK_EQUAL(film2->distributor().get_value_or(""), "IPoAC Film Distribution"); BOOST_CHECK_EQUAL(film2->facility().get_value_or(""), "Hand-Rolled JPEG2000 Mastering"); BOOST_CHECK(film2->luminance()); BOOST_CHECK(film2->luminance() == dcp::Luminance(9, dcp::Luminance::Unit::FOOT_LAMBERT)); }