Fill test disk partitions with random noise to expose more bugs.
[dcpomatic.git] / test / silence_padding_test.cc
index d3382f30a3d2401d1fbdc9565ab547530cbd4a3d..e4c640792d675bda09cfe7fd1acbe1b4c91d997f 100644 (file)
@@ -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.
 
 
 */
 
+
 /** @file  test/silence_padding_test.cc
  *  @brief Test the padding (with silence) of a mono source to a 6-channel DCP.
  *  @ingroup feature
  */
 
+
 #include "lib/ffmpeg_content.h"
 #include "lib/film.h"
 #include "lib/dcp_content_type.h"
 #include <dcp/sound_asset_reader.h>
 #include <boost/test/unit_test.hpp>
 
+
 using std::make_shared;
 using std::string;
 using std::shared_ptr;
 using boost::lexical_cast;
 
+
 static void
 test_silence_padding (int channels)
 {
        string const film_name = "silence_padding_test_" + lexical_cast<string> (channels);
-       auto film = new_test_film (film_name);
-       film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
-       film->set_container (Ratio::from_id ("185"));
-       film->set_name (film_name);
-
-       auto content = make_shared<FFmpegContent>("test/data/staircase.wav");
-       film->examine_and_add_content (content);
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto film = new_test_film2 (
+               film_name,
+               {
+                       make_shared<FFmpegContent>("test/data/flat_red.png"),
+                       make_shared<FFmpegContent>("test/data/staircase.wav")
+               });
 
        film->set_audio_channels (channels);
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
 
        boost::filesystem::path path = "build/test";
        path /= film_name;
@@ -123,6 +124,7 @@ test_silence_padding (int channels)
 
 }
 
+
 BOOST_AUTO_TEST_CASE (silence_padding_test)
 {
        for (int i = 1; i < MAX_DCP_AUDIO_CHANNELS; ++i) {
@@ -130,6 +132,7 @@ BOOST_AUTO_TEST_CASE (silence_padding_test)
        }
 }
 
+
 /** Test a situation that used to crash because of a sub-sample rounding confusion
  *  caused by a trim.
  */
@@ -138,16 +141,13 @@ BOOST_AUTO_TEST_CASE (silence_padding_test2)
 {
        Cleanup cl;
 
-       auto film = new_test_film2 ("silence_padding_test2", &cl);
        auto content = make_shared<FFmpegContent>(TestPaths::private_data() / "cars.mov");
-       film->examine_and_add_content (content);
-       BOOST_REQUIRE (!wait_for_jobs());
+       auto film = new_test_film2 ("silence_padding_test2", { content }, &cl);
 
        film->set_video_frame_rate (24);
        content->set_trim_start (dcpomatic::ContentTime(4003));
 
-       film->make_dcp ();
-       BOOST_REQUIRE (!wait_for_jobs());
+       make_and_verify_dcp (film);
 
        cl.run ();
 }