From 59404039618db5d70a2f8fc0cb8c49ae4f8ce527 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 18 Jul 2013 16:07:35 +0100 Subject: [PATCH] Split test compile up into individual files. --- src/lib/film.cc | 2 +- src/lib/wscript | 2 +- src/tools/dcpomatic_cli.cc | 20 +++++----- src/tools/dcpomatic_server.cc | 2 +- src/tools/dcpomatic_server_cli.cc | 18 ++++----- src/wx/audio_plot.h | 4 +- src/wx/dci_metadata_dialog.cc | 2 +- src/wx/dci_metadata_dialog.h | 2 +- src/wx/film_editor.cc | 6 +-- src/wx/film_viewer.cc | 2 +- src/wx/timeline.cc | 4 +- src/wx/timeline.h | 4 +- src/wx/timeline_dialog.cc | 2 +- src/wx/wscript | 4 +- src/wx/wx_ui_signaller.h | 2 +- src/wx/wx_util.cc | 4 +- test/audio_delay_test.cc | 9 ++++- test/black_fill_test.cc | 7 +++- test/client_server_test.cc | 11 ++++++ test/ffmpeg_dcp_test.cc | 10 +++++ test/ffmpeg_examiner_test.cc | 7 +++- test/ffmpeg_pts_offset.cc | 7 ++++ test/film_metadata_test.cc | 12 ++++++ test/frame_rate_test.cc | 7 ++++ test/image_test.cc | 6 +++ test/job_test.cc | 8 ++++ test/make_black_test.cc | 10 +++++ test/pixel_formats_test.cc | 8 ++++ test/play_test.cc | 8 +++- test/ratio_test.cc | 5 +++ test/scaling_test.cc | 8 +++- test/silence_padding_test.cc | 9 ++++- test/stream_test.cc | 5 +++ test/test.cc | 62 ++++++------------------------- test/test.h | 23 ++++++++++++ test/util_test.cc | 7 ++++ test/wscript | 22 ++++++++++- 37 files changed, 234 insertions(+), 97 deletions(-) create mode 100644 test/test.h diff --git a/src/lib/film.cc b/src/lib/film.cc index 3709807b7..b78622a90 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2013 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/src/lib/wscript b/src/lib/wscript index f6e7f8388..0d3f2913c 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -63,7 +63,7 @@ def build(bld): obj = bld(features = 'cxx cxxshlib') obj.name = 'libdcpomatic' - obj.export_includes = ['.'] + obj.export_includes = ['..'] obj.uselib = """ AVCODEC AVUTIL AVFORMAT AVFILTER SWSCALE SWRESAMPLE BOOST_FILESYSTEM BOOST_THREAD BOOST_DATETIME BOOST_SIGNALS2 diff --git a/src/tools/dcpomatic_cli.cc b/src/tools/dcpomatic_cli.cc index 8727761fd..7c5852fcc 100644 --- a/src/tools/dcpomatic_cli.cc +++ b/src/tools/dcpomatic_cli.cc @@ -21,16 +21,16 @@ #include #include #include -#include "film.h" -#include "filter.h" -#include "transcode_job.h" -#include "job_manager.h" -#include "util.h" -#include "scaler.h" -#include "version.h" -#include "cross.h" -#include "config.h" -#include "log.h" +#include "lib/film.h" +#include "lib/filter.h" +#include "lib/transcode_job.h" +#include "lib/job_manager.h" +#include "lib/util.h" +#include "lib/scaler.h" +#include "lib/version.h" +#include "lib/cross.h" +#include "lib/config.h" +#include "lib/log.h" using std::string; using std::cerr; diff --git a/src/tools/dcpomatic_server.cc b/src/tools/dcpomatic_server.cc index d3a353154..1bfc23ff9 100644 --- a/src/tools/dcpomatic_server.cc +++ b/src/tools/dcpomatic_server.cc @@ -20,7 +20,7 @@ #include #include #include -#include "wx_util.h" +#include "wx/wx_util.h" #include "lib/util.h" #include "lib/server.h" #include "lib/config.h" diff --git a/src/tools/dcpomatic_server_cli.cc b/src/tools/dcpomatic_server_cli.cc index b0c84b4eb..eff10a897 100644 --- a/src/tools/dcpomatic_server_cli.cc +++ b/src/tools/dcpomatic_server_cli.cc @@ -32,15 +32,15 @@ #include #include #include -#include "config.h" -#include "dcp_video_frame.h" -#include "exceptions.h" -#include "util.h" -#include "config.h" -#include "scaler.h" -#include "image.h" -#include "log.h" -#include "version.h" +#include "lib/config.h" +#include "lib/dcp_video_frame.h" +#include "lib/exceptions.h" +#include "lib/util.h" +#include "lib/config.h" +#include "lib/scaler.h" +#include "lib/image.h" +#include "lib/log.h" +#include "lib/version.h" using std::cerr; using std::string; diff --git a/src/wx/audio_plot.h b/src/wx/audio_plot.h index 7b2955e27..82f589f6f 100644 --- a/src/wx/audio_plot.h +++ b/src/wx/audio_plot.h @@ -20,8 +20,8 @@ #include #include #include -#include "util.h" -#include "audio_analysis.h" +#include "lib/util.h" +#include "lib/audio_analysis.h" class AudioPlot : public wxPanel { diff --git a/src/wx/dci_metadata_dialog.cc b/src/wx/dci_metadata_dialog.cc index df3a24f62..d84629e57 100644 --- a/src/wx/dci_metadata_dialog.cc +++ b/src/wx/dci_metadata_dialog.cc @@ -18,9 +18,9 @@ */ #include +#include "lib/film.h" #include "dci_metadata_dialog.h" #include "wx_util.h" -#include "film.h" using boost::shared_ptr; diff --git a/src/wx/dci_metadata_dialog.h b/src/wx/dci_metadata_dialog.h index fbc5e3b86..c20eb3b23 100644 --- a/src/wx/dci_metadata_dialog.h +++ b/src/wx/dci_metadata_dialog.h @@ -20,7 +20,7 @@ #include #include #include -#include "dci_metadata.h" +#include "lib/dci_metadata.h" class Film; diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 4ae3743b3..8f391f5cd 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -39,18 +39,18 @@ #include "lib/imagemagick_content.h" #include "lib/sndfile_content.h" #include "lib/dcp_content_type.h" +#include "lib/sound_processor.h" +#include "lib/scaler.h" +#include "timecode.h" #include "filter_dialog.h" #include "wx_util.h" #include "film_editor.h" #include "gain_calculator_dialog.h" -#include "sound_processor.h" #include "dci_metadata_dialog.h" -#include "scaler.h" #include "audio_dialog.h" #include "imagemagick_content_dialog.h" #include "timeline_dialog.h" #include "audio_mapping_view.h" -#include "timecode.h" using std::string; using std::cout; diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index d42829880..1fa7bdb91 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -37,9 +37,9 @@ #include "lib/video_content.h" #include "lib/ffmpeg_content.h" #include "lib/imagemagick_content.h" +#include "lib/video_decoder.h" #include "film_viewer.h" #include "wx_util.h" -#include "video_decoder.h" using std::string; using std::pair; diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index 8def5550a..ff10b7d91 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -20,11 +20,11 @@ #include #include #include -#include "film.h" +#include "lib/film.h" +#include "lib/playlist.h" #include "film_editor.h" #include "timeline.h" #include "wx_util.h" -#include "lib/playlist.h" using std::list; using std::cout; diff --git a/src/wx/timeline.h b/src/wx/timeline.h index 0470ed7b9..6979d6a78 100644 --- a/src/wx/timeline.h +++ b/src/wx/timeline.h @@ -21,8 +21,8 @@ #include #include #include -#include "util.h" -#include "rect.h" +#include "lib/util.h" +#include "lib/rect.h" class Film; class View; diff --git a/src/wx/timeline_dialog.cc b/src/wx/timeline_dialog.cc index 35d5eec21..9493d0acb 100644 --- a/src/wx/timeline_dialog.cc +++ b/src/wx/timeline_dialog.cc @@ -19,10 +19,10 @@ #include #include +#include "lib/playlist.h" #include "film_editor.h" #include "timeline_dialog.h" #include "wx_util.h" -#include "playlist.h" using std::list; using std::cout; diff --git a/src/wx/wscript b/src/wx/wscript index 0ec4be0cd..9dea367c9 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -57,8 +57,8 @@ def build(bld): obj = bld(features = 'cxx cxxshlib') obj.name = 'libdcpomatic-wx' - obj.includes = [ '..' ] - obj.export_includes = ['.'] +# obj.includes = [ '..' ] + obj.export_includes = ['..'] obj.uselib = 'WXWIDGETS' if bld.env.TARGET_LINUX: obj.uselib += ' GTK' diff --git a/src/wx/wx_ui_signaller.h b/src/wx/wx_ui_signaller.h index d134d2b6d..f7df6fca4 100644 --- a/src/wx/wx_ui_signaller.h +++ b/src/wx/wx_ui_signaller.h @@ -17,7 +17,7 @@ */ -#include "ui_signaller.h" +#include "lib/ui_signaller.h" class wxEvtHandler; diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index 64418dac0..d87fe1149 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -24,9 +24,9 @@ #include #include #include +#include "lib/config.h" +#include "lib/util.h" #include "wx_util.h" -#include "config.h" -#include "util.h" using namespace std; using namespace boost; diff --git a/test/audio_delay_test.cc b/test/audio_delay_test.cc index 73977bf3a..929a941d6 100644 --- a/test/audio_delay_test.cc +++ b/test/audio_delay_test.cc @@ -17,13 +17,20 @@ */ +#include #include #include #include #include -#include "sndfile_content.h" +#include "lib/sndfile_content.h" +#include "lib/dcp_content_type.h" +#include "lib/ratio.h" +#include "lib/film.h" +#include "test.h" +using std::string; using boost::lexical_cast; +using boost::shared_ptr; static void test_audio_delay (int delay_in_ms) diff --git a/test/black_fill_test.cc b/test/black_fill_test.cc index 51ce605f8..48cf1f53c 100644 --- a/test/black_fill_test.cc +++ b/test/black_fill_test.cc @@ -17,7 +17,12 @@ */ -#include "imagemagick_content.h" +#include +#include "lib/imagemagick_content.h" +#include "lib/dcp_content_type.h" +#include "lib/film.h" +#include "lib/ratio.h" +#include "test.h" /** @file test/black_fill_test.cc * @brief Test insertion of black frames between video content. diff --git a/test/client_server_test.cc b/test/client_server_test.cc index f3d72c2fc..7b5b2b7ef 100644 --- a/test/client_server_test.cc +++ b/test/client_server_test.cc @@ -17,6 +17,17 @@ */ +#include +#include +#include "lib/server.h" +#include "lib/image.h" +#include "lib/cross.h" +#include "lib/dcp_video_frame.h" + +using std::list; +using boost::shared_ptr; +using boost::thread; + void do_remote_encode (shared_ptr frame, ServerDescription* description, shared_ptr locally_encoded) { diff --git a/test/ffmpeg_dcp_test.cc b/test/ffmpeg_dcp_test.cc index 946bccbb8..66f3af839 100644 --- a/test/ffmpeg_dcp_test.cc +++ b/test/ffmpeg_dcp_test.cc @@ -17,6 +17,16 @@ */ +#include +#include +#include "lib/film.h" +#include "lib/ffmpeg_content.h" +#include "lib/ratio.h" +#include "lib/dcp_content_type.h" +#include "test.h" + +using boost::shared_ptr; + /** @file test/ffmpeg_dcp_test.cc * @brief Test scaling and black-padding of images from a still-image source. */ diff --git a/test/ffmpeg_examiner_test.cc b/test/ffmpeg_examiner_test.cc index 296444ba7..24c91880b 100644 --- a/test/ffmpeg_examiner_test.cc +++ b/test/ffmpeg_examiner_test.cc @@ -17,7 +17,12 @@ */ -#include "ffmpeg_examiner.h" +#include +#include "lib/ffmpeg_examiner.h" +#include "lib/ffmpeg_content.h" +#include "test.h" + +using boost::shared_ptr; BOOST_AUTO_TEST_CASE (ffmpeg_examiner_test) { diff --git a/test/ffmpeg_pts_offset.cc b/test/ffmpeg_pts_offset.cc index 0ed8f66d8..65cc28a84 100644 --- a/test/ffmpeg_pts_offset.cc +++ b/test/ffmpeg_pts_offset.cc @@ -17,6 +17,13 @@ */ +#include +#include "lib/film.h" +#include "lib/ffmpeg_decoder.h" +#include "test.h" + +using boost::shared_ptr; + BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test) { shared_ptr film = new_test_film ("ffmpeg_pts_offset_test"); diff --git a/test/film_metadata_test.cc b/test/film_metadata_test.cc index ba4fcced6..324787f19 100644 --- a/test/film_metadata_test.cc +++ b/test/film_metadata_test.cc @@ -17,6 +17,18 @@ */ +#include +#include +#include +#include +#include "lib/film.h" +#include "lib/dcp_content_type.h" +#include "lib/ratio.h" + +using std::string; +using std::stringstream; +using boost::shared_ptr; + BOOST_AUTO_TEST_CASE (film_metadata_test) { string const test_film = "build/test/film_metadata_test"; diff --git a/test/frame_rate_test.cc b/test/frame_rate_test.cc index 89a74e086..2ea7e60a5 100644 --- a/test/frame_rate_test.cc +++ b/test/frame_rate_test.cc @@ -17,6 +17,13 @@ */ +#include +#include "lib/film.h" +#include "lib/config.h" +#include "test.h" + +using boost::shared_ptr; + /* Test Playlist::best_dcp_frame_rate and FrameRateConversion with a single piece of content. */ diff --git a/test/image_test.cc b/test/image_test.cc index 750612cf4..4205e5f48 100644 --- a/test/image_test.cc +++ b/test/image_test.cc @@ -17,6 +17,12 @@ */ +#include +#include "lib/image.h" +#include "lib/scaler.h" + +using boost::shared_ptr; + BOOST_AUTO_TEST_CASE (aligned_image_test) { Image* s = new Image (PIX_FMT_RGB24, libdcp::Size (50, 50), true); diff --git a/test/job_test.cc b/test/job_test.cc index 86c6dc9e3..a3ad1bb6c 100644 --- a/test/job_test.cc +++ b/test/job_test.cc @@ -17,6 +17,14 @@ */ +#include +#include "lib/job.h" +#include "lib/job_manager.h" +#include "lib/cross.h" + +using std::string; +using boost::shared_ptr; + class TestJob : public Job { public: diff --git a/test/make_black_test.cc b/test/make_black_test.cc index 4c2822514..78c7fbbcb 100644 --- a/test/make_black_test.cc +++ b/test/make_black_test.cc @@ -17,6 +17,16 @@ */ +#include +#include +extern "C" { +#include +} +#include "lib/image.h" +#include "lib/scaler.h" + +using std::list; + /* Check that Image::make_black works, and doesn't use values which crash sws_scale(). */ diff --git a/test/pixel_formats_test.cc b/test/pixel_formats_test.cc index ccdda3317..1b720d9bf 100644 --- a/test/pixel_formats_test.cc +++ b/test/pixel_formats_test.cc @@ -17,6 +17,14 @@ */ +#include +#include +extern "C" { +#include +#include +} +#include "lib/image.h" + using std::list; using std::cout; diff --git a/test/play_test.cc b/test/play_test.cc index 0a15bfed2..909813e2a 100644 --- a/test/play_test.cc +++ b/test/play_test.cc @@ -17,12 +17,18 @@ */ -#include "player.h" +#include +#include "lib/player.h" +#include "lib/ratio.h" +#include "lib/dcp_content_type.h" +#include "test.h" /* This test needs stuff in Player that is only included in debug mode */ #ifdef DCPOMATIC_DEBUG +using std::cout; using boost::optional; +using boost::shared_ptr; struct Video { diff --git a/test/ratio_test.cc b/test/ratio_test.cc index 6311976a3..11517ed11 100644 --- a/test/ratio_test.cc +++ b/test/ratio_test.cc @@ -17,6 +17,11 @@ */ +#include +#include +#include +#include "lib/ratio.h" + using std::ostream; namespace libdcp { diff --git a/test/scaling_test.cc b/test/scaling_test.cc index fd700fbb9..5e8dab308 100644 --- a/test/scaling_test.cc +++ b/test/scaling_test.cc @@ -17,12 +17,18 @@ */ -#include "imagemagick_content.h" +#include +#include "lib/imagemagick_content.h" +#include "lib/ratio.h" +#include "lib/film.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; static void scaling_test_for (shared_ptr film, shared_ptr content, string image, string container) diff --git a/test/silence_padding_test.cc b/test/silence_padding_test.cc index e12106536..a8748f851 100644 --- a/test/silence_padding_test.cc +++ b/test/silence_padding_test.cc @@ -17,14 +17,21 @@ */ +#include #include #include #include #include #include -#include "sndfile_content.h" +#include "lib/sndfile_content.h" +#include "lib/film.h" +#include "lib/dcp_content_type.h" +#include "lib/ratio.h" +#include "test.h" +using std::string; using boost::lexical_cast; +using boost::shared_ptr; static void test_silence_padding (int channels) { diff --git a/test/stream_test.cc b/test/stream_test.cc index a95eb708c..b56f133c7 100644 --- a/test/stream_test.cc +++ b/test/stream_test.cc @@ -17,9 +17,14 @@ */ +#include +#include #include +#include "lib/ffmpeg_content.h" using std::pair; +using std::list; +using boost::shared_ptr; BOOST_AUTO_TEST_CASE (stream_test) { diff --git a/test/test.cc b/test/test.cc index b5142bd63..b3debe68e 100644 --- a/test/test.cc +++ b/test/test.cc @@ -17,45 +17,26 @@ */ -#include -#include -#include -#include -#include +#include +#include #include -#include "ratio.h" -#include "film.h" -#include "filter.h" -#include "job_manager.h" -#include "util.h" -#include "exceptions.h" -#include "image.h" -#include "log.h" -#include "dcp_video_frame.h" -#include "config.h" -#include "server.h" -#include "cross.h" -#include "job.h" -#include "scaler.h" -#include "ffmpeg_decoder.h" -#include "sndfile_decoder.h" -#include "dcp_content_type.h" -#include "ui_signaller.h" -#include "ratio.h" +#include "lib/config.h" +#include "lib/util.h" +#include "lib/ui_signaller.h" +#include "lib/film.h" +#include "lib/job_manager.h" +#include "lib/job.h" #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE dcpomatic_test #include using std::string; -using std::list; -using std::stringstream; using std::vector; using std::min; using std::cout; using std::cerr; +using std::list; using boost::shared_ptr; -using boost::thread; -using boost::dynamic_pointer_cast; struct TestConfig { @@ -76,7 +57,7 @@ struct TestConfig BOOST_GLOBAL_FIXTURE (TestConfig); -static boost::filesystem::path +boost::filesystem::path test_film_dir (string name) { boost::filesystem::path p; @@ -86,7 +67,7 @@ test_film_dir (string name) return p; } -static shared_ptr +shared_ptr new_test_film (string name) { boost::filesystem::path p = test_film_dir (name); @@ -137,7 +118,7 @@ note (libdcp::NoteType, string n) cout << n << "\n"; } -static void +void check_dcp (string ref, string check) { libdcp::DCP ref_dcp (ref); @@ -169,22 +150,3 @@ wait_for_jobs () BOOST_CHECK (!jm->errors()); } - -#include "play_test.cc" -#include "frame_rate_test.cc" -#include "silence_padding_test.cc" -#include "audio_delay_test.cc" -#include "ffmpeg_pts_offset.cc" -#include "ffmpeg_examiner_test.cc" -#include "black_fill_test.cc" -#include "scaling_test.cc" -#include "ratio_test.cc" -#include "pixel_formats_test.cc" -#include "make_black_test.cc" -#include "film_metadata_test.cc" -#include "stream_test.cc" -#include "util_test.cc" -#include "ffmpeg_dcp_test.cc" -#include "job_test.cc" -#include "client_server_test.cc" -#include "image_test.cc" diff --git a/test/test.h b/test/test.h new file mode 100644 index 000000000..6a6ba65ad --- /dev/null +++ b/test/test.h @@ -0,0 +1,23 @@ +/* + Copyright (C) 2013 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 + 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. + +*/ + +extern void wait_for_jobs (); +extern boost::shared_ptr new_test_film (std::string); +extern void check_dcp (std::string, std::string); +extern boost::filesystem::path test_film_dir (std::string); diff --git a/test/util_test.cc b/test/util_test.cc index f75fd0e70..a5e671f23 100644 --- a/test/util_test.cc +++ b/test/util_test.cc @@ -17,6 +17,13 @@ */ +#include +#include "lib/util.h" +#include "lib/exceptions.h" + +using std::string; +using std::vector; + BOOST_AUTO_TEST_CASE (util_test) { string t = "Hello this is a string \"with quotes\" and indeed without them"; diff --git a/test/wscript b/test/wscript index 60d846aea..f4a7061d1 100644 --- a/test/wscript +++ b/test/wscript @@ -14,6 +14,26 @@ def build(bld): obj.name = 'unit-tests' obj.uselib = 'BOOST_TEST DCP OPENJPEG AVFORMAT AVFILTER AVCODEC AVUTIL SWSCALE POSTPROC CXML' obj.use = 'libdcpomatic' - obj.source = 'test.cc' + obj.source = """ + test.cc + play_test.cc + frame_rate_test.cc + silence_padding_test.cc + audio_delay_test.cc + ffmpeg_pts_offset.cc + ffmpeg_examiner_test.cc + black_fill_test.cc + scaling_test.cc + ratio_test.cc + pixel_formats_test.cc + make_black_test.cc + film_metadata_test.cc + stream_test.cc + util_test.cc + ffmpeg_dcp_test.cc + job_test.cc + client_server_test.cc + image_test.cc + """ obj.target = 'unit-tests' obj.install_path = '' -- 2.30.2