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"
25 #include <boost/test/unit_test.hpp>
28 /* Sanity check to make sure that files in a DCP have the right extensions / names.
29 * This is mostly to catch a crazy mistake where Interop subtitle files suddenly got
30 * a MXF extension but no tests caught it (#2270).
32 BOOST_AUTO_TEST_CASE (interop_file_extension_test)
34 auto video = content_factory("test/data/flat_red.png")[0];
35 auto audio = content_factory("test/data/sine_440.wav")[0];
36 auto sub = content_factory("test/data/15s.srt")[0];
37 auto film = new_test_film2("interop_file_extension_test", { video, audio, sub });
38 film->set_interop(true);
42 dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
43 dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
44 dcp::VerificationNote::Code::INVALID_STANDARD
47 BOOST_REQUIRE(dcp_file(film, "ASSETMAP").extension() == "");
48 BOOST_REQUIRE(dcp_file(film, "VOLINDEX").extension() == "");
49 BOOST_REQUIRE(dcp_file(film, "cpl").extension() == ".xml");
50 BOOST_REQUIRE(dcp_file(film, "pkl").extension() == ".xml");
51 BOOST_REQUIRE(dcp_file(film, "j2c").extension() == ".mxf");
52 BOOST_REQUIRE(dcp_file(film, "pcm").extension() == ".mxf");
53 BOOST_REQUIRE(dcp_file(film, "sub").extension() == ".xml");
57 BOOST_AUTO_TEST_CASE (smpte_file_extension_test)
59 auto video = content_factory("test/data/flat_red.png")[0];
60 auto audio = content_factory("test/data/sine_440.wav")[0];
61 auto sub = content_factory("test/data/15s.srt")[0];
62 auto film = new_test_film2("smpte_file_extension_test", { video, audio, sub });
63 film->set_interop(false);
67 dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
68 dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE
71 BOOST_REQUIRE(dcp_file(film, "ASSETMAP").extension() == ".xml");
72 BOOST_REQUIRE(dcp_file(film, "VOLINDEX").extension() == ".xml");
73 BOOST_REQUIRE(dcp_file(film, "cpl").extension() == ".xml");
74 BOOST_REQUIRE(dcp_file(film, "pkl").extension() == ".xml");
75 BOOST_REQUIRE(dcp_file(film, "j2c").extension() == ".mxf");
76 BOOST_REQUIRE(dcp_file(film, "pcm").extension() == ".mxf");
77 BOOST_REQUIRE(dcp_file(film, "sub").extension() == ".mxf");