Fix silent stereo mixdown exports when the project audio channel count is > 6.
[dcpomatic.git] / test / file_extension_test.cc
1 /*
2     Copyright (C) 2022 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
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.
10
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.
15
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/>.
18
19 */
20
21
22 #include "lib/content.h"
23 #include "lib/content_factory.h"
24 #include "lib/film.h"
25 #include "lib/text_content.h"
26 #include "test.h"
27 #include <boost/test/unit_test.hpp>
28
29
30 /* Sanity check to make sure that files in a DCP have the right extensions / names.
31  * This is mostly to catch a crazy mistake where Interop subtitle files suddenly got
32  * a MXF extension but no tests caught it (#2270).
33  */
34 BOOST_AUTO_TEST_CASE (interop_file_extension_test)
35 {
36         auto video = content_factory("test/data/flat_red.png")[0];
37         auto audio = content_factory("test/data/sine_440.wav")[0];
38         auto sub = content_factory("test/data/15s.srt")[0];
39         auto film = new_test_film2("interop_file_extension_test", { video, audio, sub });
40         film->set_interop(true);
41         sub->only_text()->set_language(dcp::LanguageTag("de"));
42
43         make_and_verify_dcp(
44                 film, {
45                             dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
46                             dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
47                             dcp::VerificationNote::Code::INVALID_STANDARD
48                         });
49
50         BOOST_REQUIRE(dcp_file(film, "ASSETMAP").extension() == "");
51         BOOST_REQUIRE(dcp_file(film, "VOLINDEX").extension() == "");
52         BOOST_REQUIRE(dcp_file(film, "cpl").extension() == ".xml");
53         BOOST_REQUIRE(dcp_file(film, "pkl").extension() == ".xml");
54         BOOST_REQUIRE(dcp_file(film, "j2c").extension() == ".mxf");
55         BOOST_REQUIRE(dcp_file(film, "pcm").extension() == ".mxf");
56         BOOST_REQUIRE(dcp_file(film, "sub").extension() == ".xml");
57 }
58
59
60 BOOST_AUTO_TEST_CASE (smpte_file_extension_test)
61 {
62         auto video = content_factory("test/data/flat_red.png")[0];
63         auto audio = content_factory("test/data/sine_440.wav")[0];
64         auto sub = content_factory("test/data/15s.srt")[0];
65         auto film = new_test_film2("smpte_file_extension_test", { video, audio, sub });
66         film->set_interop(false);
67
68         make_and_verify_dcp(
69                 film, {
70                             dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
71                             dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE
72                         });
73
74         BOOST_REQUIRE(dcp_file(film, "ASSETMAP").extension() == ".xml");
75         BOOST_REQUIRE(dcp_file(film, "VOLINDEX").extension() == ".xml");
76         BOOST_REQUIRE(dcp_file(film, "cpl").extension() == ".xml");
77         BOOST_REQUIRE(dcp_file(film, "pkl").extension() == ".xml");
78         BOOST_REQUIRE(dcp_file(film, "j2c").extension() == ".mxf");
79         BOOST_REQUIRE(dcp_file(film, "pcm").extension() == ".mxf");
80         BOOST_REQUIRE(dcp_file(film, "sub").extension() == ".mxf");
81 }