summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-05-03 11:17:34 +0200
committerCarl Hetherington <cth@carlh.net>2021-05-03 20:18:04 +0200
commit689fa55d1529ad88449ca464e9107c4dcc54d1cb (patch)
treeedd1264941263f2fa25a98d61f98c87876c5b667 /test
parent0aabe4060ea4bad7c7caac633aef0737fccff8c2 (diff)
C++11 tidying.
Diffstat (limited to 'test')
-rw-r--r--test/audio_mapping_test.cc16
-rw-r--r--test/cinema_sound_processor_test.cc8
-rw-r--r--test/colour_conversion_test.cc30
-rw-r--r--test/dcp_playback_test.cc38
-rw-r--r--test/file_group_test.cc75
-rw-r--r--test/file_log_test.cc10
-rw-r--r--test/image_filename_sorter_test.cc49
-rw-r--r--test/image_proxy_test.cc19
-rw-r--r--test/interrupt_encoder_test.cc23
-rw-r--r--test/kdm_naming_test.cc45
-rw-r--r--test/no_use_video_test.cc2
-rw-r--r--test/reel_writer_test.cc58
-rw-r--r--test/resampler_test.cc16
-rw-r--r--test/socket_test.cc13
-rw-r--r--test/subtitle_charset_test.cc24
-rw-r--r--test/subtitle_language_test.cc2
-rw-r--r--test/upmixer_a_test.cc31
17 files changed, 260 insertions, 199 deletions
diff --git a/test/audio_mapping_test.cc b/test/audio_mapping_test.cc
index 0acc922b6..1e56df387 100644
--- a/test/audio_mapping_test.cc
+++ b/test/audio_mapping_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,19 +18,23 @@
*/
+
/** @file test/audio_mapping_test.cc
* @brief Test AudioMapping class.
* @ingroup selfcontained
*/
+
#include <boost/test/unit_test.hpp>
#include "lib/audio_mapping.h"
#include "lib/util.h"
+
using std::list;
using std::string;
using boost::optional;
+
BOOST_AUTO_TEST_CASE (audio_mapping_test)
{
AudioMapping none;
@@ -43,11 +47,11 @@ BOOST_AUTO_TEST_CASE (audio_mapping_test)
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < MAX_DCP_AUDIO_CHANNELS; ++j) {
- BOOST_CHECK_EQUAL (four.get (i, j), (i == 0 && j == 1) ? 1 : 0);
+ BOOST_CHECK_EQUAL (four.get(i, j), (i == 0 && j == 1) ? 1 : 0);
}
}
- list<int> mapped = four.mapped_output_channels ();
+ auto mapped = four.mapped_output_channels ();
BOOST_CHECK_EQUAL (mapped.size(), 1U);
BOOST_CHECK_EQUAL (mapped.front(), 1);
@@ -60,17 +64,19 @@ BOOST_AUTO_TEST_CASE (audio_mapping_test)
}
}
+
static void
-guess_check (string filename, int output_channel)
+guess_check (boost::filesystem::path filename, int output_channel)
{
AudioMapping m (1, 8);
- m.make_default (0, optional<boost::filesystem::path>(filename));
+ m.make_default (0, filename);
for (int i = 0; i < 8; ++i) {
BOOST_TEST_INFO (filename);
BOOST_CHECK_CLOSE (m.get(0, i), i == output_channel ? 1 : 0, 0.01);
}
}
+
BOOST_AUTO_TEST_CASE (audio_mapping_guess_test)
{
guess_check ("stuff_L_nonsense.wav", 0);
diff --git a/test/cinema_sound_processor_test.cc b/test/cinema_sound_processor_test.cc
index b17fd19f9..b53917641 100644
--- a/test/cinema_sound_processor_test.cc
+++ b/test/cinema_sound_processor_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2019-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,11 +18,13 @@
*/
+
+#include "lib/datasat_ap2x.h"
#include "lib/dolby_cp750.h"
#include "lib/usl.h"
-#include "lib/datasat_ap2x.h"
#include <boost/test/unit_test.hpp>
+
BOOST_AUTO_TEST_CASE (dolby_cp750_test)
{
DolbyCP750 ap;
@@ -43,6 +45,7 @@ BOOST_AUTO_TEST_CASE (dolby_cp750_test)
BOOST_CHECK_CLOSE (ap.db_for_fader_change(6, 3), -(20 + 6.66666666666666666), 0.1);
}
+
BOOST_AUTO_TEST_CASE (usl_test)
{
USL ap;
@@ -63,6 +66,7 @@ BOOST_AUTO_TEST_CASE (usl_test)
BOOST_CHECK_CLOSE (ap.db_for_fader_change(6, 3), -(2.5 * 10 + 0.5 * 3.333333333333333333), 0.1);
}
+
BOOST_AUTO_TEST_CASE (datasat_ap2x_test)
{
DatasatAP2x ap;
diff --git a/test/colour_conversion_test.cc b/test/colour_conversion_test.cc
index 28545b3f0..c48a0b63a 100644
--- a/test/colour_conversion_test.cc
+++ b/test/colour_conversion_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,11 +18,13 @@
*/
+
/** @file test/colour_conversion_test.cc
* @brief Test ColourConversion class.
* @ingroup selfcontained
*/
+
#include "lib/colour_conversion.h"
#include "lib/film.h"
#include <dcp/gamma_transfer_function.h>
@@ -30,23 +32,27 @@
#include <boost/test/unit_test.hpp>
#include <iostream>
+
using std::cout;
+using std::make_shared;
using std::shared_ptr;
+
BOOST_AUTO_TEST_CASE (colour_conversion_test1)
{
- ColourConversion A (dcp::ColourConversion::srgb_to_xyz ());
- ColourConversion B (dcp::ColourConversion::rec709_to_xyz ());
+ ColourConversion A (dcp::ColourConversion::srgb_to_xyz());
+ ColourConversion B (dcp::ColourConversion::rec709_to_xyz());
BOOST_CHECK_EQUAL (A.identifier(), "9840c601d2775bf1b3847254bbaa36a9");
BOOST_CHECK_EQUAL (B.identifier(), "58151ac92fdf333663a62c9a8ba5c5f4");
}
+
BOOST_AUTO_TEST_CASE (colour_conversion_test2)
{
ColourConversion A (dcp::ColourConversion::srgb_to_xyz ());
xmlpp::Document doc;
- xmlpp::Element* root = doc.create_root_node ("Test");
+ auto root = doc.create_root_node ("Test");
A.as_xml (root);
BOOST_CHECK_EQUAL (
doc.write_to_string_formatted ("UTF-8"),
@@ -73,11 +79,12 @@ BOOST_AUTO_TEST_CASE (colour_conversion_test2)
);
}
+
BOOST_AUTO_TEST_CASE (colour_conversion_test3)
{
- ColourConversion A (dcp::ColourConversion::rec709_to_xyz ());
+ ColourConversion A (dcp::ColourConversion::rec709_to_xyz());
xmlpp::Document doc;
- xmlpp::Element* root = doc.create_root_node ("Test");
+ auto root = doc.create_root_node ("Test");
A.as_xml (root);
BOOST_CHECK_EQUAL (
doc.write_to_string_formatted ("UTF-8"),
@@ -101,15 +108,16 @@ BOOST_AUTO_TEST_CASE (colour_conversion_test3)
);
}
+
/** Test a round trip via the XML representation */
BOOST_AUTO_TEST_CASE (colour_conversion_test4)
{
- for (auto const& i: PresetColourConversion::all ()) {
+ for (auto const& i: PresetColourConversion::all()) {
xmlpp::Document out;
- xmlpp::Element* out_root = out.create_root_node ("Test");
+ auto out_root = out.create_root_node("Test");
i.conversion.as_xml (out_root);
- shared_ptr<cxml::Document> in (new cxml::Document ("Test"));
- in->read_string (out.write_to_string ("UTF-8"));
- BOOST_CHECK (ColourConversion::from_xml (in, Film::current_state_version).get () == i.conversion);
+ auto in = make_shared<cxml::Document> ("Test");
+ in->read_string (out.write_to_string("UTF-8"));
+ BOOST_CHECK (ColourConversion::from_xml(in, Film::current_state_version).get() == i.conversion);
}
}
diff --git a/test/dcp_playback_test.cc b/test/dcp_playback_test.cc
index 1e587e93e..ef1b623e7 100644
--- a/test/dcp_playback_test.cc
+++ b/test/dcp_playback_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,13 +18,16 @@
*/
-#include "lib/film.h"
+
#include "lib/butler.h"
-#include "lib/player.h"
#include "lib/dcp_content.h"
+#include "lib/film.h"
+#include "lib/player.h"
#include "test.h"
#include <boost/test/unit_test.hpp>
+
+using std::make_shared;
using std::pair;
using std::shared_ptr;
using boost::optional;
@@ -33,28 +36,29 @@ using namespace boost::placeholders;
#endif
using namespace dcpomatic;
+
/** Simulate the work that the player does, for profiling */
BOOST_AUTO_TEST_CASE (dcp_playback_test)
{
- shared_ptr<Film> film = new_test_film ("dcp_playback_test");
- shared_ptr<DCPContent> content (new DCPContent(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV"));
+ auto film = new_test_film ("dcp_playback_test");
+ auto content = make_shared<DCPContent>(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV");
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs());
- shared_ptr<Butler> butler (
- new Butler(
- film,
- shared_ptr<Player>(new Player(film)),
- AudioMapping(6, 6),
- 6,
- bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24),
- VideoRange::FULL,
- false,
- true)
+ auto butler = std::make_shared<Butler>(
+ film,
+ shared_ptr<Player>(new Player(film)),
+ AudioMapping(6, 6),
+ 6,
+ bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24),
+ VideoRange::FULL,
+ false,
+ true
);
- float* audio_buffer = new float[2000*6];
+
+ auto audio_buffer = new float[2000 * 6];
while (true) {
- pair<shared_ptr<PlayerVideo>, DCPTime> p = butler->get_video (true, 0);
+ auto p = butler->get_video (true, 0);
if (!p.first) {
break;
}
diff --git a/test/file_group_test.cc b/test/file_group_test.cc
index 1d42741b6..f974a3725 100644
--- a/test/file_group_test.cc
+++ b/test/file_group_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,19 +18,23 @@
*/
+
/** @file test/file_group_test.cc
* @brief Test FileGroup class.
* @ingroup selfcontained
*/
-#include <stdint.h>
-#include <cstdio>
+
+#include "lib/file_group.h"
#include <boost/test/unit_test.hpp>
#include <boost/filesystem.hpp>
-#include "lib/file_group.h"
+#include <stdint.h>
+#include <cstdio>
+
using std::vector;
+
BOOST_AUTO_TEST_CASE (file_group_test)
{
/* Random data; must be big enough for all the files */
@@ -53,16 +57,17 @@ BOOST_AUTO_TEST_CASE (file_group_test)
total_length += length[i];
}
- vector<boost::filesystem::path> name;
boost::filesystem::create_directories ("build/test/file_group_test");
- name.push_back ("build/test/file_group_test/A");
- name.push_back ("build/test/file_group_test/B");
- name.push_back ("build/test/file_group_test/C");
- name.push_back ("build/test/file_group_test/D");
+ vector<boost::filesystem::path> name = {
+ "build/test/file_group_test/A",
+ "build/test/file_group_test/B",
+ "build/test/file_group_test/C",
+ "build/test/file_group_test/D"
+ };
int base = 0;
for (int i = 0; i < num_files; ++i) {
- FILE* f = fopen (name[i].string().c_str(), "wb");
+ auto f = fopen (name[i].string().c_str(), "wb");
fwrite (data + base, 1, length[i], f);
fclose (f);
base += length[i];
@@ -74,51 +79,51 @@ BOOST_AUTO_TEST_CASE (file_group_test)
int pos = 0;
/* Basic read from 0 */
- BOOST_CHECK_EQUAL (fg.read (test, 64), 64);
- BOOST_CHECK_EQUAL (memcmp (data, test, 64), 0);
+ BOOST_CHECK_EQUAL (fg.read(test, 64), 64);
+ BOOST_CHECK_EQUAL (memcmp(data, test, 64), 0);
pos += 64;
/* Another read following the previous */
- BOOST_CHECK_EQUAL (fg.read (test, 4), 4);
- BOOST_CHECK_EQUAL (memcmp (data + pos, test, 4), 0);
+ BOOST_CHECK_EQUAL (fg.read(test, 4), 4);
+ BOOST_CHECK_EQUAL (memcmp(data + pos, test, 4), 0);
pos += 4;
/* Read overlapping A and B */
- BOOST_CHECK_EQUAL (fg.read (test, 128), 128);
- BOOST_CHECK_EQUAL (memcmp (data + pos, test, 128), 0);
+ BOOST_CHECK_EQUAL (fg.read(test, 128), 128);
+ BOOST_CHECK_EQUAL (memcmp(data + pos, test, 128), 0);
pos += 128;
/* Read overlapping B/C/D and over-reading by a lot */
- BOOST_CHECK_EQUAL (fg.read (test, total_length * 3), total_length - pos);
- BOOST_CHECK_EQUAL (memcmp (data + pos, test, total_length - pos), 0);
+ BOOST_CHECK_EQUAL (fg.read(test, total_length * 3), total_length - pos);
+ BOOST_CHECK_EQUAL (memcmp(data + pos, test, total_length - pos), 0);
/* Over-read by a little */
- BOOST_CHECK_EQUAL (fg.seek (0, SEEK_SET), 0);
- BOOST_CHECK_EQUAL (fg.read (test, total_length), total_length);
- BOOST_CHECK_EQUAL (fg.read (test, 1), 0);
+ BOOST_CHECK_EQUAL (fg.seek(0, SEEK_SET), 0);
+ BOOST_CHECK_EQUAL (fg.read(test, total_length), total_length);
+ BOOST_CHECK_EQUAL (fg.read(test, 1), 0);
/* Seeking off the end of the file should not give an error */
- BOOST_CHECK_EQUAL (fg.seek (total_length * 2, SEEK_SET), total_length * 2);
+ BOOST_CHECK_EQUAL (fg.seek(total_length * 2, SEEK_SET), total_length * 2);
/* and attempting to read should return nothing */
- BOOST_CHECK_EQUAL (fg.read (test, 64), 0);
+ BOOST_CHECK_EQUAL (fg.read(test, 64), 0);
/* but the requested seek should be remembered, so if we now go back (relatively) */
- BOOST_CHECK_EQUAL (fg.seek (-total_length * 2, SEEK_CUR), 0);
+ BOOST_CHECK_EQUAL (fg.seek(-total_length * 2, SEEK_CUR), 0);
/* we should be at the start again */
- BOOST_CHECK_EQUAL (fg.read (test, 64), 64);
- BOOST_CHECK_EQUAL (memcmp (data, test, 64), 0);
+ BOOST_CHECK_EQUAL (fg.read(test, 64), 64);
+ BOOST_CHECK_EQUAL (memcmp(data, test, 64), 0);
/* SEEK_SET */
- BOOST_CHECK_EQUAL (fg.seek (999, SEEK_SET), 999);
- BOOST_CHECK_EQUAL (fg.read (test, 64), 64);
- BOOST_CHECK_EQUAL (memcmp (data + 999, test, 64), 0);
+ BOOST_CHECK_EQUAL (fg.seek(999, SEEK_SET), 999);
+ BOOST_CHECK_EQUAL (fg.read(test, 64), 64);
+ BOOST_CHECK_EQUAL (memcmp(data + 999, test, 64), 0);
/* SEEK_CUR */
- BOOST_CHECK_EQUAL (fg.seek (42, SEEK_CUR), 999 + 64 + 42);
- BOOST_CHECK_EQUAL (fg.read (test, 64), 64);
- BOOST_CHECK_EQUAL (memcmp (data + 999 + 64 + 42, test, 64), 0);
+ BOOST_CHECK_EQUAL (fg.seek(42, SEEK_CUR), 999 + 64 + 42);
+ BOOST_CHECK_EQUAL (fg.read(test, 64), 64);
+ BOOST_CHECK_EQUAL (memcmp(data + 999 + 64 + 42, test, 64), 0);
/* SEEK_END */
- BOOST_CHECK_EQUAL (fg.seek (1077, SEEK_END), total_length - 1077);
- BOOST_CHECK_EQUAL (fg.read (test, 256), 256);
- BOOST_CHECK_EQUAL (memcmp (data + total_length - 1077, test, 256), 0);
+ BOOST_CHECK_EQUAL (fg.seek(1077, SEEK_END), total_length - 1077);
+ BOOST_CHECK_EQUAL (fg.read(test, 256), 256);
+ BOOST_CHECK_EQUAL (memcmp(data + total_length - 1077, test, 256), 0);
}
diff --git a/test/file_log_test.cc b/test/file_log_test.cc
index e0eeba010..dca1d4386 100644
--- a/test/file_log_test.cc
+++ b/test/file_log_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,20 +18,20 @@
*/
+
/** @file test/file_log_test.cc
* @brief Test FileLog.
* @ingroup selfcontained
*/
+
#include "lib/file_log.h"
#include <boost/test/unit_test.hpp>
-#include <iostream>
-using std::cout;
BOOST_AUTO_TEST_CASE (file_log_test)
{
FileLog log ("test/data/short.log");
- BOOST_CHECK_EQUAL (log.head_and_tail (1024), "This is a short log.\nWith only two lines.\n");
- BOOST_CHECK_EQUAL (log.head_and_tail (8), "This is \n .\n .\n .\no lines.\n");
+ BOOST_CHECK_EQUAL (log.head_and_tail(1024), "This is a short log.\nWith only two lines.\n");
+ BOOST_CHECK_EQUAL (log.head_and_tail(8), "This is \n .\n .\n .\no lines.\n");
}
diff --git a/test/image_filename_sorter_test.cc b/test/image_filename_sorter_test.cc
index 7512fdffb..eb662a120 100644
--- a/test/image_filename_sorter_test.cc
+++ b/test/image_filename_sorter_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2015-2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,45 +18,50 @@
*/
+
/** @file test/image_filename_sorter_test.cc
* @brief Test ImageFilenameSorter
* @ingroup selfcontained
*/
+
#include "lib/image_filename_sorter.h"
#include "lib/compose.hpp"
#include <boost/test/unit_test.hpp>
+
using std::random_shuffle;
using std::sort;
using std::vector;
+
BOOST_AUTO_TEST_CASE (image_filename_sorter_test1)
{
ImageFilenameSorter x;
- BOOST_CHECK (x ("abc0000000001", "abc0000000002"));
- BOOST_CHECK (x ("1", "2"));
- BOOST_CHECK (x ("1", "0002"));
- BOOST_CHECK (x ("0001", "2"));
- BOOST_CHECK (x ("1", "999"));
- BOOST_CHECK (x ("00057.tif", "00166.tif"));
- BOOST_CHECK (x ("/my/numeric999/path/00057.tif", "/my/numeric999/path/00166.tif"));
- BOOST_CHECK (x ("1_01.tif", "1_02.tif"));
- BOOST_CHECK (x ("EWS_DCP_092815_000000.j2c", "EWS_DCP_092815_000001.j2c"));
- BOOST_CHECK (x ("ap_trlr_178_uhd_bt1886_txt_e5c1_033115.86352.dpx", "ap_trlr_178_uhd_bt1886_txt_e5c1_033115.86353.dpx"));
-
- BOOST_CHECK (!x ("abc0000000002", "abc0000000001"));
- BOOST_CHECK (!x ("2", "1"));
- BOOST_CHECK (!x ("0002", "1"));
- BOOST_CHECK (!x ("2", "0001"));
- BOOST_CHECK (!x ("999", "1"));
- BOOST_CHECK (!x ("/my/numeric999/path/00166.tif", "/my/numeric999/path/00057.tif"));
- BOOST_CHECK (!x ("1_02.tif", "1_01.tif"));
- BOOST_CHECK (!x ("EWS_DCP_092815_000000.j2c", "EWS_DCP_092815_000000.j2c"));
- BOOST_CHECK (!x ("EWS_DCP_092815_000100.j2c", "EWS_DCP_092815_000000.j2c"));
- BOOST_CHECK (!x ("ap_trlr_178_uhd_bt1886_txt_e5c1_033115.86353.dpx", "ap_trlr_178_uhd_bt1886_txt_e5c1_033115.86352.dpx"));
+ BOOST_CHECK (x("abc0000000001", "abc0000000002"));
+ BOOST_CHECK (x("1", "2"));
+ BOOST_CHECK (x("1", "0002"));
+ BOOST_CHECK (x("0001", "2"));
+ BOOST_CHECK (x("1", "999"));
+ BOOST_CHECK (x("00057.tif", "00166.tif"));
+ BOOST_CHECK (x("/my/numeric999/path/00057.tif", "/my/numeric999/path/00166.tif"));
+ BOOST_CHECK (x("1_01.tif", "1_02.tif"));
+ BOOST_CHECK (x("EWS_DCP_092815_000000.j2c", "EWS_DCP_092815_000001.j2c"));
+ BOOST_CHECK (x("ap_trlr_178_uhd_bt1886_txt_e5c1_033115.86352.dpx", "ap_trlr_178_uhd_bt1886_txt_e5c1_033115.86353.dpx"));
+
+ BOOST_CHECK (!x("abc0000000002", "abc0000000001"));
+ BOOST_CHECK (!x("2", "1"));
+ BOOST_CHECK (!x("0002", "1"));
+ BOOST_CHECK (!x("2", "0001"));
+ BOOST_CHECK (!x("999", "1"));
+ BOOST_CHECK (!x("/my/numeric999/path/00166.tif", "/my/numeric999/path/00057.tif"));
+ BOOST_CHECK (!x("1_02.tif", "1_01.tif"));
+ BOOST_CHECK (!x("EWS_DCP_092815_000000.j2c", "EWS_DCP_092815_000000.j2c"));
+ BOOST_CHECK (!x("EWS_DCP_092815_000100.j2c", "EWS_DCP_092815_000000.j2c"));
+ BOOST_CHECK (!x("ap_trlr_178_uhd_bt1886_txt_e5c1_033115.86353.dpx", "ap_trlr_178_uhd_bt1886_txt_e5c1_033115.86352.dpx"));
}
+
/** Test a sort of a lot of paths. Mostly useful for profiling. */
BOOST_AUTO_TEST_CASE (image_filename_sorter_test2)
{
diff --git a/test/image_proxy_test.cc b/test/image_proxy_test.cc
index 750b77561..a9872b958 100644
--- a/test/image_proxy_test.cc
+++ b/test/image_proxy_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -25,6 +25,7 @@
#include <boost/test/unit_test.hpp>
+using std::make_shared;
using std::shared_ptr;
@@ -37,14 +38,14 @@ BOOST_AUTO_TEST_CASE (j2k_image_proxy_same_test)
/* The files don't matter here, we just need some data to compare */
{
- shared_ptr<J2KImageProxy> proxy1(new J2KImageProxy(data_file0, dcp::Size(1998, 1080), AV_PIX_FMT_RGB48));
- shared_ptr<J2KImageProxy> proxy2(new J2KImageProxy(data_file0, dcp::Size(1998, 1080), AV_PIX_FMT_RGB48));
+ auto proxy1 = make_shared<J2KImageProxy>(data_file0, dcp::Size(1998, 1080), AV_PIX_FMT_RGB48);
+ auto proxy2 = make_shared<J2KImageProxy>(data_file0, dcp::Size(1998, 1080), AV_PIX_FMT_RGB48);
BOOST_CHECK (proxy1->same(proxy2));
}
{
- shared_ptr<J2KImageProxy> proxy1(new J2KImageProxy(data_file0, dcp::Size(1998, 1080), AV_PIX_FMT_RGB48));
- shared_ptr<J2KImageProxy> proxy2(new J2KImageProxy(data_file1, dcp::Size(1998, 1080), AV_PIX_FMT_RGB48));
+ auto proxy1 = make_shared<J2KImageProxy>(data_file0, dcp::Size(1998, 1080), AV_PIX_FMT_RGB48);
+ auto proxy2 = make_shared<J2KImageProxy>(data_file1, dcp::Size(1998, 1080), AV_PIX_FMT_RGB48);
BOOST_CHECK (!proxy1->same(proxy2));
}
}
@@ -53,14 +54,14 @@ BOOST_AUTO_TEST_CASE (j2k_image_proxy_same_test)
BOOST_AUTO_TEST_CASE (ffmpeg_image_proxy_same_test)
{
{
- shared_ptr<FFmpegImageProxy> proxy1(new FFmpegImageProxy(data_file0, VideoRange::FULL));
- shared_ptr<FFmpegImageProxy> proxy2(new FFmpegImageProxy(data_file0, VideoRange::FULL));
+ auto proxy1 = make_shared<FFmpegImageProxy>(data_file0, VideoRange::FULL);
+ auto proxy2 = make_shared<FFmpegImageProxy>(data_file0, VideoRange::FULL);
BOOST_CHECK (proxy1->same(proxy2));
}
{
- shared_ptr<FFmpegImageProxy> proxy1(new FFmpegImageProxy(data_file0, VideoRange::FULL));
- shared_ptr<FFmpegImageProxy> proxy2(new FFmpegImageProxy(data_file1, VideoRange::FULL));
+ auto proxy1 = make_shared<FFmpegImageProxy>(data_file0, VideoRange::FULL);
+ auto proxy2 = make_shared<FFmpegImageProxy>(data_file1, VideoRange::FULL);
BOOST_CHECK (!proxy1->same(proxy2));
}
}
diff --git a/test/interrupt_encoder_test.cc b/test/interrupt_encoder_test.cc
index e146d2916..bc90dab42 100644
--- a/test/interrupt_encoder_test.cc
+++ b/test/interrupt_encoder_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,34 +18,39 @@
*/
+
/** @file test/interrupt_encoder_test.cc
* @brief Test clean shutdown of threads if a DCP encode is interrupted.
* @ingroup feature
*/
-#include "lib/film.h"
+
+#include "lib/audio_content.h"
+#include "lib/cross.h"
#include "lib/dcp_content_type.h"
-#include "lib/ratio.h"
#include "lib/ffmpeg_content.h"
-#include "lib/audio_content.h"
+#include "lib/film.h"
#include "lib/job_manager.h"
-#include "lib/cross.h"
+#include "lib/ratio.h"
#include "test.h"
#include <boost/test/unit_test.hpp>
+
+using std::make_shared;
using std::shared_ptr;
+
/** Interrupt a DCP encode when it is in progress, as this used to (still does?)
* sometimes give an error related to pthreads.
*/
BOOST_AUTO_TEST_CASE (interrupt_encoder_test)
{
- shared_ptr<Film> film = new_test_film ("interrupt_encoder_test");
- film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
- film->set_container (Ratio::from_id ("185"));
+ auto film = new_test_film ("interrupt_encoder_test");
+ film->set_dcp_content_type (DCPContentType::from_isdcf_name("FTR"));
+ film->set_container (Ratio::from_id("185"));
film->set_name ("interrupt_encoder_test");
- shared_ptr<FFmpegContent> content (new FFmpegContent(TestPaths::private_data() / "prophet_long_clip.mkv"));
+ auto content = make_shared<FFmpegContent>(TestPaths::private_data() / "prophet_long_clip.mkv");
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs());
diff --git a/test/kdm_naming_test.cc b/test/kdm_naming_test.cc
index c58de3471..f692c165d 100644
--- a/test/kdm_naming_test.cc
+++ b/test/kdm_naming_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,22 +18,25 @@
*/
+
#include "lib/cinema.h"
-#include "lib/screen.h"
#include "lib/config.h"
#include "lib/content_factory.h"
#include "lib/film.h"
#include "lib/kdm_with_metadata.h"
+#include "lib/screen.h"
#include "test.h"
#include <boost/test/unit_test.hpp>
+using std::dynamic_pointer_cast;
using std::list;
+using std::make_shared;
+using std::shared_ptr;
using std::string;
using std::vector;
-using std::shared_ptr;
using boost::optional;
-using std::dynamic_pointer_cast;
+
static
bool
@@ -42,39 +45,41 @@ confirm_overwrite (boost::filesystem::path)
return true;
}
+
static shared_ptr<dcpomatic::Screen> cinema_a_screen_1;
static shared_ptr<dcpomatic::Screen> cinema_a_screen_2;
static shared_ptr<dcpomatic::Screen> cinema_b_screen_x;
static shared_ptr<dcpomatic::Screen> cinema_b_screen_y;
static shared_ptr<dcpomatic::Screen> cinema_b_screen_z;
+
BOOST_AUTO_TEST_CASE (single_kdm_naming_test)
{
- Config* c = Config::instance();
+ auto c = Config::instance();
- dcp::Certificate cert = c->decryption_chain()->leaf();
+ auto cert = c->decryption_chain()->leaf();
/* Cinema A: UTC +4:30 */
- shared_ptr<Cinema> cinema_a (new Cinema("Cinema A", list<string>(), "", 4, 30));
- cinema_a_screen_1.reset(new dcpomatic::Screen("Screen 1", "", cert, vector<TrustedDevice>()));
+ auto cinema_a = make_shared<Cinema>("Cinema A", list<string>(), "", 4, 30);
+ cinema_a_screen_1 = make_shared<dcpomatic::Screen>("Screen 1", "", cert, vector<TrustedDevice>());
cinema_a->add_screen (cinema_a_screen_1);
- cinema_a_screen_2.reset(new dcpomatic::Screen("Screen 2", "", cert, vector<TrustedDevice>()));
+ cinema_a_screen_2 = make_shared<dcpomatic::Screen>("Screen 2", "", cert, vector<TrustedDevice>());
cinema_a->add_screen (cinema_a_screen_2);
c->add_cinema (cinema_a);
/* Cinema B: UTC -1:00 */
- shared_ptr<Cinema> cinema_b (new Cinema("Cinema B", list<string>(), "", -1, 0));
- cinema_b_screen_x.reset(new dcpomatic::Screen("Screen X", "", cert, vector<TrustedDevice>()));
+ auto cinema_b = make_shared<Cinema>("Cinema B", list<string>(), "", -1, 0);
+ cinema_b_screen_x = make_shared<dcpomatic::Screen>("Screen X", "", cert, vector<TrustedDevice>());
cinema_b->add_screen (cinema_b_screen_x);
- cinema_b_screen_y.reset(new dcpomatic::Screen("Screen Y", "", cert, vector<TrustedDevice>()));
+ cinema_b_screen_y = make_shared<dcpomatic::Screen>("Screen Y", "", cert, vector<TrustedDevice>());
cinema_b->add_screen (cinema_b_screen_y);
- cinema_b_screen_z.reset(new dcpomatic::Screen("Screen Z", "", cert, vector<TrustedDevice>()));
+ cinema_b_screen_z = make_shared<dcpomatic::Screen>("Screen Z", "", cert, vector<TrustedDevice>());
cinema_b->add_screen (cinema_b_screen_z);
c->add_cinema (cinema_a);
/* Film */
boost::filesystem::remove_all ("build/test/single_kdm_naming_test");
- shared_ptr<Film> film = new_test_film2 ("single_kdm_naming_test");
+ auto film = new_test_film2 ("single_kdm_naming_test");
film->set_name ("my_great_film");
film->examine_and_add_content (content_factory("test/data/flat_black.png").front());
BOOST_REQUIRE (!wait_for_jobs());
@@ -88,8 +93,8 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test)
dcp::LocalTime until (cert.not_after());
until.add_months (-2);
- string const from_string = from.date() + " " + from.time_of_day(true, false);
- string const until_string = until.date() + " " + until.time_of_day(true, false);
+ auto const from_string = from.date() + " " + from.time_of_day(true, false);
+ auto const until_string = until.date() + " " + until.time_of_day(true, false);
auto cpl = cpls.front().cpl_file;
auto kdm = kdm_for_screen (
@@ -110,12 +115,12 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test)
&confirm_overwrite
);
- string from_time = from.time_of_day (true, false);
+ auto from_time = from.time_of_day (true, false);
boost::algorithm::replace_all (from_time, ":", "-");
- string until_time = until.time_of_day (true, false);
+ auto until_time = until.time_of_day (true, false);
boost::algorithm::replace_all (until_time, ":", "-");
- string const ref = String::compose("KDM_Cinema_A_-_Screen_1_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time);
+ auto const ref = String::compose("KDM_Cinema_A_-_Screen_1_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time);
BOOST_CHECK_MESSAGE (boost::filesystem::exists("build/test/single_kdm_naming_test/" + ref), "File " << ref << " not found");
}
@@ -124,7 +129,7 @@ BOOST_AUTO_TEST_CASE (directory_kdm_naming_test, * boost::unit_test::depends_on(
{
using boost::filesystem::path;
- dcp::Certificate cert = Config::instance()->decryption_chain()->leaf();
+ auto cert = Config::instance()->decryption_chain()->leaf();
/* Film */
boost::filesystem::remove_all ("build/test/directory_kdm_naming_test");
diff --git a/test/no_use_video_test.cc b/test/no_use_video_test.cc
index 3c21675c7..2cc914f84 100644
--- a/test/no_use_video_test.cc
+++ b/test/no_use_video_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
diff --git a/test/reel_writer_test.cc b/test/reel_writer_test.cc
index 6fa571500..18a327563 100644
--- a/test/reel_writer_test.cc
+++ b/test/reel_writer_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2019-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,17 +18,19 @@
*/
+
/** @file test/reel_writer_test.cc
* @brief Test ReelWriter class.
* @ingroup selfcontained
*/
-#include "lib/reel_writer.h"
-#include "lib/film.h"
-#include "lib/cross.h"
-#include "lib/content_factory.h"
-#include "lib/content.h"
+
#include "lib/audio_content.h"
+#include "lib/content.h"
+#include "lib/content_factory.h"
+#include "lib/cross.h"
+#include "lib/film.h"
+#include "lib/reel_writer.h"
#include "lib/video_content.h"
#include "test.h"
#include <dcp/dcp.h>
@@ -38,16 +40,19 @@
#include <dcp/reel_sound_asset.h>
#include <boost/test/unit_test.hpp>
-using std::string;
+
using std::shared_ptr;
+using std::string;
using boost::optional;
+
static bool equal (dcp::FrameInfo a, ReelWriter const & writer, shared_ptr<InfoFileHandle> file, Frame frame, Eyes eyes)
{
- dcp::FrameInfo b = writer.read_frame_info(file, frame, eyes);
+ auto b = writer.read_frame_info(file, frame, eyes);
return a.offset == b.offset && a.size == b.size && a.hash == b.hash;
}
+
BOOST_AUTO_TEST_CASE (write_frame_info_test)
{
auto film = new_test_film2 ("write_frame_info_test");
@@ -97,30 +102,27 @@ BOOST_AUTO_TEST_CASE (write_frame_info_test)
}
}
+
/** Check that the reel writer correctly re-uses a video asset changed if we remake
* a DCP with no video changes.
*/
BOOST_AUTO_TEST_CASE (reel_reuse_video_test)
{
/* Make a DCP */
- auto film = new_test_film2 ("reel_reuse_video_test");
auto video = content_factory("test/data/flat_red.png").front();
- film->examine_and_add_content (video);
- BOOST_REQUIRE (!wait_for_jobs());
auto audio = content_factory("test/data/white.wav").front();
- film->examine_and_add_content (audio);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto film = new_test_film2 ("reel_reuse_video_test", { video, audio });
make_and_verify_dcp (film);
/* Find main picture and sound asset IDs */
dcp::DCP dcp1 (film->dir(film->dcp_name()));
dcp1.read ();
BOOST_REQUIRE_EQUAL (dcp1.cpls().size(), 1U);
- BOOST_REQUIRE_EQUAL (dcp1.cpls().front()->reels().size(), 1U);
- BOOST_REQUIRE (dcp1.cpls().front()->reels().front()->main_picture());
- BOOST_REQUIRE (dcp1.cpls().front()->reels().front()->main_sound());
- string const picture_id = dcp1.cpls().front()->reels().front()->main_picture()->asset()->id();
- string const sound_id = dcp1.cpls().front()->reels().front()->main_sound()->asset()->id();
+ BOOST_REQUIRE_EQUAL (dcp1.cpls()[0]->reels().size(), 1U);
+ BOOST_REQUIRE (dcp1.cpls()[0]->reels()[0]->main_picture());
+ BOOST_REQUIRE (dcp1.cpls()[0]->reels()[0]->main_sound());
+ auto const picture_id = dcp1.cpls()[0]->reels()[0]->main_picture()->asset()->id();
+ auto const sound_id = dcp1.cpls()[0]->reels()[0]->main_sound()->asset()->id();
/* Change the audio and re-make */
audio->audio->set_gain (-3);
@@ -130,11 +132,11 @@ BOOST_AUTO_TEST_CASE (reel_reuse_video_test)
dcp::DCP dcp2 (film->dir(film->dcp_name()));
dcp2.read ();
BOOST_REQUIRE_EQUAL (dcp2.cpls().size(), 1U);
- BOOST_REQUIRE_EQUAL (dcp2.cpls().front()->reels().size(), 1U);
- BOOST_REQUIRE (dcp2.cpls().front()->reels().front()->main_picture());
- BOOST_REQUIRE (dcp2.cpls().front()->reels().front()->main_sound());
- BOOST_CHECK_EQUAL (picture_id, dcp2.cpls().front()->reels().front()->main_picture()->asset()->id());
- BOOST_CHECK (sound_id != dcp2.cpls().front()->reels().front()->main_sound()->asset()->id());
+ BOOST_REQUIRE_EQUAL (dcp2.cpls()[0]->reels().size(), 1U);
+ BOOST_REQUIRE (dcp2.cpls()[0]->reels()[0]->main_picture());
+ BOOST_REQUIRE (dcp2.cpls()[0]->reels()[0]->main_sound());
+ BOOST_CHECK_EQUAL (picture_id, dcp2.cpls()[0]->reels()[0]->main_picture()->asset()->id());
+ BOOST_CHECK (sound_id != dcp2.cpls()[0]->reels().front()->main_sound()->asset()->id());
/* Crop video and re-make */
video->video->set_left_crop (5);
@@ -144,9 +146,9 @@ BOOST_AUTO_TEST_CASE (reel_reuse_video_test)
dcp::DCP dcp3 (film->dir(film->dcp_name()));
dcp3.read ();
BOOST_REQUIRE_EQUAL (dcp3.cpls().size(), 1U);
- BOOST_REQUIRE_EQUAL (dcp3.cpls().front()->reels().size(), 1U);
- BOOST_REQUIRE (dcp3.cpls().front()->reels().front()->main_picture());
- BOOST_REQUIRE (dcp3.cpls().front()->reels().front()->main_sound());
- BOOST_CHECK (picture_id != dcp3.cpls().front()->reels().front()->main_picture()->asset()->id());
- BOOST_CHECK (sound_id != dcp3.cpls().front()->reels().front()->main_sound()->asset()->id());
+ BOOST_REQUIRE_EQUAL (dcp3.cpls()[0]->reels().size(), 1U);
+ BOOST_REQUIRE (dcp3.cpls()[0]->reels()[0]->main_picture());
+ BOOST_REQUIRE (dcp3.cpls()[0]->reels()[0]->main_sound());
+ BOOST_CHECK (picture_id != dcp3.cpls()[0]->reels()[0]->main_picture()->asset()->id());
+ BOOST_CHECK (sound_id != dcp3.cpls()[0]->reels().front()->main_sound()->asset()->id());
}
diff --git a/test/resampler_test.cc b/test/resampler_test.cc
index 2978d27f9..8009cc9f9 100644
--- a/test/resampler_test.cc
+++ b/test/resampler_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,21 +18,26 @@
*/
+
/** @file test/resampler_test.cc
* @brief Check that the timings that come back from Resampler correspond
* to the number of samples it generates.
* @ingroup selfcontained
*/
-#include <boost/test/unit_test.hpp>
+
#include "lib/audio_buffers.h"
#include "lib/resampler.h"
+#include <boost/test/unit_test.hpp>
#include <iostream>
-using std::pair;
+
using std::cout;
+using std::make_shared;
+using std::pair;
using std::shared_ptr;
+
static void
resampler_test_one (int from, int to)
{
@@ -43,12 +48,13 @@ resampler_test_one (int from, int to)
/* XXX: no longer checks anything */
for (int64_t i = 0; i < N; i += 1000) {
- shared_ptr<AudioBuffers> a (new AudioBuffers (1, 1000));
+ auto a = make_shared<AudioBuffers> (1, 1000);
a->make_silent ();
- pair<shared_ptr<const AudioBuffers>, Frame> r = resamp.run (a, 0);
+ auto r = resamp.run (a, 0);
}
}
+
BOOST_AUTO_TEST_CASE (resampler_test)
{
resampler_test_one (44100, 48000);
diff --git a/test/socket_test.cc b/test/socket_test.cc
index b9aaba9d2..64c154808 100644
--- a/test/socket_test.cc
+++ b/test/socket_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,17 +18,19 @@
*/
-#include "lib/server.h"
+
#include "lib/dcpomatic_socket.h"
+#include "lib/server.h"
#include <dcp/raw_convert.h>
-#include <boost/thread.hpp>
#include <boost/test/unit_test.hpp>
+#include <boost/thread.hpp>
#include <cstring>
#include <iostream>
-using std::string;
+using std::make_shared;
using std::shared_ptr;
+using std::string;
using boost::bind;
@@ -115,6 +117,7 @@ send (shared_ptr<Socket> socket, char const* message)
socket->write (reinterpret_cast<uint8_t const *>(message), strlen(message) + 1);
}
+
/** Basic test to see if Socket can send and receive data */
BOOST_AUTO_TEST_CASE (socket_basic_test)
{
@@ -128,7 +131,7 @@ BOOST_AUTO_TEST_CASE (socket_basic_test)
tcp::resolver::query query ("127.0.0.1", dcp::raw_convert<string>(TEST_SERVER_PORT));
tcp::resolver::iterator endpoint_iterator = resolver.resolve (query);
- shared_ptr<Socket> socket (new Socket);
+ auto socket = make_shared<Socket>();
socket->connect (*endpoint_iterator);
send (socket, "Hello world!");
diff --git a/test/subtitle_charset_test.cc b/test/subtitle_charset_test.cc
index ada358a63..8233bf023 100644
--- a/test/subtitle_charset_test.cc
+++ b/test/subtitle_charset_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,34 +18,34 @@
*/
-#include "test.h"
+
#include "lib/content.h"
-#include "lib/film.h"
#include "lib/content_factory.h"
+#include "lib/film.h"
#include "lib/string_text_file.h"
#include "lib/string_text_file_content.h"
+#include "test.h"
#include <boost/test/unit_test.hpp>
+
using std::shared_ptr;
using std::dynamic_pointer_cast;
+
/** Test parsing of UTF16 CR/LF input */
BOOST_AUTO_TEST_CASE (subtitle_charset_test1)
{
- shared_ptr<Film> film = new_test_film2 ("subtitle_charset_test1");
- shared_ptr<Content> content = content_factory (TestPaths::private_data() / "PADDINGTON soustitresVFdef.srt").front();
- film->examine_and_add_content (content);
- BOOST_REQUIRE (!wait_for_jobs ());
+ auto content = content_factory (TestPaths::private_data() / "PADDINGTON soustitresVFdef.srt").front();
+ auto film = new_test_film2 ("subtitle_charset_test1", { content });
}
+
/** Test parsing of OSX input */
BOOST_AUTO_TEST_CASE (subtitle_charset_test2)
{
- shared_ptr<Film> film = new_test_film2 ("subtitle_charset_test2");
- shared_ptr<Content> content = content_factory ("test/data/osx.srt").front();
- film->examine_and_add_content (content);
- BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<StringTextFileContent> ts = dynamic_pointer_cast<StringTextFileContent> (content);
+ auto content = content_factory ("test/data/osx.srt").front();
+ auto film = new_test_film2 ("subtitle_charset_test2", { content });
+ auto ts = dynamic_pointer_cast<StringTextFileContent> (content);
BOOST_REQUIRE (ts);
/* Make sure we got the subtitle data from the file */
BOOST_REQUIRE_EQUAL (content->full_length(film).get(), 6052032);
diff --git a/test/subtitle_language_test.cc b/test/subtitle_language_test.cc
index af5dee001..e198b78f9 100644
--- a/test/subtitle_language_test.cc
+++ b/test/subtitle_language_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
diff --git a/test/upmixer_a_test.cc b/test/upmixer_a_test.cc
index 35224ff23..0dc496275 100644
--- a/test/upmixer_a_test.cc
+++ b/test/upmixer_a_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,28 +18,33 @@
*/
+
/** @file test/upmixer_a_test.cc
* @brief Check the Upmixer A against some reference sound files.
* @ingroup selfcontained
*/
-#include <boost/test/unit_test.hpp>
-#include <sndfile.h>
-#include "lib/film.h"
-#include "lib/ratio.h"
+
+#include "lib/audio_buffers.h"
#include "lib/dcp_content_type.h"
#include "lib/ffmpeg_content.h"
+#include "lib/film.h"
#include "lib/player.h"
-#include "lib/audio_buffers.h"
+#include "lib/ratio.h"
#include "lib/upmixer_a.h"
#include "test.h"
+#include <sndfile.h>
+#include <boost/test/unit_test.hpp>
+
+using std::make_shared;
using std::shared_ptr;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
#endif
using namespace dcpomatic;
+
static SNDFILE* L;
static SNDFILE* R;
static SNDFILE* C;
@@ -47,6 +52,7 @@ static SNDFILE* Lfe;
static SNDFILE* Ls;
static SNDFILE* Rs;
+
static void
write (shared_ptr<AudioBuffers> b, DCPTime)
{
@@ -59,14 +65,15 @@ write (shared_ptr<AudioBuffers> b, DCPTime)
}
+
BOOST_AUTO_TEST_CASE (upmixer_a_test)
{
- shared_ptr<Film> film = new_test_film ("upmixer_a_test");
- film->set_container (Ratio::from_id ("185"));
- film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
+ auto film = new_test_film ("upmixer_a_test");
+ film->set_container (Ratio::from_id("185"));
+ film->set_dcp_content_type (DCPContentType::from_isdcf_name("TLR"));
film->set_name ("frobozz");
- film->set_audio_processor (AudioProcessor::from_id ("stereo-5.1-upmix-a"));
- shared_ptr<FFmpegContent> content (new FFmpegContent ("test/data/white.wav"));
+ film->set_audio_processor (AudioProcessor::from_id("stereo-5.1-upmix-a"));
+ auto content = make_shared<FFmpegContent>("test/data/white.wav");
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs());
@@ -82,7 +89,7 @@ BOOST_AUTO_TEST_CASE (upmixer_a_test)
Ls = sf_open ("build/test/upmixer_a_test/Ls.wav", SFM_WRITE, &info);
Rs = sf_open ("build/test/upmixer_a_test/Rs.wav", SFM_WRITE, &info);
- shared_ptr<Player> player (new Player(film));
+ auto player = make_shared<Player>(film);
player->Audio.connect (bind (&write, _1, _2));
while (!player->pass()) {}