2 Copyright (C) 2020 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 boost::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 shared_ptr<Film> 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);
53 BOOST_REQUIRE (!wait_for_jobs());
55 dcp::DCP dcp (String::compose("build/test/%1/%2", name, film->dcp_name()));
57 BOOST_REQUIRE_EQUAL (dcp.cpls().size(), 1U);
58 shared_ptr<dcp::CPL> cpl = dcp.cpls().front();
59 BOOST_REQUIRE_EQUAL (cpl->reels().size(), 1U);
60 shared_ptr<dcp::Reel> reel = cpl->reels().front();
61 shared_ptr<dcp::ReelMarkersAsset> markers = reel->main_markers();
62 BOOST_REQUIRE (markers);
64 optional<dcp::Time> ffoc = markers->get (dcp::Marker::FFOC);
66 BOOST_CHECK (*ffoc == dcp::Time (0, 0, 0, 0, 24));
67 optional<dcp::Time> lfoc = markers->get (dcp::Marker::LFOC);
69 BOOST_CHECK (*lfoc == dcp::Time(0, 0, 9, 23, 24));
73 /** Check that FFOC and LFOC are not overridden if they are specified */
74 BOOST_AUTO_TEST_CASE (automatic_ffoc_lfoc_markers_test2)
76 string const name = "automatic_ffoc_lfoc_markers_test2";
77 shared_ptr<Film> film = new_test_film2 (name);
78 film->examine_and_add_content (content_factory("test/data/flat_red.png").front());
79 BOOST_REQUIRE (!wait_for_jobs());
81 film->set_interop (false);
82 film->set_marker (dcp::Marker::FFOC, dcpomatic::DCPTime::from_seconds(1));
83 film->set_marker (dcp::Marker::LFOC, dcpomatic::DCPTime::from_seconds(9));
85 BOOST_REQUIRE (!wait_for_jobs());
87 dcp::DCP dcp (String::compose("build/test/%1/%2", name, film->dcp_name()));
89 BOOST_REQUIRE_EQUAL (dcp.cpls().size(), 1U);
90 shared_ptr<dcp::CPL> cpl = dcp.cpls().front();
91 BOOST_REQUIRE_EQUAL (cpl->reels().size(), 1U);
92 shared_ptr<dcp::Reel> reel = cpl->reels().front();
93 shared_ptr<dcp::ReelMarkersAsset> markers = reel->main_markers();
94 BOOST_REQUIRE (markers);
96 optional<dcp::Time> ffoc = markers->get (dcp::Marker::FFOC);
98 BOOST_CHECK (*ffoc == dcp::Time (0, 0, 1, 0, 24));
99 optional<dcp::Time> lfoc = markers->get (dcp::Marker::LFOC);
100 BOOST_REQUIRE (lfoc);
101 BOOST_CHECK (*lfoc == dcp::Time(0, 0, 9, 0, 24));