2 Copyright (C) 2017-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 #include "lib/string_text_file_content.h"
24 #include "lib/ratio.h"
25 #include "lib/text_content.h"
26 #include "lib/dcp_content_type.h"
31 #include <dcp/interop_subtitle_asset.h>
32 #include <dcp/reel_subtitle_asset.h>
33 #include <dcp/raw_convert.h>
34 #include <boost/test/unit_test.hpp>
37 using std::dynamic_pointer_cast;
38 using std::make_shared;
39 using std::shared_ptr;
43 /* Check that ReelNumber is setup correctly when making multi-reel subtitled DCPs */
44 BOOST_AUTO_TEST_CASE (subtitle_reel_number_test)
46 auto film = new_test_film ("subtitle_reel_number_test");
47 film->set_container (Ratio::from_id ("185"));
48 film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
49 film->set_name ("frobozz");
50 auto content = make_shared<StringTextFileContent>("test/data/subrip5.srt");
51 film->examine_and_add_content (content);
52 BOOST_REQUIRE (!wait_for_jobs ());
53 content->only_text()->set_use (true);
54 content->only_text()->set_burn (false);
55 film->set_reel_type (ReelType::BY_LENGTH);
56 film->set_interop (true);
57 film->set_reel_length (1024 * 1024 * 512);
58 make_and_verify_dcp (film, {dcp::VerificationNote::Code::INVALID_STANDARD});
60 dcp::DCP dcp ("build/test/subtitle_reel_number_test/" + film->dcp_name());
62 BOOST_REQUIRE_EQUAL (dcp.cpls().size(), 1U);
63 auto cpl = dcp.cpls()[0];
64 BOOST_REQUIRE_EQUAL (cpl->reels().size(), 6U);
67 for (auto i: cpl->reels()) {
68 if (i->main_subtitle()) {
69 auto ass = dynamic_pointer_cast<dcp::InteropSubtitleAsset>(i->main_subtitle()->asset());
71 BOOST_CHECK_EQUAL (ass->reel_number(), dcp::raw_convert<string>(n));