From 233bb3f790aef3c8f9a7a7fde9875833b7dc1dfb Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 29 Apr 2014 20:57:02 +0100 Subject: [PATCH] Various comment fixes to tests. --- test/README | 48 +++++++++++++++++++ test/audio_delay_test.cc | 2 +- test/black_fill_test.cc | 2 +- test/ffmpeg_decoder_seek_test.cc | 8 ++++ test/ffmpeg_decoder_sequential_test.cc | 12 +++-- test/ffmpeg_examiner_test.cc | 5 ++ ...ts_offset.cc => ffmpeg_pts_offset_test.cc} | 6 ++- test/file_group_test.cc | 6 ++- test/film_metadata_test.cc | 20 ++++---- test/frame_rate_test.cc | 9 +++- test/image_test.cc | 8 +++- test/job_test.cc | 6 ++- test/make_black_test.cc | 10 ++-- test/pixel_formats_test.cc | 9 +++- test/player_silence_padding_test.cc | 5 +- test/ratio_test.cc | 6 ++- test/recover_test.cc | 5 +- test/repeat_frame_test.cc | 12 +++-- test/resampler_test.cc | 10 ++-- test/scaling_test.cc | 10 ++-- test/silence_padding_test.cc | 9 +++- test/skip_frame_test.cc | 12 +++-- test/stream_test.cc | 6 ++- test/subrip_test.cc | 4 ++ test/test.cc | 4 ++ test/threed_test.cc | 6 ++- test/util_test.cc | 4 ++ test/wscript | 2 +- 28 files changed, 194 insertions(+), 52 deletions(-) create mode 100644 test/README rename test/{ffmpeg_pts_offset.cc => ffmpeg_pts_offset_test.cc} (93%) diff --git a/test/README b/test/README new file mode 100644 index 000000000..aac515bb7 --- /dev/null +++ b/test/README @@ -0,0 +1,48 @@ +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 diff --git a/test/audio_delay_test.cc b/test/audio_delay_test.cc index 8f4ca836a..87e6071a0 100644 --- a/test/audio_delay_test.cc +++ b/test/audio_delay_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2014 Carl Hetherington 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 diff --git a/test/black_fill_test.cc b/test/black_fill_test.cc index ef768b9a4..7741277a5 100644 --- a/test/black_fill_test.cc +++ b/test/black_fill_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2014 Carl Hetherington 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 diff --git a/test/ffmpeg_decoder_seek_test.cc b/test/ffmpeg_decoder_seek_test.cc index 76124786e..dd80765f4 100644 --- a/test/ffmpeg_decoder_seek_test.cc +++ b/test/ffmpeg_decoder_seek_test.cc @@ -17,6 +17,14 @@ */ +/** @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 #include #include diff --git a/test/ffmpeg_decoder_sequential_test.cc b/test/ffmpeg_decoder_sequential_test.cc index 96de9be27..48b9b6b3b 100644 --- a/test/ffmpeg_decoder_sequential_test.cc +++ b/test/ffmpeg_decoder_sequential_test.cc @@ -17,6 +17,11 @@ */ +/** @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 #include #include "lib/ffmpeg_content.h" @@ -64,13 +69,10 @@ test (boost::filesystem::path file, float fps, int first) 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); } diff --git a/test/ffmpeg_examiner_test.cc b/test/ffmpeg_examiner_test.cc index 00a01e657..d72226a6f 100644 --- a/test/ffmpeg_examiner_test.cc +++ b/test/ffmpeg_examiner_test.cc @@ -17,6 +17,11 @@ */ +/** @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 #include "lib/ffmpeg_examiner.h" #include "lib/ffmpeg_content.h" diff --git a/test/ffmpeg_pts_offset.cc b/test/ffmpeg_pts_offset_test.cc similarity index 93% rename from test/ffmpeg_pts_offset.cc rename to test/ffmpeg_pts_offset_test.cc index dc391ed46..9a9785d28 100644 --- a/test/ffmpeg_pts_offset.cc +++ b/test/ffmpeg_pts_offset_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2014 Carl Hetherington 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 @@ -17,6 +17,10 @@ */ +/** @file test/ffmpeg_pts_offset_test.cc + * @brief Check the computation of _pts_offset in FFmpegDecoder. + */ + #include #include "lib/film.h" #include "lib/ffmpeg_decoder.h" diff --git a/test/file_group_test.cc b/test/file_group_test.cc index 14c01a976..888834511 100644 --- a/test/file_group_test.cc +++ b/test/file_group_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2014 Carl Hetherington 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 @@ -17,6 +17,10 @@ */ +/** @file test/file_group_test.cc + * @brief Check that FileGroup works. + */ + #include #include #include diff --git a/test/film_metadata_test.cc b/test/film_metadata_test.cc index 1f06aa538..cc29f4472 100644 --- a/test/film_metadata_test.cc +++ b/test/film_metadata_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2014 Carl Hetherington 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 @@ -17,6 +17,10 @@ */ +/** @file test/film_metadata_test.cc + * @brief Test some basic reading/writing of film metadata. + */ + #include #include #include @@ -33,13 +37,9 @@ using boost::shared_ptr; 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 f = new_test_film ("film_metadata_test"); + boost::filesystem::path dir = test_film_dir ("film_metadata_test"); - shared_ptr 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); @@ -52,9 +52,9 @@ BOOST_AUTO_TEST_CASE (film_metadata_test) list 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 g (new Film (test_film)); + shared_ptr g (new Film (dir)); g->read_metadata (); BOOST_CHECK_EQUAL (g->name(), "fred"); @@ -62,5 +62,5 @@ BOOST_AUTO_TEST_CASE (film_metadata_test) 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); } diff --git a/test/frame_rate_test.cc b/test/frame_rate_test.cc index 2135b3738..e710b0934 100644 --- a/test/frame_rate_test.cc +++ b/test/frame_rate_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2014 Carl Hetherington 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 @@ -17,6 +17,11 @@ */ +/** @file test/frame_rate_test.cc + * @brief Tests for FrameRateChange and the computation of the best + * frame rate for the DCP. + */ + #include #include "lib/film.h" #include "lib/config.h" @@ -26,7 +31,7 @@ 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) diff --git a/test/image_test.cc b/test/image_test.cc index f876c8f65..d3b068171 100644 --- a/test/image_test.cc +++ b/test/image_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2014 Carl Hetherington 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 @@ -17,6 +17,12 @@ */ +/** @file test/image_test.cc + * @brief Tests of the Image class. + * + * @see test/make_black_test.cc, test/pixel_formats_test.cc + */ + #include #include #include "lib/image.h" diff --git a/test/job_test.cc b/test/job_test.cc index 4d32b1e0c..2022a8dda 100644 --- a/test/job_test.cc +++ b/test/job_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2014 Carl Hetherington 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 @@ -17,6 +17,10 @@ */ +/** @file test/job_test.cc + * @brief Basic tests of Job and JobManager. + */ + #include #include "lib/job.h" #include "lib/job_manager.h" diff --git a/test/make_black_test.cc b/test/make_black_test.cc index 88c1bd0f4..0ae2fd137 100644 --- a/test/make_black_test.cc +++ b/test/make_black_test.cc @@ -17,6 +17,13 @@ */ +/** @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 #include extern "C" { @@ -27,9 +34,6 @@ 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); diff --git a/test/pixel_formats_test.cc b/test/pixel_formats_test.cc index 1b720d9bf..8f6f1e81c 100644 --- a/test/pixel_formats_test.cc +++ b/test/pixel_formats_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2014 Carl Hetherington 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 @@ -17,6 +17,13 @@ */ +/** @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 #include extern "C" { diff --git a/test/player_silence_padding_test.cc b/test/player_silence_padding_test.cc index ced0bd61a..fa8a9b6e6 100644 --- a/test/player_silence_padding_test.cc +++ b/test/player_silence_padding_test.cc @@ -17,6 +17,10 @@ */ +/* @file test/player_silence_padding_test.cc + * @brief Check that the Player correctly generates silence when used with a silent FFmpegContent. + */ + #include #include #include "lib/film.h" @@ -30,7 +34,6 @@ 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 = new_test_film ("player_silence_padding_test"); diff --git a/test/ratio_test.cc b/test/ratio_test.cc index f3784cad2..f5ac3ca64 100644 --- a/test/ratio_test.cc +++ b/test/ratio_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2014 Carl Hetherington 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 @@ -17,6 +17,10 @@ */ +/** @file test/ratio_test.cc + * @brief Test Ratio and fit_ratio_within(). + */ + #include #include #include diff --git a/test/recover_test.cc b/test/recover_test.cc index acb4acaf8..dfbc9f60d 100644 --- a/test/recover_test.cc +++ b/test/recover_test.cc @@ -17,6 +17,10 @@ */ +/** @file test/recover_test.cc + * @brief Test recovery of a DCP transcode after a crash. + */ + #include #include #include "lib/film.h" @@ -35,7 +39,6 @@ note (dcp::NoteType, string n) cout << n << "\n"; } -/** Test recovery of a DCP transcode after a crash */ BOOST_AUTO_TEST_CASE (recover_test) { shared_ptr film = new_test_film ("recover_test"); diff --git a/test/repeat_frame_test.cc b/test/repeat_frame_test.cc index 6cedf9179..4f66420ea 100644 --- a/test/repeat_frame_test.cc +++ b/test/repeat_frame_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2014 Carl Hetherington 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 @@ -17,6 +17,13 @@ */ +/** @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 #include "test.h" #include "lib/film.h" @@ -26,9 +33,6 @@ 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 = new_test_film ("repeat_frame_test"); diff --git a/test/resampler_test.cc b/test/resampler_test.cc index 3be251b3a..ffd636ac8 100644 --- a/test/resampler_test.cc +++ b/test/resampler_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2014 Carl Hetherington 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 @@ -17,6 +17,11 @@ */ +/** @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 #include "lib/audio_buffers.h" #include "lib/resampler.h" @@ -44,9 +49,6 @@ resampler_test_one (int from, int to) } } -/** 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); diff --git a/test/scaling_test.cc b/test/scaling_test.cc index bf8da8aac..704c2c7da 100644 --- a/test/scaling_test.cc +++ b/test/scaling_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2014 Carl Hetherington 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 @@ -17,6 +17,10 @@ */ +/** @file test/scaling_test.cc + * @brief Test scaling and black-padding of images from a still-image source. + */ + #include #include "lib/image_content.h" #include "lib/ratio.h" @@ -24,10 +28,6 @@ #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; diff --git a/test/silence_padding_test.cc b/test/silence_padding_test.cc index e4472ad4f..ff3690626 100644 --- a/test/silence_padding_test.cc +++ b/test/silence_padding_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2014 Carl Hetherington 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 @@ -17,6 +17,10 @@ */ +/** @file test/silence_padding_test.cc + * @brief Test the padding (with silence) of a mono source to a 6-channel DCP. + */ + #include #include #include @@ -34,7 +38,8 @@ 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 (channels); shared_ptr film = new_test_film (film_name); diff --git a/test/skip_frame_test.cc b/test/skip_frame_test.cc index 61176a7c6..a77d8459b 100644 --- a/test/skip_frame_test.cc +++ b/test/skip_frame_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2014 Carl Hetherington 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 @@ -17,6 +17,13 @@ */ +/** @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 #include "test.h" #include "lib/film.h" @@ -26,9 +33,6 @@ 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 = new_test_film ("skip_frame_test"); diff --git a/test/stream_test.cc b/test/stream_test.cc index 1cd7e4a42..f30bc64d8 100644 --- a/test/stream_test.cc +++ b/test/stream_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2014 Carl Hetherington 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 @@ -17,6 +17,10 @@ */ +/** @test test/stream_test.cc + * @brief Some simple tests of FFmpegAudioStream. + */ + #include #include #include diff --git a/test/subrip_test.cc b/test/subrip_test.cc index f38ffb59b..48bb265d5 100644 --- a/test/subrip_test.cc +++ b/test/subrip_test.cc @@ -17,6 +17,10 @@ */ +/** @file test/subrip_test.cc + * @brief Various tests of the subrip code. + */ + #include #include #include "lib/subrip.h" diff --git a/test/test.cc b/test/test.cc index 3f044acf1..7bbf4f749 100644 --- a/test/test.cc +++ b/test/test.cc @@ -17,6 +17,10 @@ */ +/** @file test/test.cc + * @brief Overall test stuff and useful methods for tests. + */ + #include #include #include diff --git a/test/threed_test.cc b/test/threed_test.cc index 8da9b46a8..5ad78103f 100644 --- a/test/threed_test.cc +++ b/test/threed_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2014 Carl Hetherington 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 @@ -17,6 +17,10 @@ */ +/** @file test/threed_test.cc + * @brief Create a 3D DCP (without comparing the result to anything). + */ + #include #include "test.h" #include "lib/film.h" diff --git a/test/util_test.cc b/test/util_test.cc index b2085afe1..5eb3e27f1 100644 --- a/test/util_test.cc +++ b/test/util_test.cc @@ -17,6 +17,10 @@ */ +/** @file test/util_test.cc + * @brief Test various utility methods. + */ + #include #include "lib/util.h" #include "lib/exceptions.h" diff --git a/test/wscript b/test/wscript index ca53122b5..5e728af0b 100644 --- a/test/wscript +++ b/test/wscript @@ -27,7 +27,7 @@ def build(bld): 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 -- 2.30.2