2 Copyright (C) 2024 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/>.
23 #include "lib/dcp_content.h"
28 #include <dcp/reel_smpte_subtitle_asset.h>
29 #include <dcp/smpte_subtitle_asset.h>
30 #include <boost/test/unit_test.hpp>
33 using std::make_shared;
37 BOOST_AUTO_TEST_CASE(test_text_entry_point)
39 auto const path = boost::filesystem::path("build/test/test_text_entry_point");
40 boost::filesystem::remove_all(path);
41 boost::filesystem::create_directories(path);
43 /* Make a "bad" DCP with a non-zero text entry point */
44 dcp::DCP bad_dcp(path / "dcp");
45 auto sub = make_shared<dcp::SMPTESubtitleAsset>();
46 sub->write(path / "dcp" / "subs.mxf");
47 auto reel_sub = make_shared<dcp::ReelSMPTESubtitleAsset>(sub, dcp::Fraction{24, 1}, 42, 6);
48 auto reel = make_shared<dcp::Reel>();
51 auto cpl = make_shared<dcp::CPL>("foo", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE);
57 /* Make a film and add the bad DCP, so that the examiner spots the problem */
58 auto dcp_content = make_shared<DCPContent>(path / "dcp");
59 auto film = new_test_film2("test_text_entry_point/film", { dcp_content });
60 film->write_metadata();
62 /* Reload the film to check that the examiner's output is saved and recovered */
63 auto film2 = make_shared<Film>(path / "film");
64 film2->read_metadata();
67 BOOST_CHECK(!dcp_content->can_reference_text(film2, TextType::OPEN_SUBTITLE, why_not));
68 BOOST_CHECK_EQUAL(why_not, "one of its subtitle reels has a non-zero entry point so it must be re-written.");