Hand-apply 6a3cd511559433554ab40ed72ff94b7d8dc2c5bd from master;
[dcpomatic.git] / test / silence_padding_test.cc
index 0e0695c033b0b90af3f9d8ca92c12b5350c20883..25f2d80c94d1c1e7a9446b6476ccde0349a669ef 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 */
 
+/** @file  test/silence_padding_test.cc
+ *  @brief Test the padding (with silence) of a mono source to a 6-channel DCP.
+ */
+
 #include <boost/test/unit_test.hpp>
-#include <libdcp/cpl.h>
-#include <libdcp/dcp.h>
-#include <libdcp/sound_mxf.h>
-#include <libdcp/sound_frame.h>
-#include <libdcp/reel.h>
-#include <libdcp/reel_sound_asset.h>
+#include <dcp/cpl.h>
+#include <dcp/dcp.h>
+#include <dcp/sound_mxf.h>
+#include <dcp/sound_frame.h>
+#include <dcp/reel.h>
+#include <dcp/reel_sound_asset.h>
 #include "lib/sndfile_content.h"
 #include "lib/film.h"
 #include "lib/dcp_content_type.h"
@@ -34,16 +38,17 @@ using std::string;
 using boost::lexical_cast;
 using boost::shared_ptr;
 
-static void test_silence_padding (int channels)
+static void
+test_silence_padding (int channels)
 {
        string const film_name = "silence_padding_test_" + lexical_cast<string> (channels);
        shared_ptr<Film> film = new_test_film (film_name);
-       film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR"));
+       film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
        film->set_container (Ratio::from_id ("185"));
        film->set_name (film_name);
 
        shared_ptr<SndfileContent> content (new SndfileContent (film, "test/data/staircase.wav"));
-       film->examine_and_add_content (content);
+       film->examine_and_add_content (content, true);
        wait_for_jobs ();
 
        film->set_audio_channels (channels);
@@ -58,7 +63,7 @@ static void test_silence_padding (int channels)
 
        shared_ptr<const dcp::ReelSoundAsset> sound_asset = check.cpls().front()->reels().front()->main_sound ();
        BOOST_CHECK (sound_asset);
-       BOOST_CHECK (sound_asset->mxf()->channels () == channels);
+       BOOST_CHECK_EQUAL (sound_asset->mxf()->channels (), channels);
 
        /* Sample index in the DCP */
        int n = 0;
@@ -116,7 +121,7 @@ static void test_silence_padding (int channels)
 
 BOOST_AUTO_TEST_CASE (silence_padding_test)
 {
-       for (int i = 1; i < MAX_AUDIO_CHANNELS; ++i) {
+       for (int i = 1; i < MAX_DCP_AUDIO_CHANNELS; ++i) {
                test_silence_padding (i);
        }
 }