2 Copyright (C) 2022 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/content_factory.h"
23 #include "lib/dcp_content.h"
26 #include "lib/text_content.h"
28 #include <boost/test/unit_test.hpp>
31 using std::make_shared;
34 BOOST_AUTO_TEST_CASE(full_dcp_subtitle_font_id_test)
36 auto dcp = make_shared<DCPContent>(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV");
37 auto film = new_test_film2("full_dcp_subtitle_font_id_test", { dcp });
39 auto content = film->content();
40 BOOST_REQUIRE_EQUAL(content.size(), 1U);
41 auto text = content[0]->only_text();
44 BOOST_REQUIRE_EQUAL(text->fonts().size(), 1U);
45 auto font = text->fonts().front();
46 BOOST_CHECK_EQUAL(font->id(), "0_theFontId");
47 BOOST_REQUIRE(font->data());
48 BOOST_CHECK_EQUAL(font->data()->size(), 367112);
52 BOOST_AUTO_TEST_CASE(dcp_subtitle_font_id_test)
54 auto subs = content_factory(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV" / "8b48f6ae-c74b-4b80-b994-a8236bbbad74_sub.mxf");
55 auto film = new_test_film2("dcp_subtitle_font_id_test", subs);
57 auto content = film->content();
58 BOOST_REQUIRE_EQUAL(content.size(), 1U);
59 auto text = content[0]->only_text();
62 BOOST_REQUIRE_EQUAL(text->fonts().size(), 1U);
63 auto font = text->fonts().front();
64 BOOST_CHECK_EQUAL(font->id(), "theFontId");
65 BOOST_REQUIRE(font->data());
66 BOOST_CHECK_EQUAL(font->data()->size(), 367112);
70 BOOST_AUTO_TEST_CASE(make_dcp_with_subs_from_interop_dcp)
72 auto dcp = make_shared<DCPContent>("test/data/Iopsubs_FTR-1_F_XX-XX_MOS_2K_20220710_IOP_OV");
73 auto film = new_test_film2("make_dcp_with_subs_from_interop_dcp", { dcp });
74 dcp->text.front()->set_use(true);
78 dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
79 dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME
85 BOOST_AUTO_TEST_CASE(make_dcp_with_subs_from_smpte_dcp)
87 auto dcp = make_shared<DCPContent>(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV");
88 auto film = new_test_film2("make_dcp_with_subs_from_smpte_dcp", { dcp });
89 dcp->text.front()->set_use(true);
90 make_and_verify_dcp(film);
94 BOOST_AUTO_TEST_CASE(make_dcp_with_subs_from_mkv)
96 auto subs = content_factory(TestPaths::private_data() / "clapperboard_with_subs.mkv");
97 auto film = new_test_film2("make_dcp_with_subs_from_mkv", subs);
98 subs[0]->text.front()->set_use(true);
99 subs[0]->text.front()->set_language(dcp::LanguageTag("en-US"));
100 make_and_verify_dcp(film, { dcp::VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_2K });