2 Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
22 /** @file test/markers_test
23 * @brief Test SMPTE markers.
28 #include "lib/content_factory.h"
33 #include <dcp/reel_markers_asset.h>
35 #include <boost/test/unit_test.hpp>
39 using boost::optional;
40 using std::shared_ptr;
43 /** Check that FFOC and LFOC are automatically added if not specified */
44 BOOST_AUTO_TEST_CASE (automatic_ffoc_lfoc_markers_test1)
46 string const name = "automatic_ffoc_lfoc_markers_test1";
47 auto film = new_test_film2 (name);
48 film->examine_and_add_content (content_factory("test/data/flat_red.png").front());
49 BOOST_REQUIRE (!wait_for_jobs());
51 film->set_interop (false);
52 make_and_verify_dcp (film);
54 dcp::DCP dcp (String::compose("build/test/%1/%2", name, film->dcp_name()));
56 BOOST_REQUIRE_EQUAL (dcp.cpls().size(), 1U);
57 auto cpl = dcp.cpls().front();
58 BOOST_REQUIRE_EQUAL (cpl->reels().size(), 1U);
59 auto reel = cpl->reels()[0];
60 auto markers = reel->main_markers();
61 BOOST_REQUIRE (markers);
63 auto ffoc = markers->get (dcp::Marker::FFOC);
65 BOOST_CHECK (*ffoc == dcp::Time(0, 0, 0, 1, 24));
66 auto lfoc = markers->get (dcp::Marker::LFOC);
68 BOOST_CHECK (*lfoc == dcp::Time(0, 0, 9, 23, 24));
72 /** Check that FFOC and LFOC are not overridden if they are specified */
73 BOOST_AUTO_TEST_CASE (automatic_ffoc_lfoc_markers_test2)
75 string const name = "automatic_ffoc_lfoc_markers_test2";
76 auto film = new_test_film2 (name);
77 film->examine_and_add_content (content_factory("test/data/flat_red.png").front());
78 BOOST_REQUIRE (!wait_for_jobs());
80 film->set_interop (false);
81 film->set_marker (dcp::Marker::FFOC, dcpomatic::DCPTime::from_seconds(1));
82 film->set_marker (dcp::Marker::LFOC, dcpomatic::DCPTime::from_seconds(9));
86 dcp::VerificationNote::Code::INCORRECT_FFOC,
87 dcp::VerificationNote::Code::INCORRECT_LFOC
90 dcp::DCP dcp (String::compose("build/test/%1/%2", name, film->dcp_name()));
92 BOOST_REQUIRE_EQUAL (dcp.cpls().size(), 1U);
93 auto cpl = dcp.cpls().front();
94 BOOST_REQUIRE_EQUAL (cpl->reels().size(), 1U);
95 auto reel = cpl->reels()[0];
96 auto markers = reel->main_markers();
97 BOOST_REQUIRE (markers);
99 auto ffoc = markers->get (dcp::Marker::FFOC);
100 BOOST_REQUIRE (ffoc);
101 BOOST_CHECK (*ffoc == dcp::Time (0, 0, 1, 0, 24));
102 auto lfoc = markers->get (dcp::Marker::LFOC);
103 BOOST_REQUIRE (lfoc);
104 BOOST_CHECK (*lfoc == dcp::Time(0, 0, 9, 0, 24));