2 Copyright (C) 2020-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 /** @file test/subtitle_language_test.cc
23 * @brief Test that subtitle language information is correctly written to DCPs.
27 #include "lib/content.h"
28 #include "lib/content_factory.h"
30 #include "lib/text_content.h"
32 #include <dcp/language_tag.h>
33 #include <boost/test/unit_test.hpp>
39 using std::shared_ptr;
42 BOOST_AUTO_TEST_CASE (subtitle_language_interop_test)
44 string const name = "subtitle_language_interop_test";
45 auto fr = content_factory("test/data/frames.srt");
46 auto film = new_test_film2 (name, fr);
48 fr[0]->only_text()->set_language (dcp::LanguageTag("fr-FR"));
49 film->set_interop (true);
54 dcp::VerificationNote::Code::INVALID_STANDARD,
55 dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING,
56 dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION
59 check_dcp (String::compose("test/data/%1", name), String::compose("build/test/%1/%2", name, film->dcp_name()));
63 BOOST_AUTO_TEST_CASE (subtitle_language_smpte_test)
65 string const name = "subtitle_language_smpte_test";
66 auto fr = content_factory("test/data/frames.srt");
67 auto film = new_test_film2 (name, fr);
69 fr[0]->only_text()->set_language (dcp::LanguageTag("fr-FR"));
70 film->set_interop (false);
75 dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
76 dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
77 dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION,
78 dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING,
79 dcp::VerificationNote::Code::MISSING_CPL_METADATA
82 check_dcp (String::compose("test/data/%1", name), String::compose("build/test/%1/%2", name, film->dcp_name()));