--- /dev/null
+DCP-o-matic unit tests
+----------------------
+
+They can be grouped roughly into the following:
+
+* Self-contained tests of single classes / method sets
+
+AudioAnalysis: audio_analysis_test
+AudioMapping: audio_mapping_test
+ColourConversion: colour_conversion_test
+FileGroup: file_group_test
+Image: image_test, pixel_formats_test, make_black_test
+Job/JobManager: job_test
+SubRip: subrip_test
+Ratio: ratio_test
+Resampler: resampler_test
+util.cc: util_test
+
+* "Complete" builds of DCPs with various characteristics, aiming
+to test broad areas of code
+
+4k_test
+threed_test
+
+* Tests of fairly specific areas
+
+audio_delay_test
+black_fill_test
+client_server_test
+film_metadata_test
+frame_rate_test
+player_silence_padding_test
+recover_test
+repeat_frame_test
+scaling_test
+silence_padding_test
+skip_frame_test
+
+ - FFmpeg decoding
+
+ ffmpeg_audio_test
+ ffmpeg_dcp_test
+ ffmpeg_decoder_seek_test
+ ffmpeg_decoder_sequential_test
+ ffmpeg_examiner_test
+ ffmpeg_pts_offset_test
+ seek_zero_test.cc
+ stream_test
/*
- 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
/*
- 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/ffmpeg_decoder_seek_test.cc
+ * @brief Check that get_video() returns the frame indexes that we ask for
+ * for FFmpegDecoder.
+ *
+ * This doesn't check that the contents of those frames are right, which
+ * it probably should.
+ */
+
#include <vector>
#include <boost/test/unit_test.hpp>
#include <boost/filesystem.hpp>
*/
+/** @file test/ffmpeg_decoder_sequential_test.cc
+ * @brief Check that the FFmpeg decoder produces sequential frames without gaps or dropped frames;
+ * (dropped frames being checked by assert() in VideoDecoder). Also that the decoder picks up frame rates correctly.
+ */
+
#include <boost/test/unit_test.hpp>
#include <boost/filesystem.hpp>
#include "lib/ffmpeg_content.h"
BOOST_CHECK_EQUAL (decoder.test_gaps, 0);
}
-/** Check that the FFmpeg decoder produces sequential frames without gaps or dropped frames;
- * (dropped frames being checked by assert() in VideoDecoder). Also that the decoder picks up frame rates correctly.
- */
BOOST_AUTO_TEST_CASE (ffmpeg_decoder_sequential_test)
{
- //test ("boon_telly.mkv", 29.97, 0);
- //test ("Sintel_Trailer1.480p.DivX_Plus_HD.mkv", 24, 0);
+ test ("boon_telly.mkv", 29.97, 0);
+ test ("Sintel_Trailer1.480p.DivX_Plus_HD.mkv", 24, 0);
test ("prophet_clip.mkv", 23.976, 12);
}
*/
+/** @file test/ffmpeg_examiner_test.cc
+ * @brief Check that the FFmpegExaminer can extract the first video and audio time
+ * correctly from data/count300bd24.m2ts.
+ */
+
#include <boost/test/unit_test.hpp>
#include "lib/ffmpeg_examiner.h"
#include "lib/ffmpeg_content.h"
+++ /dev/null
-/*
- Copyright (C) 2013 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
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <boost/test/unit_test.hpp>
-#include "lib/film.h"
-#include "lib/ffmpeg_decoder.h"
-#include "lib/ffmpeg_content.h"
-#include "test.h"
-
-using boost::shared_ptr;
-
-BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test)
-{
- shared_ptr<Film> film = new_test_film ("ffmpeg_pts_offset_test");
- shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/test.mp4"));
- content->_audio_stream.reset (new FFmpegAudioStream);
- content->_video_frame_rate = 24;
-
- {
- /* Sound == video so no offset required */
- content->_first_video = ContentTime ();
- content->_audio_stream->first_audio = ContentTime ();
- FFmpegDecoder decoder (content, film->log());
- BOOST_CHECK_EQUAL (decoder._pts_offset, ContentTime ());
- }
-
- {
- /* Common offset should be removed */
- content->_first_video = ContentTime::from_seconds (600);
- content->_audio_stream->first_audio = ContentTime::from_seconds (600);
- FFmpegDecoder decoder (content, film->log());
- BOOST_CHECK_EQUAL (decoder._pts_offset, ContentTime::from_seconds (-600));
- }
-
- {
- /* Video is on a frame boundary */
- content->_first_video = ContentTime::from_frames (1, 24);
- content->_audio_stream->first_audio = ContentTime ();
- FFmpegDecoder decoder (content, film->log());
- BOOST_CHECK_EQUAL (decoder._pts_offset, ContentTime ());
- }
-
- {
- /* Video is off a frame boundary */
- double const frame = 1.0 / 24.0;
- content->_first_video = ContentTime::from_seconds (frame + 0.0215);
- content->_audio_stream->first_audio = ContentTime ();
- FFmpegDecoder decoder (content, film->log());
- BOOST_CHECK_CLOSE (decoder._pts_offset.seconds(), (frame - 0.0215), 0.00001);
- }
-
- {
- /* Video is off a frame boundary and both have a common offset */
- double const frame = 1.0 / 24.0;
- content->_first_video = ContentTime::from_seconds (frame + 0.0215 + 4.1);
- content->_audio_stream->first_audio = ContentTime::from_seconds (4.1);
- FFmpegDecoder decoder (content, film->log());
- BOOST_CHECK_EQUAL (decoder._pts_offset.seconds(), (frame - 0.0215) - 4.1);
- }
-}
--- /dev/null
+/*
+ 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+/** @file test/ffmpeg_pts_offset_test.cc
+ * @brief Check the computation of _pts_offset in FFmpegDecoder.
+ */
+
+#include <boost/test/unit_test.hpp>
+#include "lib/film.h"
+#include "lib/ffmpeg_decoder.h"
+#include "lib/ffmpeg_content.h"
+#include "test.h"
+
+using boost::shared_ptr;
+
+BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test)
+{
+ shared_ptr<Film> film = new_test_film ("ffmpeg_pts_offset_test");
+ shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/test.mp4"));
+ content->_audio_stream.reset (new FFmpegAudioStream);
+ content->_video_frame_rate = 24;
+
+ {
+ /* Sound == video so no offset required */
+ content->_first_video = ContentTime ();
+ content->_audio_stream->first_audio = ContentTime ();
+ FFmpegDecoder decoder (content, film->log());
+ BOOST_CHECK_EQUAL (decoder._pts_offset, ContentTime ());
+ }
+
+ {
+ /* Common offset should be removed */
+ content->_first_video = ContentTime::from_seconds (600);
+ content->_audio_stream->first_audio = ContentTime::from_seconds (600);
+ FFmpegDecoder decoder (content, film->log());
+ BOOST_CHECK_EQUAL (decoder._pts_offset, ContentTime::from_seconds (-600));
+ }
+
+ {
+ /* Video is on a frame boundary */
+ content->_first_video = ContentTime::from_frames (1, 24);
+ content->_audio_stream->first_audio = ContentTime ();
+ FFmpegDecoder decoder (content, film->log());
+ BOOST_CHECK_EQUAL (decoder._pts_offset, ContentTime ());
+ }
+
+ {
+ /* Video is off a frame boundary */
+ double const frame = 1.0 / 24.0;
+ content->_first_video = ContentTime::from_seconds (frame + 0.0215);
+ content->_audio_stream->first_audio = ContentTime ();
+ FFmpegDecoder decoder (content, film->log());
+ BOOST_CHECK_CLOSE (decoder._pts_offset.seconds(), (frame - 0.0215), 0.00001);
+ }
+
+ {
+ /* Video is off a frame boundary and both have a common offset */
+ double const frame = 1.0 / 24.0;
+ content->_first_video = ContentTime::from_seconds (frame + 0.0215 + 4.1);
+ content->_audio_stream->first_audio = ContentTime::from_seconds (4.1);
+ FFmpegDecoder decoder (content, film->log());
+ BOOST_CHECK_EQUAL (decoder._pts_offset.seconds(), (frame - 0.0215) - 4.1);
+ }
+}
/*
- 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/file_group_test.cc
+ * @brief Check that FileGroup works.
+ */
+
#include <stdint.h>
#include <cstdio>
#include <boost/test/unit_test.hpp>
/*
- 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/film_metadata_test.cc
+ * @brief Test some basic reading/writing of film metadata.
+ */
+
#include <sstream>
#include <boost/test/unit_test.hpp>
#include <boost/filesystem.hpp>
BOOST_AUTO_TEST_CASE (film_metadata_test)
{
- string const test_film = "build/test/film_metadata_test";
-
- if (boost::filesystem::exists (test_film)) {
- boost::filesystem::remove_all (test_film);
- }
+ shared_ptr<Film> f = new_test_film ("film_metadata_test");
+ boost::filesystem::path dir = test_film_dir ("film_metadata_test");
- shared_ptr<Film> f (new Film (test_film));
f->_dci_date = boost::gregorian::from_undelimited_string ("20130211");
BOOST_CHECK (f->container() == 0);
BOOST_CHECK (f->dcp_content_type() == 0);
list<string> ignore;
ignore.push_back ("Key");
- check_xml ("test/data/metadata.xml.ref", test_film + "/metadata.xml", ignore);
+ check_xml ("test/data/metadata.xml.ref", dir.string() + "/metadata.xml", ignore);
- shared_ptr<Film> g (new Film (test_film));
+ shared_ptr<Film> g (new Film (dir));
g->read_metadata ();
BOOST_CHECK_EQUAL (g->name(), "fred");
BOOST_CHECK_EQUAL (g->container(), Ratio::from_id ("185"));
g->write_metadata ();
- check_xml ("test/data/metadata.xml.ref", test_film + "/metadata.xml", ignore);
+ check_xml ("test/data/metadata.xml.ref", dir.string() + "/metadata.xml", ignore);
}
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-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/frame_rate_test.cc
+ * @brief Tests for FrameRateChange and the computation of the best
+ * frame rate for the DCP.
+ */
+
#include <boost/test/unit_test.hpp>
#include "lib/film.h"
#include "lib/config.h"
using boost::shared_ptr;
-/* Test Playlist::best_dcp_frame_rate and FrameRateConversion
+/* Test Playlist::best_dcp_frame_rate and FrameRateChange
with a single piece of content.
*/
BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-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/image_test.cc
+ * @brief Tests of the Image class.
+ *
+ * @see test/make_black_test.cc, test/pixel_formats_test.cc
+ */
+
#include <boost/test/unit_test.hpp>
#include <Magick++.h>
#include "lib/image.h"
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-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/job_test.cc
+ * @brief Basic tests of Job and JobManager.
+ */
+
#include <boost/test/unit_test.hpp>
#include "lib/job.h"
#include "lib/job_manager.h"
*/
+/** @file test/make_black_test.cc
+ * @brief Check that Image::make_black works, and doesn't use values which crash
+ * sws_scale().
+ *
+ * @see test/image_test.cc
+ */
+
#include <boost/test/unit_test.hpp>
#include <dcp/util.h>
extern "C" {
using std::list;
-/* Check that Image::make_black works, and doesn't use values which crash
- sws_scale().
-*/
BOOST_AUTO_TEST_CASE (make_black_test)
{
dcp::Size in_size (512, 512);
/*
- 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 src/pixel_formats_test.cc
+ * @brief Make sure that Image::lines() and Image::bytes_per_pixel() return the right
+ * things for various pixel formats.
+ *
+ * @see test/image_test.cc
+ */
+
#include <boost/test/unit_test.hpp>
#include <list>
extern "C" {
*/
+/* @file test/player_silence_padding_test.cc
+ * @brief Check that the Player correctly generates silence when used with a silent FFmpegContent.
+ */
+
#include <iostream>
#include <boost/test/unit_test.hpp>
#include "lib/film.h"
using std::cout;
using boost::shared_ptr;
-/* Check that the Player correctly generates silence when used with a silent FFmpegContent */
BOOST_AUTO_TEST_CASE (player_silence_padding_test)
{
shared_ptr<Film> film = new_test_film ("player_silence_padding_test");
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-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/ratio_test.cc
+ * @brief Test Ratio and fit_ratio_within().
+ */
+
#include <iostream>
#include <boost/test/unit_test.hpp>
#include <dcp/util.h>
*/
+/** @file test/recover_test.cc
+ * @brief Test recovery of a DCP transcode after a crash.
+ */
+
#include <boost/test/unit_test.hpp>
#include <dcp/stereo_picture_mxf.h>
#include "lib/film.h"
cout << n << "\n";
}
-/** Test recovery of a DCP transcode after a crash */
BOOST_AUTO_TEST_CASE (recover_test)
{
shared_ptr<Film> film = new_test_film ("recover_test");
/*
- 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/repeat_frame_test.cc
+ * @brief Test the repeat of frames by the player when putting a 24fps
+ * source into a 48fps DCP.
+ *
+ * @see test/skip_frame_test.cc
+ */
+
#include <boost/test/unit_test.hpp>
#include "test.h"
#include "lib/film.h"
using boost::shared_ptr;
-/* Test the repeat of frames by the player when putting a 24fps
- source into a 48fps DCP.
-*/
BOOST_AUTO_TEST_CASE (repeat_frame_test)
{
shared_ptr<Film> film = new_test_film ("repeat_frame_test");
/*
- 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/resampler_test.cc
+ * @brief Check that the timings that come back from the resampler correspond
+ * to the number of samples it generates.
+ */
+
#include <boost/test/unit_test.hpp>
#include "lib/audio_buffers.h"
#include "lib/resampler.h"
}
}
-/** Check that the timings that come back from the resampler correspond
- to the number of samples it generates.
-*/
BOOST_AUTO_TEST_CASE (resampler_test)
{
resampler_test_one (44100, 48000);
/*
- 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/scaling_test.cc
+ * @brief Test scaling and black-padding of images from a still-image source.
+ */
+
#include <boost/test/unit_test.hpp>
#include "lib/image_content.h"
#include "lib/ratio.h"
#include "lib/dcp_content_type.h"
#include "test.h"
-/** @file test/scaling_test.cc
- * @brief Test scaling and black-padding of images from a still-image source.
- */
-
using std::string;
using boost::shared_ptr;
/*
- 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 <dcp/cpl.h>
#include <dcp/dcp.h>
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);
/*
- 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/skip_frame_test.cc
+ * @brief Test the skip of frames by the player when putting a 48fps
+ * source into a 24fps DCP.
+ *
+ * @see test/repeat_frame_test.cc
+ */
+
#include <boost/test/unit_test.hpp>
#include "test.h"
#include "lib/film.h"
using boost::shared_ptr;
-/* Test the skip of frames by the player when putting a 48fps
- source into a 24fps DCP.
-*/
BOOST_AUTO_TEST_CASE (skip_frame_test)
{
shared_ptr<Film> film = new_test_film ("skip_frame_test");
/*
- 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
*/
+/** @test test/stream_test.cc
+ * @brief Some simple tests of FFmpegAudioStream.
+ */
+
#include <boost/test/unit_test.hpp>
#include <libxml++/libxml++.h>
#include <libcxml/cxml.h>
*/
+/** @file test/subrip_test.cc
+ * @brief Various tests of the subrip code.
+ */
+
#include <boost/test/unit_test.hpp>
#include <dcp/subtitle_content.h>
#include "lib/subrip.h"
*/
+/** @file test/test.cc
+ * @brief Overall test stuff and useful methods for tests.
+ */
+
#include <vector>
#include <list>
#include <Magick++.h>
/*
- 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/threed_test.cc
+ * @brief Create a 3D DCP (without comparing the result to anything).
+ */
+
#include <boost/test/unit_test.hpp>
#include "test.h"
#include "lib/film.h"
*/
+/** @file test/util_test.cc
+ * @brief Test various utility methods.
+ */
+
#include <boost/test/unit_test.hpp>
#include "lib/util.h"
#include "lib/exceptions.h"
ffmpeg_decoder_seek_test.cc
ffmpeg_decoder_sequential_test.cc
ffmpeg_examiner_test.cc
- ffmpeg_pts_offset.cc
+ ffmpeg_pts_offset_test.cc
file_group_test.cc
film_metadata_test.cc
frame_rate_test.cc