2 Copyright (C) 2017 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/>.
21 #include "lib/string_text_file_content.h"
23 #include "lib/ratio.h"
24 #include "lib/text_content.h"
25 #include "lib/dcp_content_type.h"
30 #include <dcp/interop_subtitle_asset.h>
31 #include <dcp/reel_subtitle_asset.h>
32 #include <dcp/raw_convert.h>
33 #include <boost/test/unit_test.hpp>
36 using std::shared_ptr;
37 using std::dynamic_pointer_cast;
39 /* Check that ReelNumber is setup correctly when making multi-reel subtitled DCPs */
40 BOOST_AUTO_TEST_CASE (subtitle_reel_number_test)
42 shared_ptr<Film> film = new_test_film ("subtitle_reel_number_test");
43 film->set_container (Ratio::from_id ("185"));
44 film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
45 film->set_name ("frobozz");
46 shared_ptr<StringTextFileContent> content (new StringTextFileContent("test/data/subrip5.srt"));
47 film->examine_and_add_content (content);
48 BOOST_REQUIRE (!wait_for_jobs ());
49 content->only_text()->set_use (true);
50 content->only_text()->set_burn (false);
51 film->set_reel_type (REELTYPE_BY_LENGTH);
52 film->set_interop (true);
53 film->set_reel_length (1024 * 1024 * 512);
55 BOOST_REQUIRE (!wait_for_jobs ());
57 dcp::DCP dcp ("build/test/subtitle_reel_number_test/" + film->dcp_name());
59 BOOST_REQUIRE_EQUAL (dcp.cpls().size(), 1U);
60 shared_ptr<dcp::CPL> cpl = dcp.cpls().front();
61 BOOST_REQUIRE_EQUAL (cpl->reels().size(), 6U);
64 for (auto i: cpl->reels()) {
65 if (i->main_subtitle()) {
66 shared_ptr<dcp::InteropSubtitleAsset> ass = dynamic_pointer_cast<dcp::InteropSubtitleAsset>(i->main_subtitle()->asset());
68 BOOST_CHECK_EQUAL (ass->reel_number(), dcp::raw_convert<string>(n));