Fix silent stereo mixdown exports when the project audio channel count is > 6.
[dcpomatic.git] / test / unzipper_test.cc
1 /*
2     Copyright (C) 2024 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 /** @file  test/unzipper_test.cc
23  *  @brief Test Unzipper class.
24  *  @ingroup selfcontained
25  */
26
27
28 #include "lib/exceptions.h"
29 #include "lib/unzipper.h"
30 #include "lib/zipper.h"
31 #include "test.h"
32 #include <dcp/filesystem.h>
33 #include <dcp/util.h>
34 #include <boost/test/unit_test.hpp>
35 #include <boost/filesystem.hpp>
36
37
38 using std::string;
39
40
41 /** Basic test of Unzipper working normally */
42 BOOST_AUTO_TEST_CASE(unzipper_test1)
43 {
44         boost::system::error_code ec;
45         boost::filesystem::remove("build/test/zipped.zip", ec);
46
47         Zipper zipper("build/test/zipped.zip");
48         zipper.add("foo.txt", "1234567890");
49         zipper.add("bar.txt", "xxxxxxCCCCbbbbbbb1");
50         zipper.add("its_bigger_than_that_chris_its_large.txt", string(128 * 1024, 'X'));
51         zipper.close();
52
53         Unzipper unzipper("build/test/zipped.zip");
54         BOOST_CHECK_EQUAL(unzipper.get("foo.txt"), "1234567890");
55         BOOST_CHECK_EQUAL(unzipper.get("bar.txt"), "xxxxxxCCCCbbbbbbb1");
56         BOOST_CHECK_THROW(unzipper.get("hatstand"), std::runtime_error);
57         BOOST_CHECK_THROW(unzipper.get("its_bigger_than_that_chris_its_large.txt"), std::runtime_error);
58 }
59