diff options
Diffstat (limited to 'test')
107 files changed, 1918 insertions, 1352 deletions
diff --git a/test/2536_regression_test.cc b/test/2536_regression_test.cc index 7233839ae..9f74ffd09 100644 --- a/test/2536_regression_test.cc +++ b/test/2536_regression_test.cc @@ -37,7 +37,7 @@ BOOST_AUTO_TEST_CASE(crash_rendering_vf_interop_subs_test) auto prefix = std::string("crash_rendering_vf_interop_subs_test"); auto video = content_factory("test/data/flat_red.png"); - auto ov = new_test_film2(prefix + "_ov", video); + auto ov = new_test_film(prefix + "_ov", video); ov->set_interop(true); make_and_verify_dcp( @@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE(crash_rendering_vf_interop_subs_test) auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name())); auto subtitles = content_factory("test/data/short.srt"); - auto vf = new_test_film2(prefix + "_vf", { ov_dcp, subtitles.front() }); + auto vf = new_test_film(prefix + "_vf", { ov_dcp, subtitles.front() }); vf->set_interop(true); vf->set_reel_type(ReelType::BY_VIDEO_CONTENT); ov_dcp->set_reference_video(true); @@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE(crash_rendering_vf_interop_subs_test) auto vf_dcp = make_shared<DCPContent>(vf->dir(vf->dcp_name())); vf_dcp->add_ov(ov->dir(ov->dcp_name())); - auto test = new_test_film2(prefix + "_test", { vf_dcp }); + auto test = new_test_film(prefix + "_test", { vf_dcp }); vf_dcp->text[0]->set_use(true); auto player = make_shared<Player>(test, Image::Alignment::COMPACT); diff --git a/test/4k_test.cc b/test/4k_test.cc index 9e80a6e27..a1b9477b1 100644 --- a/test/4k_test.cc +++ b/test/4k_test.cc @@ -44,15 +44,11 @@ using std::make_shared; BOOST_AUTO_TEST_CASE (fourk_test) { - auto film = new_test_film ("4k_test"); - LogSwitcher ls (film->log()); - film->set_name ("4k_test"); auto c = make_shared<FFmpegContent>("test/data/test.mp4"); + auto film = new_test_film("4k_test", { c }); + LogSwitcher ls (film->log()); film->set_resolution (Resolution::FOUR_K); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); - film->set_container (Ratio::from_id ("185")); - film->examine_and_add_content (c); - BOOST_REQUIRE (!wait_for_jobs()); + film->set_dcp_content_type(DCPContentType::from_isdcf_name("FTR")); make_and_verify_dcp ( film, diff --git a/test/atmos_test.cc b/test/atmos_test.cc index 9fdddc979..ef7449f20 100644 --- a/test/atmos_test.cc +++ b/test/atmos_test.cc @@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE (atmos_passthrough_test) { Cleanup cl; - auto film = new_test_film2 ( + auto film = new_test_film( "atmos_passthrough_test", content_factory(TestPaths::private_data() / "atmos_asset.mxf"), &cl @@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE (atmos_encrypted_passthrough_test) auto ref = TestPaths::private_data() / "atmos_asset.mxf"; auto content = content_factory(TestPaths::private_data() / "atmos_asset.mxf"); - auto film = new_test_film2 ("atmos_encrypted_passthrough_test", content, &cl); + auto film = new_test_film("atmos_encrypted_passthrough_test", content, &cl); film->set_encrypted (true); film->_key = dcp::Key ("4fac12927eb122af1c2781aa91f3a4cc"); @@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE (atmos_encrypted_passthrough_test) auto content2 = make_shared<DCPContent>(film->dir(film->dcp_name())); content2->add_kdm (kdm); - auto film2 = new_test_film2 ("atmos_encrypted_passthrough_test2", {content2}, &cl); + auto film2 = new_test_film("atmos_encrypted_passthrough_test2", {content2}, &cl); make_and_verify_dcp (film2, { dcp::VerificationNote::Code::MISSING_CPL_METADATA }); BOOST_CHECK (mxf_atmos_files_same(ref, dcp_file(film2, "atmos"), true)); @@ -97,12 +97,14 @@ BOOST_AUTO_TEST_CASE (atmos_trim_test) auto ref = TestPaths::private_data() / "atmos_asset.mxf"; auto content = content_factory(TestPaths::private_data() / "atmos_asset.mxf"); - auto film = new_test_film2 ("atmos_trim_test", content, &cl); + auto film = new_test_film("atmos_trim_test", content, &cl); content[0]->set_trim_start(film, dcpomatic::ContentTime::from_seconds(1)); /* Just check that the encode runs; I'm not sure how to test the MXF */ make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_CPL_METADATA }); + + cl.run(); } @@ -129,14 +131,14 @@ BOOST_AUTO_TEST_CASE(atmos_replace_test) }; auto atmos_0 = content_factory("test/data/atmos_0.mxf"); - auto ov = new_test_film2("atmos_merge_test_ov", atmos_0); + auto ov = new_test_film("atmos_merge_test_ov", atmos_0); make_and_verify_dcp(ov, { dcp::VerificationNote::Code::MISSING_CPL_METADATA }); // atmos_0.mxf should contain all zeros for its data check(ov, 0); auto atmos_1 = content_factory("test/data/atmos_1.mxf"); auto ov_content = std::make_shared<DCPContent>(boost::filesystem::path("build/test/atmos_merge_test_ov") / ov->dcp_name()); - auto vf = new_test_film2("atmos_merge_test_vf", { ov_content, atmos_1.front() }); + auto vf = new_test_film("atmos_merge_test_vf", { ov_content, atmos_1.front() }); ov_content->set_reference_video(true); atmos_1.front()->set_position(vf, dcpomatic::DCPTime()); make_and_verify_dcp(vf, { dcp::VerificationNote::Code::MISSING_CPL_METADATA, dcp::VerificationNote::Code::EXTERNAL_ASSET }, false); diff --git a/test/audio_analysis_test.cc b/test/audio_analysis_test.cc index 8ded9eda9..77b251918 100644 --- a/test/audio_analysis_test.cc +++ b/test/audio_analysis_test.cc @@ -102,15 +102,8 @@ BOOST_AUTO_TEST_CASE (audio_analysis_serialisation_test) BOOST_AUTO_TEST_CASE (audio_analysis_test) { - auto film = new_test_film ("audio_analysis_test"); - film->set_dcp_content_type (DCPContentType::from_isdcf_name("FTR")); - film->set_container (Ratio::from_id("185")); - film->set_name ("audio_analysis_test"); - boost::filesystem::path p = TestPaths::private_data() / "betty_L.wav"; - - auto c = make_shared<FFmpegContent>(p); - film->examine_and_add_content (c); - BOOST_REQUIRE (!wait_for_jobs()); + auto c = make_shared<FFmpegContent>(TestPaths::private_data() / "betty_L.wav"); + auto film = new_test_film("audio_analysis_test", { c }); auto job = make_shared<AnalyseAudioJob>(film, film->playlist(), false); JobManager::instance()->add (job); @@ -121,12 +114,8 @@ BOOST_AUTO_TEST_CASE (audio_analysis_test) /** Check that audio analysis works (i.e. runs without error) with a -ve delay */ BOOST_AUTO_TEST_CASE (audio_analysis_negative_delay_test) { - auto film = new_test_film ("audio_analysis_negative_delay_test"); - film->set_name ("audio_analysis_negative_delay_test"); auto c = make_shared<FFmpegContent>(TestPaths::private_data() / "boon_telly.mkv"); - film->examine_and_add_content (c); - BOOST_REQUIRE (!wait_for_jobs()); - + auto film = new_test_film("audio_analysis_negative_delay_test", { c }); c->audio->set_delay (-250); auto job = make_shared<AnalyseAudioJob>(film, film->playlist(), false); @@ -138,11 +127,8 @@ BOOST_AUTO_TEST_CASE (audio_analysis_negative_delay_test) /** Check audio analysis that is incorrect in 2e98263 */ BOOST_AUTO_TEST_CASE (audio_analysis_test2) { - auto film = new_test_film ("audio_analysis_test2"); - film->set_name ("audio_analysis_test2"); auto c = make_shared<FFmpegContent>(TestPaths::private_data() / "3d_thx_broadway_2010_lossless.m2ts"); - film->examine_and_add_content (c); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("audio_analysis_test2", { c }); auto job = make_shared<AnalyseAudioJob>(film, film->playlist(), false); JobManager::instance()->add (job); @@ -155,16 +141,10 @@ BOOST_AUTO_TEST_CASE (audio_analysis_test2) */ BOOST_AUTO_TEST_CASE (audio_analysis_test3) { - auto film = new_test_film ("analyse_audio_test"); - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name("TLR")); - film->set_name ("frobozz"); - auto content = make_shared<FFmpegContent>("test/data/white.wav"); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); - + auto film = new_test_film("analyse_audio_test", { content }); film->set_audio_channels (12); + boost::signals2::connection connection; bool done = false; JobManager::instance()->analyse_audio(film, film->playlist(), false, connection, [&done](Job::Result) { done = true; }); @@ -176,13 +156,8 @@ BOOST_AUTO_TEST_CASE (audio_analysis_test3) /** Run an audio analysis that triggered an exception in the audio decoder at one point */ BOOST_AUTO_TEST_CASE (analyse_audio_test4) { - auto film = new_test_film ("analyse_audio_test"); - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name("TLR")); - film->set_name ("frobozz"); auto content = content_factory(TestPaths::private_data() / "20 The Wedding Convoy Song.m4a")[0]; - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("analyse_audio_test", { content }); auto playlist = make_shared<Playlist>(); playlist->add (film, content); @@ -194,7 +169,7 @@ BOOST_AUTO_TEST_CASE (analyse_audio_test4) BOOST_AUTO_TEST_CASE (analyse_audio_leqm_test) { - auto film = new_test_film2 ("analyse_audio_leqm_test"); + auto film = new_test_film("analyse_audio_leqm_test"); film->set_audio_channels (2); auto content = content_factory(TestPaths::private_data() / "betty_stereo_48k.wav")[0]; film->examine_and_add_content (content); @@ -216,7 +191,7 @@ BOOST_AUTO_TEST_CASE (analyse_audio_leqm_test) BOOST_AUTO_TEST_CASE(analyse_audio_leqm_same_with_empty_channels) { auto dcp = make_shared<DCPContent>(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV"); - auto film = new_test_film2("analyse_audio_leqm_test2", { dcp }); + auto film = new_test_film("analyse_audio_leqm_test2", { dcp }); film->set_audio_channels(8); auto analyse = [film, dcp](int channels) { @@ -242,7 +217,7 @@ BOOST_AUTO_TEST_CASE(analyse_audio_leqm_same_with_empty_channels) BOOST_AUTO_TEST_CASE(analyse_audio_with_long_silent_end) { auto content = content_factory(TestPaths::private_data() / "2364.mkv")[0]; - auto film = new_test_film2("analyse_audio_with_long_silent_end", { content }); + auto film = new_test_film("analyse_audio_with_long_silent_end", { content }); auto playlist = make_shared<Playlist>(); playlist->add(film, content); @@ -255,7 +230,7 @@ BOOST_AUTO_TEST_CASE(analyse_audio_with_long_silent_end) BOOST_AUTO_TEST_CASE(analyse_audio_with_strange_channel_count) { auto content = content_factory(TestPaths::private_data() / "mali.mkv")[0]; - auto film = new_test_film2("analyse_audio_with_strange_channel_count", { content }); + auto film = new_test_film("analyse_audio_with_strange_channel_count", { content }); auto playlist = make_shared<Playlist>(); playlist->add(film, content); @@ -268,14 +243,14 @@ BOOST_AUTO_TEST_CASE(analyse_audio_with_strange_channel_count) BOOST_AUTO_TEST_CASE(analyse_audio_with_more_channels_than_film) { auto picture = content_factory("test/data/flat_red.png"); - auto film_16ch = new_test_film2("analyse_audio_with_more_channels_than_film_16ch", picture); + auto film_16ch = new_test_film("analyse_audio_with_more_channels_than_film_16ch", picture); film_16ch->set_audio_channels(16); make_and_verify_dcp(film_16ch); auto pcm_16ch = find_file(film_16ch->dir(film_16ch->dcp_name()), "pcm_"); auto sound = content_factory(pcm_16ch)[0]; - auto film_6ch = new_test_film2("analyse_audio_with_more_channels_than_film_6ch", { sound }); + auto film_6ch = new_test_film("analyse_audio_with_more_channels_than_film_6ch", { sound }); auto playlist = make_shared<Playlist>(); playlist->add(film_6ch, sound); @@ -288,7 +263,7 @@ BOOST_AUTO_TEST_CASE(analyse_audio_with_more_channels_than_film) BOOST_AUTO_TEST_CASE(analyse_audio_uses_processor_when_analysing_whole_film) { auto sound = content_factory(TestPaths::private_data() / "betty_stereo.wav")[0]; - auto film = new_test_film2("analyse_audio_uses_processor_when_analysing_whole_film", { sound }); + auto film = new_test_film("analyse_audio_uses_processor_when_analysing_whole_film", { sound }); auto job = make_shared<AnalyseAudioJob>(film, film->playlist(), true); JobManager::instance()->add(job); diff --git a/test/audio_content_test.cc b/test/audio_content_test.cc index 97f55d53a..465109259 100644 --- a/test/audio_content_test.cc +++ b/test/audio_content_test.cc @@ -34,7 +34,7 @@ BOOST_AUTO_TEST_CASE (audio_content_fade_empty_region) { auto content = content_factory("test/data/impulse_train.wav"); - auto film = new_test_film2("audio_content_fade_empty_region", content); + auto film = new_test_film("audio_content_fade_empty_region", content); BOOST_CHECK(content[0]->audio->fade(content[0]->audio->stream(), 0, 0, 48000).empty()); } @@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE (audio_content_fade_empty_region) BOOST_AUTO_TEST_CASE (audio_content_fade_no_fade) { auto content = content_factory("test/data/impulse_train.wav"); - auto film = new_test_film2("audio_content_fade_no_fade", content); + auto film = new_test_film("audio_content_fade_no_fade", content); auto const stream = content[0]->audio->stream(); @@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE (audio_content_fade_no_fade) BOOST_AUTO_TEST_CASE (audio_content_fade_unfaded_part) { auto content = content_factory("test/data/impulse_train.wav")[0]; - auto film = new_test_film2("audio_content_fade_unfaded_part", { content }); + auto film = new_test_film("audio_content_fade_unfaded_part", { content }); auto const stream = content->audio->stream(); @@ -72,7 +72,7 @@ BOOST_AUTO_TEST_CASE (audio_content_fade_unfaded_part) BOOST_AUTO_TEST_CASE (audio_content_within_the_fade_in) { auto content = content_factory("test/data/impulse_train.wav")[0]; - auto film = new_test_film2("audio_content_within_the_fade_in", { content }); + auto film = new_test_film("audio_content_within_the_fade_in", { content }); content->audio->set_fade_in(dcpomatic::ContentTime::from_frames(2000, 48000)); @@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE (audio_content_within_the_fade_in) BOOST_AUTO_TEST_CASE (audio_content_within_the_fade_out) { auto content = content_factory("test/data/impulse_train.wav")[0]; - auto film = new_test_film2("audio_content_within_the_fade_out", { content }); + auto film = new_test_film("audio_content_within_the_fade_out", { content }); auto const stream = content->audio->stream(); @@ -105,7 +105,7 @@ BOOST_AUTO_TEST_CASE (audio_content_within_the_fade_out) BOOST_AUTO_TEST_CASE (audio_content_overlapping_the_fade_in) { auto content = content_factory("test/data/impulse_train.wav")[0]; - auto film = new_test_film2("audio_content_overlapping_the_fade_in", { content }); + auto film = new_test_film("audio_content_overlapping_the_fade_in", { content }); content->audio->set_fade_in(dcpomatic::ContentTime::from_frames(2000, 48000)); content->audio->set_fade_out(dcpomatic::ContentTime::from_frames(2000, 48000)); @@ -124,7 +124,7 @@ BOOST_AUTO_TEST_CASE (audio_content_overlapping_the_fade_in) BOOST_AUTO_TEST_CASE (audio_content_overlapping_the_fade_out) { auto content = content_factory("test/data/impulse_train.wav")[0]; - auto film = new_test_film2("audio_content_overlapping_the_fade_out", { content }); + auto film = new_test_film("audio_content_overlapping_the_fade_out", { content }); auto const stream = content->audio->stream(); @@ -145,7 +145,7 @@ BOOST_AUTO_TEST_CASE (audio_content_overlapping_the_fade_out) BOOST_AUTO_TEST_CASE (audio_content_fade_in_and_out) { auto content = content_factory("test/data/impulse_train.wav")[0]; - auto film = new_test_film2("audio_content_fade_in_and_out", { content }); + auto film = new_test_film("audio_content_fade_in_and_out", { content }); auto const stream = content->audio->stream(); auto const length = stream->length(); @@ -164,7 +164,7 @@ BOOST_AUTO_TEST_CASE (audio_content_fade_in_and_out) BOOST_AUTO_TEST_CASE (audio_content_fade_in_with_trim) { auto content = content_factory("test/data/impulse_train.wav")[0]; - auto film = new_test_film2("audio_content_fade_in_with_trim", { content }); + auto film = new_test_film("audio_content_fade_in_with_trim", { content }); auto const stream = content->audio->stream(); @@ -191,7 +191,7 @@ BOOST_AUTO_TEST_CASE (audio_content_fade_in_with_trim) BOOST_AUTO_TEST_CASE (audio_content_fade_out_with_trim) { auto content = content_factory("test/data/impulse_train.wav")[0]; - auto film = new_test_film2("audio_content_fade_out_with_trim", { content }); + auto film = new_test_film("audio_content_fade_out_with_trim", { content }); auto const stream = content->audio->stream(); auto const length = stream->length(); @@ -221,7 +221,7 @@ BOOST_AUTO_TEST_CASE (audio_content_fade_out_with_trim_at_44k1) { /* 5s at 44.1kHz */ auto content = content_factory("test/data/white.wav")[0]; - auto film = new_test_film2("audio_content_fade_out_with_trim_at_44k1", { content }); + auto film = new_test_film("audio_content_fade_out_with_trim_at_44k1", { content }); auto const stream = content->audio->stream(); @@ -253,7 +253,7 @@ BOOST_AUTO_TEST_CASE (audio_content_fade_out_with_trim_at_44k1) BOOST_AUTO_TEST_CASE (audio_content_fades_same_as_video) { auto content = content_factory("test/data/staircase.mov")[0]; - auto film = new_test_film2("audio_content_fades_same_as_video", { content }); + auto film = new_test_film("audio_content_fades_same_as_video", { content }); content->audio->set_use_same_fades_as_video(true); content->video->set_fade_in(9); diff --git a/test/audio_delay_test.cc b/test/audio_delay_test.cc index bafdea4e1..369881d71 100644 --- a/test/audio_delay_test.cc +++ b/test/audio_delay_test.cc @@ -56,7 +56,7 @@ void test_audio_delay (int delay_in_ms) { string const film_name = "audio_delay_test_" + lexical_cast<string> (delay_in_ms); auto content = make_shared<FFmpegContent>("test/data/staircase.wav"); - auto film = new_test_film2 (film_name, { content }); + auto film = new_test_film(film_name, { content }); content->audio->set_delay (delay_in_ms); diff --git a/test/audio_processor_test.cc b/test/audio_processor_test.cc index 4fe5eeb10..8ec829bf1 100644 --- a/test/audio_processor_test.cc +++ b/test/audio_processor_test.cc @@ -41,11 +41,8 @@ using std::make_shared; /** Test the mid-side decoder for analysis and DCP-making */ BOOST_AUTO_TEST_CASE (audio_processor_test) { - auto film = new_test_film ("audio_processor_test"); - film->set_name ("audio_processor_test"); auto c = make_shared<FFmpegContent>("test/data/white.wav"); - film->examine_and_add_content (c); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("audio_processor_test", { c }); film->set_audio_channels(16); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); diff --git a/test/burnt_subtitle_test.cc b/test/burnt_subtitle_test.cc index 8d7dcd143..c3c253d51 100644 --- a/test/burnt_subtitle_test.cc +++ b/test/burnt_subtitle_test.cc @@ -30,7 +30,7 @@ #include "lib/dcp_content.h" #include "lib/dcp_content_type.h" #include "lib/film.h" -#include "lib/ffmpeg_encoder.h" +#include "lib/ffmpeg_film_encoder.h" #include "lib/log_entry.h" #include "lib/ratio.h" #include "lib/text_content.h" @@ -39,9 +39,9 @@ #include <dcp/cpl.h> #include <dcp/reel.h> #include <dcp/j2k_transcode.h> -#include <dcp/mono_picture_asset.h> -#include <dcp/mono_picture_asset_reader.h> -#include <dcp/mono_picture_frame.h> +#include <dcp/mono_j2k_picture_asset.h> +#include <dcp/mono_j2k_picture_asset_reader.h> +#include <dcp/mono_j2k_picture_frame.h> #include <dcp/openjpeg_image.h> #include <dcp/reel_picture_asset.h> #include <dcp/reel_mono_picture_asset.h> @@ -58,15 +58,11 @@ using namespace dcpomatic; /** Build a small DCP with no picture and a single subtitle overlaid onto it from a SubRip file */ BOOST_AUTO_TEST_CASE (burnt_subtitle_test_subrip) { - auto film = new_test_film ("burnt_subtitle_test_subrip"); - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); - film->set_name ("frobozz"); auto content = content_factory("test/data/subrip2.srt")[0]; + auto film = new_test_film("burnt_subtitle_test_subrip", { content }); + film->set_dcp_content_type(DCPContentType::from_isdcf_name("TLR")); content->text[0]->set_use(true); content->text[0]->set_burn(true); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); make_and_verify_dcp( film, { dcp::VerificationNote::Code::MISSING_CPL_METADATA } @@ -82,14 +78,11 @@ BOOST_AUTO_TEST_CASE (burnt_subtitle_test_subrip) /** Build a small DCP with no picture and a single subtitle overlaid onto it from a DCP XML file */ BOOST_AUTO_TEST_CASE (burnt_subtitle_test_dcp) { - auto film = new_test_film ("burnt_subtitle_test_dcp"); - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); - film->set_name ("frobozz"); auto content = content_factory("test/data/dcp_sub.xml")[0]; + auto film = new_test_film("burnt_subtitle_test_dcp", { content }); + film->set_dcp_content_type(DCPContentType::from_isdcf_name("TLR")); + film->set_name("frobozz"); content->text[0]->set_use(true); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); make_and_verify_dcp( film, { @@ -104,26 +97,18 @@ BOOST_AUTO_TEST_CASE (burnt_subtitle_test_dcp) /** Burn some subtitles into an existing DCP to check the colour conversion */ BOOST_AUTO_TEST_CASE (burnt_subtitle_test_onto_dcp) { - auto film = new_test_film ("burnt_subtitle_test_onto_dcp"); - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); - film->set_name ("frobozz"); - film->examine_and_add_content(content_factory("test/data/flat_black.png")[0]); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("burnt_subtitle_test_onto_dcp", { content_factory("test/data/flat_black.png")[0] }); + film->set_dcp_content_type(DCPContentType::from_isdcf_name("TLR")); make_and_verify_dcp (film); Config::instance()->set_log_types (Config::instance()->log_types() | LogEntry::TYPE_DEBUG_ENCODE); - auto film2 = new_test_film ("burnt_subtitle_test_onto_dcp2"); - film2->set_container (Ratio::from_id ("185")); - film2->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); - film2->set_name ("frobozz"); auto background_dcp = make_shared<DCPContent>(film->dir(film->dcp_name())); - film2->examine_and_add_content (background_dcp); auto sub = content_factory("test/data/subrip2.srt")[0]; + auto film2 = new_test_film("burnt_subtitle_test_onto_dcp2", { background_dcp, sub }); + film2->set_dcp_content_type(DCPContentType::from_isdcf_name("TLR")); + film2->set_name("frobozz"); sub->text[0]->set_burn(true); sub->text[0]->set_effect(dcp::Effect::BORDER); - film2->examine_and_add_content (sub); - BOOST_REQUIRE (!wait_for_jobs()); make_and_verify_dcp (film2); BOOST_CHECK (background_dcp->position() == DCPTime()); @@ -137,7 +122,7 @@ BOOST_AUTO_TEST_CASE (burnt_subtitle_test_onto_dcp) BOOST_REQUIRE (dcp.cpls().front()->reels().front()->main_picture()->asset()); auto pic = dynamic_pointer_cast<dcp::ReelMonoPictureAsset> ( dcp.cpls().front()->reels().front()->main_picture() - )->mono_asset(); + )->mono_j2k_asset(); BOOST_REQUIRE (pic); auto frame = pic->start_read()->get_frame(12); auto xyz = frame->xyz_image (); @@ -160,7 +145,7 @@ BOOST_AUTO_TEST_CASE(burnt_subtitle_test_position) { auto const name = String::compose("burnt_subtitle_test_position_%1", alignment); auto subs = content_factory(String::compose("test/data/burn_%1.xml", alignment)); - auto film = new_test_film2(name, subs); + auto film = new_test_film(name, subs); subs[0]->text[0]->set_use(true); subs[0]->text[0]->set_burn(true); make_and_verify_dcp( @@ -193,13 +178,13 @@ BOOST_AUTO_TEST_CASE(burn_empty_subtitle_test) Cleanup cl; auto content = content_factory("test/data/empty_sub.xml")[0]; - auto film = new_test_film2("burnt_empty_subtitle_test", { content }); + auto film = new_test_film("burnt_empty_subtitle_test", { content }); content->text[0]->set_use(true); auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE); auto file = boost::filesystem::path("build") / "test" / "burnt_empty_subtitle_test.mov"; cl.add(file); - FFmpegEncoder encoder(film, job, file, ExportFormat::PRORES_4444, false, false, false, 23); + FFmpegFilmEncoder encoder(film, job, file, ExportFormat::PRORES_4444, false, false, false, 23); encoder.go(); cl.run(); diff --git a/test/butler_test.cc b/test/butler_test.cc index 1c59de798..f7c307e3c 100644 --- a/test/butler_test.cc +++ b/test/butler_test.cc @@ -40,17 +40,9 @@ using namespace dcpomatic; BOOST_AUTO_TEST_CASE (butler_test1) { - auto film = new_test_film ("butler_test1"); - film->set_dcp_content_type (DCPContentType::from_isdcf_name("FTR")); - film->set_name ("butler_test1"); - film->set_container (Ratio::from_id ("185")); - auto video = content_factory("test/data/flat_red.png")[0]; - film->examine_and_add_content (video); auto audio = content_factory("test/data/staircase.wav")[0]; - film->examine_and_add_content (audio); - BOOST_REQUIRE (!wait_for_jobs ()); - + auto film = new_test_film("butler_test1", { video, audio }); film->set_audio_channels (6); /* This is the map of the player output (5.1) to the butler output (also 5.1) */ @@ -96,7 +88,7 @@ BOOST_AUTO_TEST_CASE (butler_test2) { auto content = content_factory(TestPaths::private_data() / "arrietty_JP-EN.mkv"); BOOST_REQUIRE (!content.empty()); - auto film = new_test_film2 ("butler_test2", { content.front() }); + auto film = new_test_film("butler_test2", { content.front() }); BOOST_REQUIRE (content.front()->audio); content.front()->audio->set_delay(100); diff --git a/test/bv20_test.cc b/test/bv20_test.cc index 5530a05d0..d41868601 100644 --- a/test/bv20_test.cc +++ b/test/bv20_test.cc @@ -49,7 +49,8 @@ has_mxf_mca_subdescriptors(shared_ptr<const Film> film) * whether they exist. */ - ASDCP::PCM::MXFReader reader; + Kumu::FileReaderFactory factory; + ASDCP::PCM::MXFReader reader(factory); auto r = reader.OpenRead(find_file(film->dir(film->dcp_name()), "pcm_").string()); BOOST_REQUIRE(!ASDCP_FAILURE(r)); @@ -71,7 +72,7 @@ BOOST_AUTO_TEST_CASE(bv21_extensions_used_when_not_limited) { auto picture = content_factory("test/data/flat_red.png"); auto sound = content_factory("test/data/sine_440.wav"); - auto film = new_test_film2("bv21_extensions_used_when_not_limited", { picture.front(), sound.front() }); + auto film = new_test_film("bv21_extensions_used_when_not_limited", { picture.front(), sound.front() }); make_and_verify_dcp(film); @@ -84,7 +85,7 @@ BOOST_AUTO_TEST_CASE(bv21_extensions_not_used_when_limited) { auto picture = content_factory("test/data/flat_red.png"); auto sound = content_factory("test/data/sine_440.wav"); - auto film = new_test_film2("bv21_extensions_not_used_when_limited", { picture.front(), sound.front () }); + auto film = new_test_film("bv21_extensions_not_used_when_limited", { picture.front(), sound.front () }); film->set_limit_to_smpte_bv20(true); make_and_verify_dcp(film); diff --git a/test/cinema_list_test.cc b/test/cinema_list_test.cc new file mode 100644 index 000000000..46c9d5195 --- /dev/null +++ b/test/cinema_list_test.cc @@ -0,0 +1,226 @@ +/* + Copyright (C) 2023 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic 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. + + DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + + +#include "lib/cinema.h" +#include "lib/cinema_list.h" +#include "lib/config.h" +#include "lib/screen.h" +#include "test.h" +#include <dcp/certificate.h> +#include <dcp/filesystem.h> +#include <dcp/util.h> +#include <boost/filesystem.hpp> +#include <boost/test/unit_test.hpp> +#include <list> +#include <string> + + +using std::pair; +using std::string; +using std::vector; + + +static +boost::filesystem::path +setup(string name) +{ + boost::filesystem::path db = boost::filesystem::path("build") / "test" / (name + ".db"); + boost::system::error_code ec; + boost::filesystem::remove(db, ec); + return db; +} + + +BOOST_AUTO_TEST_CASE(add_cinema_test) +{ + auto const db = setup("add_cinema_test"); + + auto const name = "Bob's Zero-G Cinema"; + auto const emails = vector<string>{"zerogbob@hotmail.com"}; + auto const notes = "Nice enough place but the popcorn keeps floating away"; + auto const utc_offset = dcp::UTCOffset{5, 0}; + + CinemaList cinemas(db); + cinemas.add_cinema({name, emails, notes, utc_offset}); + + CinemaList cinemas2(db); + auto const check = cinemas2.cinemas(); + BOOST_REQUIRE_EQUAL(check.size(), 1U); + BOOST_CHECK(check[0].second.name == name); + BOOST_CHECK(check[0].second.emails == emails); + BOOST_CHECK_EQUAL(check[0].second.notes, notes); + BOOST_CHECK(check[0].second.utc_offset == utc_offset); +} + + +BOOST_AUTO_TEST_CASE(remove_cinema_test) +{ + auto const db = setup("remove_cinema_test"); + + auto const name1 = "Bob's Zero-G Cinema"; + auto const emails1 = vector<string>{"zerogbob@hotmail.com"}; + auto const notes1 = "Nice enough place but the popcorn keeps floating away"; + auto const utc_offset1 = dcp::UTCOffset{-4, -30}; + + auto const name2 = "Angie's Infinite-Screen Cinema"; + auto const emails2 = vector<string>{"angie@infinitium.com", "projection-screen912341235@infinitium.com"}; + auto const notes2 = "Nice enough place but it's very hard to find the right screen"; + auto const utc_offset2 = dcp::UTCOffset{9, 0}; + + CinemaList cinemas(db); + auto const id1 = cinemas.add_cinema({name1, emails1, notes1, utc_offset1}); + cinemas.add_cinema({name2, emails2, notes2, utc_offset2}); + + auto const check = cinemas.cinemas(); + BOOST_REQUIRE_EQUAL(check.size(), 2U); + BOOST_CHECK(check[0].second.name == name2); + BOOST_CHECK(check[0].second.emails == emails2); + BOOST_CHECK_EQUAL(check[0].second.notes, notes2); + BOOST_CHECK(check[0].second.utc_offset == utc_offset2); + BOOST_CHECK(check[1].second.name == name1); + BOOST_CHECK(check[1].second.emails == emails1); + BOOST_CHECK_EQUAL(check[1].second.notes, notes1); + BOOST_CHECK(check[1].second.utc_offset == utc_offset1); + + cinemas.remove_cinema(id1); + + auto const check2 = cinemas.cinemas(); + BOOST_REQUIRE_EQUAL(check2.size(), 1U); + BOOST_CHECK(check2[0].second.name == name2); + BOOST_CHECK(check2[0].second.emails == emails2); + BOOST_CHECK_EQUAL(check2[0].second.notes, notes2); +} + + +BOOST_AUTO_TEST_CASE(update_cinema_test) +{ + auto const db = setup("update_cinema_test"); + + auto const name1 = "Bob's Zero-G Cinema"; + auto const emails1 = vector<string>{"zerogbob@hotmail.com"}; + auto const notes1 = "Nice enough place but the popcorn keeps floating away"; + auto const utc_offset1 = dcp::UTCOffset{-4, -30}; + + auto const name2 = "Angie's Infinite-Screen Cinema"; + auto const emails2 = vector<string>{"angie@infinitium.com", "projection-screen912341235@infinitium.com"}; + auto const notes2 = "Nice enough place but it's very hard to find the right screen"; + auto const utc_offset2 = dcp::UTCOffset{9, 0}; + + CinemaList cinemas(db); + auto const id = cinemas.add_cinema({name1, emails1, notes1, utc_offset1}); + cinemas.add_cinema({name2, emails2, notes2, utc_offset2}); + + auto check = cinemas.cinemas(); + BOOST_REQUIRE_EQUAL(check.size(), 2U); + /* Alphabetically ordered so first is 2 */ + BOOST_CHECK_EQUAL(check[0].second.name, name2); + BOOST_CHECK(check[0].second.emails == emails2); + BOOST_CHECK_EQUAL(check[0].second.notes, notes2); + BOOST_CHECK(check[0].second.utc_offset == utc_offset2); + /* Then 1 */ + BOOST_CHECK_EQUAL(check[1].second.name, name1); + BOOST_CHECK(check[1].second.emails == emails1); + BOOST_CHECK_EQUAL(check[1].second.notes, notes1); + BOOST_CHECK(check[1].second.utc_offset == utc_offset1); + + cinemas.update_cinema(id, Cinema{name1, vector<string>{"bob@zerogkino.com"}, notes1, utc_offset1}); + + check = cinemas.cinemas(); + BOOST_REQUIRE_EQUAL(check.size(), 2U); + BOOST_CHECK_EQUAL(check[0].second.name, name2); + BOOST_CHECK(check[0].second.emails == emails2); + BOOST_CHECK_EQUAL(check[0].second.notes, notes2); + BOOST_CHECK(check[0].second.utc_offset == utc_offset2); + BOOST_CHECK_EQUAL(check[1].second.name, name1); + BOOST_CHECK(check[1].second.emails == vector<string>{"bob@zerogkino.com"}); + BOOST_CHECK_EQUAL(check[1].second.notes, notes1); + BOOST_CHECK(check[1].second.utc_offset == utc_offset1); +} + + +BOOST_AUTO_TEST_CASE(add_screen_test) +{ + auto const db = setup("add_screen_test"); + + CinemaList cinemas(db); + auto const cinema_id = cinemas.add_cinema({"Name", { "foo@bar.com" }, "", dcp::UTCOffset()}); + auto const screen_id = cinemas.add_screen( + cinema_id, + dcpomatic::Screen( + "Screen 1", + "Smells of popcorn", + dcp::Certificate(dcp::file_to_string("test/data/cert.pem")), + string("test/data/cert.pem"), + vector<TrustedDevice>{} + )); + + auto check = cinemas.screens(cinema_id); + BOOST_REQUIRE_EQUAL(check.size(), 1U); + BOOST_CHECK(check[0].first == screen_id); + BOOST_CHECK_EQUAL(check[0].second.name, "Screen 1"); + BOOST_CHECK_EQUAL(check[0].second.notes, "Smells of popcorn"); + BOOST_CHECK(check[0].second.recipient == dcp::Certificate(dcp::file_to_string("test/data/cert.pem"))); + BOOST_CHECK(check[0].second.recipient_file == string("test/data/cert.pem")); +} + + +BOOST_AUTO_TEST_CASE(cinemas_list_copy_from_xml_test) +{ + ConfigRestorer cr("build/test/cinemas_list_copy_config"); + + dcp::filesystem::remove_all(*Config::override_path); + dcp::filesystem::create_directories(*Config::override_path); + dcp::filesystem::copy_file("test/data/cinemas2.xml", *Config::override_path / "cinemas2.xml"); + + CinemaList cinema_list; + cinema_list.read_legacy_file(Config::instance()->read_path("cinemas2.xml")); + auto cinemas = cinema_list.cinemas(); + BOOST_REQUIRE_EQUAL(cinemas.size(), 3U); + + auto cinema_iter = cinemas.begin(); + BOOST_CHECK_EQUAL(cinema_iter->second.name, "Great"); + BOOST_CHECK_EQUAL(cinema_iter->second.emails.size(), 1U); + BOOST_CHECK_EQUAL(cinema_iter->second.emails[0], "julie@tinyscreen.com"); + BOOST_CHECK(cinema_iter->second.utc_offset == dcp::UTCOffset(1, 0)); + ++cinema_iter; + + BOOST_CHECK_EQUAL(cinema_iter->second.name, "classy joint"); + BOOST_CHECK_EQUAL(cinema_iter->second.notes, "Can't stand this place"); + ++cinema_iter; + + BOOST_CHECK_EQUAL(cinema_iter->second.name, "stinking dump"); + BOOST_CHECK_EQUAL(cinema_iter->second.emails.size(), 2U); + BOOST_CHECK_EQUAL(cinema_iter->second.emails[0], "bob@odourscreen.com"); + BOOST_CHECK_EQUAL(cinema_iter->second.emails[1], "alice@whiff.com"); + BOOST_CHECK_EQUAL(cinema_iter->second.notes, "Great cinema, smells of roses"); + BOOST_CHECK(cinema_iter->second.utc_offset == dcp::UTCOffset(-7, 0)); + auto screens = cinema_list.screens(cinema_iter->first); + BOOST_CHECK_EQUAL(screens.size(), 2U); + auto screen_iter = screens.begin(); + BOOST_CHECK_EQUAL(screen_iter->second.name, "1"); + BOOST_CHECK(screen_iter->second.recipient); + BOOST_CHECK_EQUAL(screen_iter->second.recipient->subject_dn_qualifier(), "CVsuuv9eYsQZSl8U4fDpvOmzZhI="); + ++screen_iter; + BOOST_CHECK_EQUAL(screen_iter->second.name, "2"); + BOOST_CHECK(screen_iter->second.recipient); + BOOST_CHECK_EQUAL(screen_iter->second.recipient->subject_dn_qualifier(), "CVsuuv9eYsQZSl8U4fDpvOmzZhI="); +} + diff --git a/test/client_server_test.cc b/test/client_server_test.cc index 596668aae..43084bf31 100644 --- a/test/client_server_test.cc +++ b/test/client_server_test.cc @@ -20,21 +20,20 @@ /** @file test/client_server_test.cc - * @brief Test the server class. + * @brief Test the remote encoding code. * @ingroup feature - * - * Create a test image and then encode it using the standard mechanism - * and also using a EncodeServer object running on localhost. Compare the resulting - * encoded data to check that they are the same. */ +#include "lib/content_factory.h" #include "lib/cross.h" #include "lib/dcp_video.h" #include "lib/dcpomatic_log.h" #include "lib/encode_server.h" #include "lib/encode_server_description.h" +#include "lib/encode_server_finder.h" #include "lib/file_log.h" +#include "lib/film.h" #include "lib/image.h" #include "lib/j2k_image_proxy.h" #include "lib/player_video.h" @@ -51,6 +50,7 @@ using std::weak_ptr; using boost::thread; using boost::optional; using dcp::ArrayData; +using namespace dcpomatic; void @@ -105,7 +105,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb) ColourConversion(), VideoRange::FULL, weak_ptr<Content>(), - optional<Frame>(), + optional<ContentTime>(), false ); @@ -184,7 +184,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv) ColourConversion(), VideoRange::FULL, weak_ptr<Content>(), - optional<Frame>(), + optional<ContentTime>(), false ); @@ -250,7 +250,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k) ColourConversion(), VideoRange::FULL, weak_ptr<Content>(), - optional<Frame>(), + optional<ContentTime>(), false ); @@ -275,7 +275,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k) PresetColourConversion::all().front().conversion, VideoRange::FULL, weak_ptr<Content>(), - optional<Frame>(), + optional<ContentTime>(), false ); @@ -312,6 +312,32 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k) server->stop (); server_thread.join(); + + EncodeServerFinder::drop(); } +BOOST_AUTO_TEST_CASE(real_encode_with_server) +{ + Cleanup cl; + + auto content = content_factory(TestPaths::private_data() / "dolby_aurora.vob"); + auto film = new_test_film("real_encode_with_server", content, &cl); + film->set_interop(false); + + EncodeServerFinder::instance(); + + EncodeServer server(true, 4); + thread server_thread(boost::bind(&EncodeServer::run, &server)); + + make_and_verify_dcp(film); + + server.stop(); + server_thread.join(); + + BOOST_CHECK(server.frames_encoded() > 0); + EncodeServerFinder::drop(); + + cl.run(); +} + diff --git a/test/closed_caption_test.cc b/test/closed_caption_test.cc index 313e2a8d3..1a9531f4a 100644 --- a/test/closed_caption_test.cc +++ b/test/closed_caption_test.cc @@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE (closed_caption_test1) Cleanup cl; auto content = make_shared<StringTextFileContent>("test/data/subrip.srt"); - auto film = new_test_film2 ("closed_caption_test1", { content }, &cl); + auto film = new_test_film("closed_caption_test1", { content }, &cl); content->only_text()->set_type (TextType::CLOSED_CAPTION); @@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE (closed_caption_test2) auto content1 = make_shared<StringTextFileContent>("test/data/subrip.srt"); auto content2 = make_shared<StringTextFileContent>("test/data/subrip2.srt"); auto content3 = make_shared<StringTextFileContent>("test/data/subrip3.srt"); - auto film = new_test_film2 ("closed_caption_test2", { content1, content2, content3 }, &cl); + auto film = new_test_film("closed_caption_test2", { content1, content2, content3 }, &cl); content1->only_text()->set_type (TextType::CLOSED_CAPTION); content1->only_text()->set_dcp_track (DCPTextTrack("First track", dcp::LanguageTag("fr-FR"))); diff --git a/test/config_test.cc b/test/config_test.cc index 103a6a585..5d94f1ff1 100644 --- a/test/config_test.cc +++ b/test/config_test.cc @@ -20,7 +20,12 @@ #include "lib/cinema.h" +#include "lib/cinema_list.h" #include "lib/config.h" +#include "lib/dkdm_recipient.h" +#include "lib/dkdm_recipient_list.h" +#include "lib/unzipper.h" +#include "lib/zipper.h" #include "test.h" #include <boost/test/unit_test.hpp> #include <fstream> @@ -38,7 +43,7 @@ rewrite_bad_config (string filename, string extra_line) { using namespace boost::filesystem; - auto base = path("build/test/bad_config/2.16"); + auto base = path("build/test/bad_config/2.18"); auto file = base / filename; boost::system::error_code ec; @@ -59,10 +64,7 @@ rewrite_bad_config (string filename, string extra_line) BOOST_AUTO_TEST_CASE (config_backup_test) { - ConfigRestorer cr; - - Config::override_path = "build/test/bad_config"; - Config::drop(); + ConfigRestorer cr("build/test/bad_config"); boost::filesystem::remove_all ("build/test/bad_config"); /* Write an invalid config file to config.xml */ @@ -73,47 +75,49 @@ BOOST_AUTO_TEST_CASE (config_backup_test) */ Config::instance(); - BOOST_CHECK ( boost::filesystem::exists("build/test/bad_config/2.16/config.xml.1")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.1") == first_write_xml); - BOOST_CHECK (!boost::filesystem::exists("build/test/bad_config/2.16/config.xml.2")); - BOOST_CHECK (!boost::filesystem::exists("build/test/bad_config/2.16/config.xml.3")); - BOOST_CHECK (!boost::filesystem::exists("build/test/bad_config/2.16/config.xml.4")); + boost::filesystem::path const prefix = "build/test/bad_config/2.18"; + + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.1")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.1") == first_write_xml); + BOOST_CHECK(!boost::filesystem::exists(prefix / "config.xml.2")); + BOOST_CHECK(!boost::filesystem::exists(prefix / "config.xml.3")); + BOOST_CHECK(!boost::filesystem::exists(prefix / "config.xml.4")); Config::drop(); auto const second_write_xml = rewrite_bad_config("config.xml", "second write"); Config::instance(); - BOOST_CHECK ( boost::filesystem::exists("build/test/bad_config/2.16/config.xml.1")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.1") == first_write_xml); - BOOST_CHECK ( boost::filesystem::exists("build/test/bad_config/2.16/config.xml.2")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.2") == second_write_xml); - BOOST_CHECK (!boost::filesystem::exists("build/test/bad_config/2.16/config.xml.3")); - BOOST_CHECK (!boost::filesystem::exists("build/test/bad_config/2.16/config.xml.4")); + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.1")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.1") == first_write_xml); + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.2")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.2") == second_write_xml); + BOOST_CHECK(!boost::filesystem::exists(prefix / "config.xml.3")); + BOOST_CHECK(!boost::filesystem::exists(prefix / "config.xml.4")); Config::drop(); auto const third_write_xml = rewrite_bad_config("config.xml", "third write"); Config::instance(); - BOOST_CHECK ( boost::filesystem::exists("build/test/bad_config/2.16/config.xml.1")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.1") == first_write_xml); - BOOST_CHECK ( boost::filesystem::exists("build/test/bad_config/2.16/config.xml.2")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.2") == second_write_xml); - BOOST_CHECK ( boost::filesystem::exists("build/test/bad_config/2.16/config.xml.3")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.3") == third_write_xml); - BOOST_CHECK (!boost::filesystem::exists("build/test/bad_config/2.16/config.xml.4")); + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.1")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.1") == first_write_xml); + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.2")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.2") == second_write_xml); + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.3")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.3") == third_write_xml); + BOOST_CHECK(!boost::filesystem::exists(prefix / "config.xml.4")); Config::drop(); auto const fourth_write_xml = rewrite_bad_config("config.xml", "fourth write"); Config::instance(); - BOOST_CHECK (boost::filesystem::exists("build/test/bad_config/2.16/config.xml.1")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.1") == first_write_xml); - BOOST_CHECK (boost::filesystem::exists("build/test/bad_config/2.16/config.xml.2")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.2") == second_write_xml); - BOOST_CHECK (boost::filesystem::exists("build/test/bad_config/2.16/config.xml.3")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.3") == third_write_xml); - BOOST_CHECK (boost::filesystem::exists("build/test/bad_config/2.16/config.xml.4")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.4") == fourth_write_xml); + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.1")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.1") == first_write_xml); + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.2")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.2") == second_write_xml); + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.3")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.3") == third_write_xml); + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.4")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.4") == fourth_write_xml); } @@ -121,13 +125,10 @@ BOOST_AUTO_TEST_CASE (config_backup_with_link_test) { using namespace boost::filesystem; - ConfigRestorer cr; - auto base = path("build/test/bad_config"); - auto version = base / "2.16"; + auto version = base / "2.18"; - Config::override_path = base; - Config::drop(); + ConfigRestorer cr(base); boost::filesystem::remove_all (base); @@ -151,91 +152,121 @@ BOOST_AUTO_TEST_CASE (config_backup_with_link_test) BOOST_AUTO_TEST_CASE (config_write_utf8_test) { - ConfigRestorer cr; + ConfigRestorer cr("build/test"); boost::filesystem::remove_all ("build/test/config.xml"); boost::filesystem::copy_file ("test/data/utf8_config.xml", "build/test/config.xml"); - Config::override_path = "build/test"; - Config::drop (); Config::instance()->write(); check_text_file ("test/data/utf8_config.xml", "build/test/config.xml"); } -BOOST_AUTO_TEST_CASE (config_upgrade_test) +/* 2.14 -> 2.18 */ +BOOST_AUTO_TEST_CASE (config_upgrade_test1) { - ConfigRestorer cr; - boost::filesystem::path dir = "build/test/config_upgrade_test"; - Config::override_path = dir; - Config::drop (); + ConfigRestorer cr(dir); + boost::filesystem::remove_all (dir); boost::filesystem::create_directories (dir); boost::filesystem::copy_file ("test/data/2.14.config.xml", dir / "config.xml"); boost::filesystem::copy_file ("test/data/2.14.cinemas.xml", dir / "cinemas.xml"); - Config::instance(); try { - /* This will fail to write cinemas.xml since the link is to a non-existent directory */ - Config::instance()->write(); + /* This will fail to read cinemas.xml since the link is to a non-existent directory */ + Config::instance(); } catch (...) {} + Config::instance()->write(); + check_xml (dir / "config.xml", "test/data/2.14.config.xml", {}); check_xml (dir / "cinemas.xml", "test/data/2.14.cinemas.xml", {}); #ifdef DCPOMATIC_WINDOWS /* This file has the windows path for dkdm_recipients.xml (with backslashes) */ - check_xml (dir / "2.16" / "config.xml", "test/data/2.16.config.windows.xml", {}); + check_xml(dir / "2.18" / "config.xml", "test/data/2.18.config.windows.sqlite.xml", {}); #else - check_xml (dir / "2.16" / "config.xml", "test/data/2.16.config.xml", {}); + check_xml(dir / "2.18" / "config.xml", "test/data/2.18.config.sqlite.xml", {}); #endif - /* cinemas.xml is not copied into 2.16 as its format has not changed */ - BOOST_REQUIRE (!boost::filesystem::exists(dir / "2.16" / "cinemas.xml")); + /* cinemas.xml is not copied into 2.18 as its format has not changed */ + BOOST_REQUIRE (!boost::filesystem::exists(dir / "2.18" / "cinemas.xml")); } -BOOST_AUTO_TEST_CASE (config_keep_cinemas_if_making_new_config) +/* 2.16 -> 2.18 */ +BOOST_AUTO_TEST_CASE (config_upgrade_test2) { - ConfigRestorer cr; + boost::filesystem::path dir = "build/test/config_upgrade_test"; + ConfigRestorer cr(dir); + boost::filesystem::remove_all (dir); + boost::filesystem::create_directories (dir); + +#ifdef DCPOMATIC_WINDOWS + boost::filesystem::copy_file("test/data/2.16.config.windows.xml", dir / "config.xml"); +#else + boost::filesystem::copy_file("test/data/2.16.config.xml", dir / "config.xml"); +#endif + boost::filesystem::copy_file("test/data/2.14.cinemas.xml", dir / "cinemas.xml"); + try { + /* This will fail to read cinemas.xml since the link is to a non-existent directory */ + Config::instance(); + } catch (...) {} + + Config::instance()->write(); + + check_xml(dir / "cinemas.xml", "test/data/2.14.cinemas.xml", {}); +#ifdef DCPOMATIC_WINDOWS + /* This file has the windows path for dkdm_recipients.xml (with backslashes) */ + check_xml(dir / "2.18" / "config.xml", "test/data/2.18.config.windows.xml", {}); + check_xml(dir / "config.xml", "test/data/2.16.config.windows.xml", {}); +#else + check_xml(dir / "2.18" / "config.xml", "test/data/2.18.config.xml", {}); + check_xml(dir / "config.xml", "test/data/2.16.config.xml", {}); +#endif + /* cinemas.xml is not copied into 2.18 as its format has not changed */ + BOOST_REQUIRE (!boost::filesystem::exists(dir / "2.18" / "cinemas.xml")); +} + +BOOST_AUTO_TEST_CASE (config_keep_cinemas_if_making_new_config) +{ boost::filesystem::path dir = "build/test/config_keep_cinemas_if_making_new_config"; - Config::override_path = dir; - Config::drop (); + ConfigRestorer cr(dir); boost::filesystem::remove_all (dir); boost::filesystem::create_directories (dir); Config::instance()->write(); - Config::instance()->add_cinema(make_shared<Cinema>("My Great Cinema", vector<string>(), "", 0, 0)); - Config::instance()->write(); + CinemaList cinemas; + cinemas.add_cinema({"My Great Cinema", {}, "", dcp::UTCOffset()}); - boost::filesystem::copy_file (dir / "cinemas.xml", dir / "backup_for_test.xml"); + boost::filesystem::copy_file(dir / "cinemas.sqlite3", dir / "backup_for_test.sqlite3"); Config::drop (); - boost::filesystem::remove (dir / "2.16" / "config.xml"); + boost::filesystem::remove (dir / "2.18" / "config.xml"); Config::instance(); - check_text_file(dir / "backup_for_test.xml", dir / "cinemas.xml"); + check_file(dir / "backup_for_test.sqlite3", dir / "cinemas.sqlite3"); } BOOST_AUTO_TEST_CASE(keep_config_if_cinemas_fail_to_load) { - ConfigRestorer cr; - /* Make a new config */ boost::filesystem::path dir = "build/test/keep_config_if_cinemas_fail_to_load"; - Config::override_path = dir; - Config::drop(); + ConfigRestorer cr(dir); boost::filesystem::remove_all(dir); boost::filesystem::create_directories(dir); Config::instance()->write(); - auto const cinemas = dir / "cinemas.xml"; + CinemaList cinema_list; + cinema_list.add_cinema(Cinema("Foo", {}, "Bar", dcp::UTCOffset())); + + auto const cinemas = dir / "cinemas.sqlite3"; /* Back things up */ - boost::filesystem::copy_file(dir / "2.16" / "config.xml", dir / "config_backup_for_test.xml"); - boost::filesystem::copy_file(cinemas, dir / "cinemas_backup_for_test.xml"); + boost::filesystem::copy_file(dir / "2.18" / "config.xml", dir / "config_backup_for_test.xml"); + boost::filesystem::copy_file(cinemas, dir / "cinemas_backup_for_test.sqlite3"); /* Corrupt the cinemas */ Config::drop(); @@ -244,8 +275,282 @@ BOOST_AUTO_TEST_CASE(keep_config_if_cinemas_fail_to_load) corrupt.close(); Config::instance(); - /* We should have a new cinemas.xml and the old config.xml */ - check_text_file(dir / "2.16" / "config.xml", dir / "config_backup_for_test.xml"); - check_text_file(cinemas, dir / "cinemas_backup_for_test.xml"); + /* We should have the old config.xml */ + check_text_file(dir / "2.18" / "config.xml", dir / "config_backup_for_test.xml"); } + +BOOST_AUTO_TEST_CASE(read_cinemas_xml_and_write_sqlite) +{ + /* Set up a config with an XML cinemas file */ + boost::filesystem::path dir = "build/test/read_cinemas_xml_and_write_sqlite"; + boost::filesystem::remove_all(dir); + boost::filesystem::create_directories(dir); + boost::filesystem::create_directories(dir / "2.18"); + + boost::filesystem::copy_file("test/data/cinemas.xml", dir / "cinemas.xml"); + boost::filesystem::copy_file("test/data/2.18.config.xml", dir / "2.18" / "config.xml"); + { + Editor editor(dir / "2.18" / "config.xml"); + editor.replace( + "/home/realldoesnt/exist/this/path/is/nonsense.sqlite3", + boost::filesystem::canonical(dir / "cinemas.xml").string() + ); + } + + ConfigRestorer cr(dir); + + /* This should make a sqlite3 file containing the recipients from cinemas.xml */ + Config::instance(); + + { + CinemaList test(dir / "cinemas.sqlite3"); + + /* The detailed creation of sqlite3 from XML is tested in cinema_list_test.cc */ + auto cinemas = test.cinemas(); + BOOST_REQUIRE_EQUAL(cinemas.size(), 3U); + BOOST_CHECK_EQUAL(cinemas[0].second.name, "Great"); + BOOST_CHECK_EQUAL(cinemas[1].second.name, "classy joint"); + BOOST_CHECK_EQUAL(cinemas[2].second.name, "stinking dump"); + + /* Add another recipient to the sqlite */ + test.add_cinema({"The ol' 1-seater", {}, "Quiet but lonely", dcp::UTCOffset()}); + } + + /* Reload the config; the old XML should not clobber the new sqlite3 */ + Config::drop(); + Config::instance(); + + { + CinemaList test(dir / "cinemas.sqlite3"); + + auto cinemas = test.cinemas(); + BOOST_REQUIRE_EQUAL(cinemas.size(), 4U); + BOOST_CHECK_EQUAL(cinemas[0].second.name, "Great"); + BOOST_CHECK_EQUAL(cinemas[1].second.name, "The ol' 1-seater"); + BOOST_CHECK_EQUAL(cinemas[2].second.name, "classy joint"); + BOOST_CHECK_EQUAL(cinemas[3].second.name, "stinking dump"); + } +} + + +BOOST_AUTO_TEST_CASE(read_dkdm_recipients_xml_and_write_sqlite) +{ + /* Set up a config with an XML cinemas file */ + boost::filesystem::path dir = "build/test/read_dkdm_recipients_xml_and_write_sqlite"; + boost::filesystem::remove_all(dir); + boost::filesystem::create_directories(dir); + boost::filesystem::create_directories(dir / "2.18"); + + boost::filesystem::copy_file("test/data/dkdm_recipients.xml", dir / "dkdm_recipients.xml"); + boost::filesystem::copy_file("test/data/2.18.config.xml", dir / "2.18" / "config.xml"); + { + Editor editor(dir / "2.18" / "config.xml"); + editor.replace( + "build/test/config_upgrade_test/dkdm_recipients.xml", + boost::filesystem::canonical(dir / "dkdm_recipients.xml").string() + ); + } + + ConfigRestorer cr(dir); + + /* This should make a sqlite3 file containing the recipients from dkdm_recipients.xml */ + Config::instance(); + + { + DKDMRecipientList test(dir / "dkdm_recipients.sqlite3"); + + /* The detailed creation of sqlite3 from XML is tested in dkdm_recipient_list_test.cc */ + auto recipients = test.dkdm_recipients(); + BOOST_REQUIRE_EQUAL(recipients.size(), 2U); + BOOST_CHECK_EQUAL(recipients[0].second.name, "Bob's Epics"); + BOOST_CHECK_EQUAL(recipients[1].second.name, "Sharon's Shorts"); + + /* Add another recipient to the sqlite */ + test.add_dkdm_recipient({"Carl's Classics", "Oldies but goodies", {}, {}}); + } + + /* Reload the config; the old XML should not clobber the new sqlite3 */ + Config::drop(); + Config::instance(); + + { + DKDMRecipientList test(dir / "dkdm_recipients.sqlite3"); + + auto recipients = test.dkdm_recipients(); + BOOST_REQUIRE_EQUAL(recipients.size(), 3U); + BOOST_CHECK_EQUAL(recipients[0].second.name, "Bob's Epics"); + BOOST_CHECK_EQUAL(recipients[1].second.name, "Carl's Classics"); + BOOST_CHECK_EQUAL(recipients[2].second.name, "Sharon's Shorts"); + } +} + + +BOOST_AUTO_TEST_CASE(save_config_as_zip_test) +{ + boost::filesystem::path const dir = "build/test/save_config_as_zip_test"; + ConfigRestorer cr(dir); + boost::system::error_code ec; + boost::filesystem::remove_all(dir, ec); + boost::filesystem::create_directories(dir); + boost::filesystem::copy_file("test/data/2.18.config.xml", dir / "config.xml"); + + Config::instance()->set_cinemas_file(dir / "cinemas.sqlite3"); + Config::instance()->set_dkdm_recipients_file(dir / "dkdm_recipients.sqlite3"); + + CinemaList cinemas; + cinemas.add_cinema({"My Great Cinema", {}, "", dcp::UTCOffset()}); + DKDMRecipientList recipients; + recipients.add_dkdm_recipient({"Carl's Classics", "Oldies but goodies", {}, {}}); + + boost::filesystem::path const zip = "build/test/save.zip"; + boost::filesystem::remove(zip, ec); + save_all_config_as_zip(zip); + Unzipper unzipper(zip); + + BOOST_CHECK(unzipper.contains("config.xml")); + BOOST_CHECK(unzipper.contains("cinemas.sqlite3")); + BOOST_CHECK(unzipper.contains("dkdm_recipients.sqlite3")); +} + + +/** Load a config ZIP file, which contains an XML cinemas file, and ask to overwrite + * the existing cinemas file that we had. + */ +BOOST_AUTO_TEST_CASE(load_config_from_zip_with_only_xml_current) +{ + ConfigRestorer cr; + + auto cinemas_file = Config::instance()->cinemas_file(); + + boost::filesystem::path const zip = "build/test/load.zip"; + boost::system::error_code ec; + boost::filesystem::remove(zip, ec); + + Zipper zipper(zip); + zipper.add( + "config.xml", + boost::algorithm::replace_all_copy( + dcp::file_to_string("test/data/2.18.config.xml"), + "/home/realldoesnt/exist/this/path/is/nonsense.xml", + "" + ) + ); + + zipper.add("cinemas.xml", dcp::file_to_string("test/data/cinemas.xml")); + zipper.close(); + + Config::instance()->load_from_zip(zip, Config::CinemasAction::WRITE_TO_CURRENT_PATH); + + CinemaList cinema_list(cinemas_file); + auto cinemas = cinema_list.cinemas(); + BOOST_REQUIRE_EQUAL(cinemas.size(), 3U); + BOOST_CHECK_EQUAL(cinemas[0].second.name, "Great"); + BOOST_CHECK_EQUAL(cinemas[1].second.name, "classy joint"); + BOOST_CHECK_EQUAL(cinemas[2].second.name, "stinking dump"); +} + + +/** Load a config ZIP file, which contains an XML cinemas file, and ask to write it to + * the location specified by the zipped config.xml. + */ +BOOST_AUTO_TEST_CASE(load_config_from_zip_with_only_xml_zip) +{ + ConfigRestorer cr; + + boost::filesystem::path const zip = "build/test/load.zip"; + boost::system::error_code ec; + boost::filesystem::remove(zip, ec); + + Zipper zipper(zip); + zipper.add( + "config.xml", + boost::algorithm::replace_all_copy( + dcp::file_to_string("test/data/2.18.config.xml"), + "/home/realldoesnt/exist/this/path/is/nonsense.sqlite3", + "build/test/hide/it/here/cinemas.sqlite3" + ) + ); + + zipper.add("cinemas.xml", dcp::file_to_string("test/data/cinemas.xml")); + zipper.close(); + + Config::instance()->load_from_zip(zip, Config::CinemasAction::WRITE_TO_PATH_IN_ZIPPED_CONFIG); + + CinemaList cinema_list("build/test/hide/it/here/cinemas.sqlite3"); + auto cinemas = cinema_list.cinemas(); + BOOST_REQUIRE_EQUAL(cinemas.size(), 3U); + BOOST_CHECK_EQUAL(cinemas[0].second.name, "Great"); + BOOST_CHECK_EQUAL(cinemas[1].second.name, "classy joint"); + BOOST_CHECK_EQUAL(cinemas[2].second.name, "stinking dump"); +} + + +/** Load a config ZIP file, which contains an XML cinemas file, and ask to ignore it */ +BOOST_AUTO_TEST_CASE(load_config_from_zip_with_only_xml_ignore) +{ + ConfigRestorer cr; + + CinemaList cinema_list("build/test/hide/it/here/cinemas.sqlite3"); + cinema_list.add_cinema(Cinema("Foo", {}, "Bar", dcp::UTCOffset())); + + boost::filesystem::path const zip = "build/test/load.zip"; + boost::system::error_code ec; + boost::filesystem::remove(zip, ec); + + Zipper zipper(zip); + zipper.add( + "config.xml", + boost::algorithm::replace_all_copy( + dcp::file_to_string("test/data/2.18.config.xml"), + "/home/realldoesnt/exist/this/path/is/nonsense.xml", + "build/test/hide/it/here/cinemas.sqlite3" + ) + ); + + zipper.add("cinemas.xml", "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Cinemas/>"); + zipper.close(); + + Config::instance()->load_from_zip(zip, Config::CinemasAction::IGNORE); + + auto cinemas = cinema_list.cinemas(); + BOOST_CHECK(!cinemas.empty()); +} + + +BOOST_AUTO_TEST_CASE(use_sqlite_if_present) +{ + /* Set up a config with an XML cinemas file */ + boost::filesystem::path dir = "build/test/read_cinemas_xml_and_write_sqlite"; + boost::filesystem::remove_all(dir); + boost::filesystem::create_directories(dir); + boost::filesystem::create_directories(dir / "2.18"); + + boost::filesystem::copy_file("test/data/cinemas.xml", dir / "cinemas.xml"); + boost::filesystem::copy_file("test/data/2.18.config.xml", dir / "2.18" / "config.xml"); + { + Editor editor(dir / "2.18" / "config.xml"); + editor.replace( + "/home/realldoesnt/exist/this/path/is/nonsense.sqlite3", + boost::filesystem::canonical(dir / "cinemas.xml").string() + ); + } + + ConfigRestorer cr(dir); + + /* This should make a sqlite3 file containing the recipients from cinemas.xml. + * But it won't write config.xml, so config.xml will still point to cinemas.xml. + * This also happens in real life - but I'm not sure how (perhaps just when DoM is + * loaded but doesn't save the config, and then another tool is loaded). + */ + Config::instance(); + + BOOST_CHECK(boost::filesystem::exists(dir / "cinemas.sqlite3")); + + Config::drop(); + + BOOST_CHECK(Config::instance()->cinemas_file() == boost::filesystem::canonical(dir / "cinemas.sqlite3")); +} + + + diff --git a/test/content_test.cc b/test/content_test.cc index 5ab714b47..b9a25a02b 100644 --- a/test/content_test.cc +++ b/test/content_test.cc @@ -41,15 +41,9 @@ using namespace dcpomatic; /** There has been garbled audio with this piece of content */ BOOST_AUTO_TEST_CASE (content_test1) { - auto film = new_test_film ("content_test1"); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); - film->set_name ("content_test1"); - film->set_container (Ratio::from_id ("185")); - film->set_audio_channels(16); - auto content = content_factory(TestPaths::private_data() / "demo_sound_bug.mkv")[0]; - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs ()); + auto film = new_test_film("content_test1", { content }); + film->set_audio_channels(16); make_and_verify_dcp ( film, { dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE } @@ -65,7 +59,7 @@ BOOST_AUTO_TEST_CASE (content_test1) BOOST_AUTO_TEST_CASE (content_test2) { auto content = content_factory("test/data/red_23976.mp4")[0]; - auto film = new_test_film2 ("content_test2", {content}); + auto film = new_test_film("content_test2", {content}); content->set_trim_start(film, ContentTime::from_seconds(0.5)); make_and_verify_dcp (film); } @@ -75,7 +69,7 @@ BOOST_AUTO_TEST_CASE (content_test2) BOOST_AUTO_TEST_CASE (content_test3) { auto content = content_factory("test/data/red_24.mp4")[0]; - auto film = new_test_film2 ("content_test3", {content}); + auto film = new_test_film("content_test3", {content}); film->set_sequence (false); /* Trim */ @@ -117,7 +111,7 @@ BOOST_AUTO_TEST_CASE (content_test3) /** Content containing video will have its length rounded to the nearest video frame */ BOOST_AUTO_TEST_CASE (content_test4) { - auto film = new_test_film2 ("content_test4"); + auto film = new_test_film("content_test4"); auto video = content_factory("test/data/count300bd24.m2ts")[0]; film->examine_and_add_content (video); @@ -132,7 +126,7 @@ BOOST_AUTO_TEST_CASE (content_test4) BOOST_AUTO_TEST_CASE (content_test5) { auto audio = content_factory("test/data/sine_16_48_220_10.wav"); - auto film = new_test_film2 ("content_test5", audio); + auto film = new_test_film("content_test5", audio); audio[0]->set_trim_end(dcpomatic::ContentTime(3000)); @@ -145,16 +139,17 @@ BOOST_AUTO_TEST_CASE (content_test6) { Cleanup cl; - auto film = new_test_film2 ( + auto film = new_test_film( "content_test6", content_factory(TestPaths::private_data() / "fha.mkv"), &cl ); film->set_audio_channels(16); + film->set_video_bit_rate(VideoEncoding::JPEG2000, 100000000); make_and_verify_dcp (film); - check_dcp (TestPaths::private_data() / "fha", film); + check_dcp (TestPaths::private_data() / "v2.18.x" / "fha", film); cl.run (); } @@ -163,17 +158,25 @@ BOOST_AUTO_TEST_CASE (content_test6) /** Reel length error when making the test for #1833 */ BOOST_AUTO_TEST_CASE (content_test7) { + Cleanup cl; + auto content = content_factory(TestPaths::private_data() / "clapperboard.mp4"); - auto film = new_test_film2 ("content_test7", content); + auto film = new_test_film("content_test7", content, &cl); content[0]->audio->set_delay(-1000); make_and_verify_dcp (film, { dcp::VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_2K }); + + cl.run(); } /** WAVs with markers (I think) can end up making audio packets with no channels and no frames (#2617) */ BOOST_AUTO_TEST_CASE(wav_with_markers_zero_channels_test) { + Cleanup cl; + auto content = content_factory(TestPaths::private_data() / "wav_with_markers.wav"); - auto film = new_test_film2("wav_with_markers_zero_channels_test", content); + auto film = new_test_film("wav_with_markers_zero_channels_test", content, &cl); make_and_verify_dcp(film, { dcp::VerificationNote::Code::MISSING_CPL_METADATA }); + + cl.run(); } diff --git a/test/cpl_hash_test.cc b/test/cpl_hash_test.cc index 3b430a6bd..603fa4b8d 100644 --- a/test/cpl_hash_test.cc +++ b/test/cpl_hash_test.cc @@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE (hash_added_to_imported_dcp_test) using namespace boost::filesystem; string const ov_name = "hash_added_to_imported_dcp_test_ov"; - auto ov = new_test_film2( + auto ov = new_test_film( ov_name, content_factory("test/data/flat_red.png") ); @@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE (hash_added_to_imported_dcp_test) string const vf_name = "hash_added_to_imported_dcp_test_vf"; auto ov_content = make_shared<DCPContent>(String::compose("build/test/%1/%2", ov_name, ov->dcp_name())); - auto vf = new_test_film2 ( + auto vf = new_test_film( vf_name, { ov_content } ); diff --git a/test/cpl_metadata_test.cc b/test/cpl_metadata_test.cc index 544e78899..59ceed064 100644 --- a/test/cpl_metadata_test.cc +++ b/test/cpl_metadata_test.cc @@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE(main_sound_configuration_test_51_vi) auto Rs = content_factory("test/data/Rs.wav")[0]; auto VI = content_factory("test/data/sine_440.wav")[0]; - auto film = new_test_film2("main_sound_configuration_test_51_vi", { picture, L, R, C, Lfe, Ls, Rs, VI }); + auto film = new_test_film("main_sound_configuration_test_51_vi", { picture, L, R, C, Lfe, Ls, Rs, VI }); film->set_audio_channels(8); auto set_map = [](shared_ptr<Content> content, dcp::Channel channel) { @@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE(main_sound_configuration_test_71) auto BsR = content_factory("test/data/Rs.wav")[0]; auto VI = content_factory("test/data/sine_440.wav")[0]; - auto film = new_test_film2("main_sound_configuration_test_51_vi", { picture, L, R, C, Lfe, Ls, Rs, BsL, BsR, VI }); + auto film = new_test_film("main_sound_configuration_test_51_vi", { picture, L, R, C, Lfe, Ls, Rs, BsL, BsR, VI }); film->set_audio_channels(12); auto set_map = [](shared_ptr<Content> content, dcp::Channel channel) { diff --git a/test/create_cli_test.cc b/test/create_cli_test.cc index aae5fb6de..7006fa6a0 100644 --- a/test/create_cli_test.cc +++ b/test/create_cli_test.cc @@ -179,11 +179,11 @@ BOOST_AUTO_TEST_CASE (create_cli_test) BOOST_CHECK_EQUAL(cc._fourk, true); BOOST_CHECK (!cc.error); - cc = run ("dcpomatic2_create --j2k-bandwidth 120 foo.mp4"); + cc = run ("dcpomatic2_create --video-bit-rate 120 foo.mp4"); BOOST_REQUIRE_EQUAL (cc.content.size(), 1U); BOOST_CHECK_EQUAL (cc.content[0].path, "foo.mp4"); - BOOST_REQUIRE(cc._j2k_bandwidth); - BOOST_CHECK_EQUAL(*cc._j2k_bandwidth, 120000000); + BOOST_REQUIRE(cc._video_bit_rate); + BOOST_CHECK_EQUAL(*cc._video_bit_rate, 120000000); BOOST_CHECK (!cc.error); cc = run ("dcpomatic2_create --channel L fred.wav --channel R jim.wav sheila.wav"); @@ -224,9 +224,7 @@ BOOST_AUTO_TEST_CASE (create_cli_test) BOOST_AUTO_TEST_CASE(create_cli_template_test) { - ConfigRestorer cr; - - Config::override_path = "test/data"; + ConfigRestorer cr("test/data"); auto cc = run("dcpomatic2_create test/data/flat_red.png"); auto film = cc.make_film(); @@ -288,25 +286,3 @@ BOOST_AUTO_TEST_CASE(create_cli_template_test) film = cc.make_film(); BOOST_CHECK(film->interop()); } - - -BOOST_AUTO_TEST_CASE(create_cli_defaults_test) -{ - ConfigRestorer cr; - - /* I think on balance dcpomatic2_create should not use the defaults from Config; - * it seems a bit surprising that settings from a GUI tool can change the behaviour of - * a CLI tool, and at some point we're probably going to remove all the default config - * options from the main DoM anyway (in favour of a default template). - */ - Config::instance()->set_default_interop(true); - auto cc = run("dcpomatic2_create test/data/flat_red.png"); - auto film = cc.make_film(); - BOOST_CHECK(!film->interop()); - - Config::instance()->set_default_dcp_content_type(DCPContentType::from_isdcf_name("FT")); - cc = run("dcpomatic2_create test/data/flat_red.png"); - film = cc.make_film(); - BOOST_CHECK_EQUAL(film->dcp_content_type()->isdcf_name(), "TST"); -} - diff --git a/test/data b/test/data -Subproject 4cb08962ba07e99c442cb12091c0347d84d8fd8 +Subproject f647e9364406f7934acd4c248c77287a810f59c diff --git a/test/dcp_decoder_test.cc b/test/dcp_decoder_test.cc index d0052f4a1..6e2bdcb6a 100644 --- a/test/dcp_decoder_test.cc +++ b/test/dcp_decoder_test.cc @@ -52,15 +52,15 @@ BOOST_AUTO_TEST_CASE (check_reuse_old_data_test) { /* Make some DCPs */ - auto ov = new_test_film2 ("check_reuse_old_data_ov", content_factory("test/data/flat_red.png")); + auto ov = new_test_film("check_reuse_old_data_ov", content_factory("test/data/flat_red.png")); make_and_verify_dcp (ov); auto ov_content = make_shared<DCPContent>(ov->dir(ov->dcp_name(false))); - auto vf = new_test_film2 ("check_reuse_old_data_vf", {ov_content, content_factory("test/data/L.wav")[0]}); + auto vf = new_test_film("check_reuse_old_data_vf", {ov_content, content_factory("test/data/L.wav")[0]}); ov_content->set_reference_video (true); make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false); - auto encrypted = new_test_film2 ("check_reuse_old_data_decrypted"); + auto encrypted = new_test_film("check_reuse_old_data_decrypted"); encrypted->examine_and_add_content (content_factory("test/data/flat_red.png")[0]); BOOST_REQUIRE (!wait_for_jobs()); encrypted->set_encrypted (true); @@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE (check_reuse_old_data_test) /* Add just the OV to a new project, move it around a bit and check that the _reels get reused. */ - auto test = new_test_film2 ("check_reuse_old_data_test1"); + auto test = new_test_film("check_reuse_old_data_test1"); ov_content = make_shared<DCPContent>(ov->dir(ov->dcp_name(false))); test->examine_and_add_content (ov_content); BOOST_REQUIRE (!wait_for_jobs()); @@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE (check_reuse_old_data_test) /* Add the VF to a new project, then add the OV and check that the _reels did not get reused. */ - test = new_test_film2 ("check_reuse_old_data_test2"); + test = new_test_film("check_reuse_old_data_test2"); auto vf_content = make_shared<DCPContent>(vf->dir(vf->dcp_name(false))); test->examine_and_add_content (vf_content); BOOST_REQUIRE (!wait_for_jobs()); @@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE (check_reuse_old_data_test) BOOST_REQUIRE (reels != decoder->reels()); /* Add a KDM to an encrypted DCP and check that the _reels did not get reused */ - test = new_test_film2 ("check_reuse_old_data_test3"); + test = new_test_film("check_reuse_old_data_test3"); auto encrypted_content = make_shared<DCPContent>(encrypted->dir(encrypted->dcp_name(false))); test->examine_and_add_content (encrypted_content); BOOST_REQUIRE (!wait_for_jobs()); diff --git a/test/dcp_digest_file_test.cc b/test/dcp_digest_file_test.cc index f22aa6d67..5c12fbb33 100644 --- a/test/dcp_digest_file_test.cc +++ b/test/dcp_digest_file_test.cc @@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE (dcp_digest_file_test2) }; auto red = content_factory("test/data/flat_red.png"); - auto ov = new_test_film2 ("dcp_digest_file_test2_ov", red); + auto ov = new_test_film("dcp_digest_file_test2_ov", red); ov->set_encrypted (true); make_and_verify_dcp (ov); @@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE (dcp_digest_file_test2) ov_dcp->add_kdm (kdm); ov_dcp->set_reference_video (true); ov_dcp->set_reference_audio (true); - auto vf = new_test_film2 ("dcp_digest_file_test2_vf", { ov_dcp }); + auto vf = new_test_film("dcp_digest_file_test2_vf", { ov_dcp }); vf->set_encrypted (true); make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false); diff --git a/test/dcp_examiner_test.cc b/test/dcp_examiner_test.cc index 7275a33c7..6efbd1bbc 100644 --- a/test/dcp_examiner_test.cc +++ b/test/dcp_examiner_test.cc @@ -34,13 +34,13 @@ using std::make_shared; BOOST_AUTO_TEST_CASE(check_examine_vfs) { auto image = content_factory("test/data/scope_red.png")[0]; - auto ov = new_test_film2("check_examine_vfs_ov", { image }); + auto ov = new_test_film("check_examine_vfs_ov", { image }); ov->set_container(Ratio::from_id("239")); make_and_verify_dcp(ov); auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name())); auto second_reel = content_factory("test/data/scope_red.png")[0]; - auto vf = new_test_film2("check_examine_vfs_vf", { ov_dcp, second_reel }); + auto vf = new_test_film("check_examine_vfs_vf", { ov_dcp, second_reel }); vf->set_container(Ratio::from_id("239")); vf->set_reel_type(ReelType::BY_VIDEO_CONTENT); ov_dcp->set_reference_video(true); diff --git a/test/dcp_metadata_test.cc b/test/dcp_metadata_test.cc index dd81a4161..f3d912631 100644 --- a/test/dcp_metadata_test.cc +++ b/test/dcp_metadata_test.cc @@ -31,7 +31,7 @@ BOOST_AUTO_TEST_CASE (dcp_metadata_test) { auto content = content_factory("test/data/flat_red.png"); - auto film = new_test_film2 ("dcp_metadata_test", content); + auto film = new_test_film("dcp_metadata_test", content); Config::instance()->set_dcp_creator ("this is the creator"); Config::instance()->set_dcp_issuer ("this is the issuer"); @@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE (dcp_metadata_test) BOOST_AUTO_TEST_CASE(main_picture_active_area_test) { auto content = content_factory(TestPaths::private_data() / "bbc405.png"); - auto film = new_test_film2("main_picture_active_area_test", content); + auto film = new_test_film("main_picture_active_area_test", content); film->set_resolution(Resolution::FOUR_K); film->set_interop(false); diff --git a/test/dcp_playback_test.cc b/test/dcp_playback_test.cc index a5b69e181..3b08f998c 100644 --- a/test/dcp_playback_test.cc +++ b/test/dcp_playback_test.cc @@ -38,10 +38,8 @@ using namespace dcpomatic; /** Simulate the work that the player does, for profiling */ BOOST_AUTO_TEST_CASE (dcp_playback_test) { - auto film = new_test_film ("dcp_playback_test"); auto content = make_shared<DCPContent>(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV"); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("dcp_playback_test", { content }); Player player(film, Image::Alignment::PADDED); diff --git a/test/dcp_subtitle_test.cc b/test/dcp_subtitle_test.cc index 837362e84..f7a9450f5 100644 --- a/test/dcp_subtitle_test.cc +++ b/test/dcp_subtitle_test.cc @@ -37,7 +37,7 @@ #include "lib/text_content.h" #include "lib/text_decoder.h" #include "test.h" -#include <dcp/mono_picture_asset.h> +#include <dcp/mono_j2k_picture_asset.h> #include <dcp/openjpeg_image.h> #include <dcp/smpte_subtitle_asset.h> #include <boost/test/unit_test.hpp> @@ -75,14 +75,10 @@ store (ContentStringText sub) /** Test pass-through of a very simple DCP subtitle file */ BOOST_AUTO_TEST_CASE (dcp_subtitle_test) { - auto film = new_test_film ("dcp_subtitle_test"); - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); - film->set_name ("frobozz"); - film->set_interop (false); auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub.xml"); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs ()); + auto film = new_test_film("dcp_subtitle_test", { content }); + film->set_dcp_content_type(DCPContentType::from_isdcf_name("TLR")); + film->set_name("frobozz"); BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(2).get()); @@ -107,13 +103,8 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test) /** Test parsing of a subtitle within an existing DCP */ BOOST_AUTO_TEST_CASE (dcp_subtitle_within_dcp_test) { - auto film = new_test_film ("dcp_subtitle_within_dcp_test"); - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); - film->set_name ("frobozz"); auto content = make_shared<DCPContent>(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV"); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs ()); + auto film = new_test_film("dcp_subtitle_within_dcp_test", { content }); auto decoder = make_shared<DCPDecoder>(film, content, false, false, shared_ptr<DCPDecoder>()); decoder->only_text()->PlainStart.connect (bind (store, _1)); @@ -130,13 +121,8 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_within_dcp_test) /** Test subtitles whose text includes things like <b> */ BOOST_AUTO_TEST_CASE (dcp_subtitle_test2) { - auto film = new_test_film ("dcp_subtitle_test2"); - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); - film->set_name ("frobozz"); auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub2.xml"); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs ()); + auto film = new_test_film("dcp_subtitle_test2", { content }); auto decoder = make_shared<DCPSubtitleDecoder>(film, content); decoder->only_text()->PlainStart.connect (bind (store, _1)); @@ -154,15 +140,10 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test2) /** Test a failure case */ BOOST_AUTO_TEST_CASE (dcp_subtitle_test3) { - auto film = new_test_film ("dcp_subtitle_test3"); - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); - film->set_name ("frobozz"); - film->set_interop (true); auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub3.xml"); - film->examine_and_add_content (content); + auto film = new_test_film("dcp_subtitle_test3", { content }); + film->set_interop (true); content->only_text()->set_language(dcp::LanguageTag("de")); - BOOST_REQUIRE (!wait_for_jobs ()); make_and_verify_dcp (film, { dcp::VerificationNote::Code::INVALID_STANDARD }); @@ -192,7 +173,7 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test4) { auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub3.xml"); auto content2 = make_shared<DCPSubtitleContent>("test/data/dcp_sub3.xml"); - auto film = new_test_film2 ("dcp_subtitle_test4", {content, content2}); + auto film = new_test_film("dcp_subtitle_test4", {content, content2}); film->set_interop (true); content->only_text()->add_font(make_shared<Font>("font1")); @@ -227,7 +208,7 @@ check_font_tags (vector<cxml::NodePtr> nodes) BOOST_AUTO_TEST_CASE (dcp_subtitle_test5) { auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub6.xml"); - auto film = new_test_film2 ("dcp_subtitle_test5", {content}); + auto film = new_test_film("dcp_subtitle_test5", {content}); film->set_interop (true); content->only_text()->set_language(dcp::LanguageTag("de")); @@ -246,7 +227,7 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test5) BOOST_AUTO_TEST_CASE (test_font_override) { auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub4.xml"); - auto film = new_test_film2("test_font_override", {content}); + auto film = new_test_film("test_font_override", {content}); film->set_interop(true); content->only_text()->set_language(dcp::LanguageTag("de")); @@ -285,7 +266,7 @@ BOOST_AUTO_TEST_CASE(entity_from_dcp_source) source_xml.close(); auto content = make_shared<DCPSubtitleContent>("build/test/entity_from_dcp_source.xml"); - auto film = new_test_film2("entity_from_dcp_source", { content }); + auto film = new_test_film("entity_from_dcp_source", { content }); film->set_interop(false); content->only_text()->set_use(true); content->only_text()->set_burn(false); @@ -327,7 +308,7 @@ BOOST_AUTO_TEST_CASE(entity_from_dcp_source) dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING, }); - dcp::MonoPictureAsset burnt(dcp_file(film, "j2c_")); + dcp::MonoJ2KPictureAsset burnt(dcp_file(film, "j2c_")); auto frame = burnt.start_read()->get_frame(12)->xyz_image(); auto const size = frame->size(); int max_X = 0; diff --git a/test/digest_test.cc b/test/digest_test.cc index 2d49768f7..39737b7f5 100644 --- a/test/digest_test.cc +++ b/test/digest_test.cc @@ -65,17 +65,11 @@ openssl_hash (boost::filesystem::path file) /** Test the digests made by the DCP writing code on a multi-reel DCP */ BOOST_AUTO_TEST_CASE (digest_test) { - auto film = new_test_film ("digest_test"); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); - film->set_name ("digest_test"); auto r = make_shared<ImageContent>("test/data/flat_red.png"); auto g = make_shared<ImageContent>("test/data/flat_green.png"); auto b = make_shared<ImageContent>("test/data/flat_blue.png"); - film->examine_and_add_content (r); - film->examine_and_add_content (g); - film->examine_and_add_content (b); + auto film = new_test_film("digest_test", { r, g, b }); film->set_reel_type (ReelType::BY_VIDEO_CONTENT); - BOOST_REQUIRE (!wait_for_jobs()); BOOST_CHECK (Config::instance()->master_encoding_threads() > 1); make_and_verify_dcp (film); diff --git a/test/disk_writer_test.cc b/test/disk_writer_test.cc index 553adcae7..ff39eaaea 100644 --- a/test/disk_writer_test.cc +++ b/test/disk_writer_test.cc @@ -228,110 +228,3 @@ BOOST_AUTO_TEST_CASE (disk_writer_test3) cl.run(); } - - -BOOST_AUTO_TEST_CASE (osx_drive_identification_test) -{ - vector<OSXDisk> disks; - - auto disk = [&disks](string mount_point, string media_path, bool whole, std::vector<boost::filesystem::path> mount_points) - { - auto mp = analyse_osx_media_path (media_path); - if (mp) { - disks.push_back({mount_point, {}, {}, *mp, whole, mount_points, 0}); - } - }; - - auto find_unmounted = [](vector<OSXDisk> disks) { - auto drives = osx_disks_to_drives (disks); - vector<Drive> unmounted; - std::copy_if (drives.begin(), drives.end(), std::back_inserter(unmounted), [](Drive const& drive) { return !drive.mounted(); }); - return unmounted; - }; - - disk("/dev/disk4s1", "IODeviceTree:/arm-io@10F00000/apcie@90000000/pci-bridge1@1/pcie-xhci@0/@7:1", false, {}); - disk("/dev/disk4", "IODeviceTree:/arm-io@10F00000/apcie@90000000/pci-bridge1@1/pcie-xhci@0/@7:0", true, {}); - disk("/dev/disk0", "IODeviceTree:/arm-io@10F00000/ans@77400000/iop-ans-nub/AppleANS3NVMeController/@1:0", true, {}); - disk("/dev/disk0s1", "IODeviceTree:/arm-io@10F00000/ans@77400000/iop-ans-nub/AppleANS3NVMeController/@1:1", false, {}); - disk("/dev/disk0s2", "IODeviceTree:/arm-io@10F00000/ans@77400000/iop-ans-nub/AppleANS3NVMeController/@1:2", false, {}); - disk("/dev/disk0s3", "IODeviceTree:/arm-io@10F00000/ans@77400000/iop-ans-nub/AppleANS3NVMeController/@1:3", false, {}); - disk("/dev/disk1", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/iBootSystemContainer@1/AppleAPFSContainerScheme/AppleAPFSMedia", true, {}); - disk("/dev/disk2", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/RecoveryOSContainer@3/AppleAPFSContainerScheme/AppleAPFSMedia", true, {}); - disk("/dev/disk3", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/Container@2/AppleAPFSContainerScheme/AppleAPFSMedia", false, {}); - disk("/dev/disk1s1", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/iBootSystemContainer@1/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/iSCPreboot@1", false, {}); - disk("/dev/disk1s2", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/iBootSystemContainer@1/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/xART@2", false, {}); - disk("/dev/disk1s3", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/iBootSystemContainer@1/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Hardware@3", false, {}); - disk("/dev/disk1s4", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/iBootSystemContainer@1/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Recovery@4", false, {}); - disk("/dev/disk2s1", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/RecoveryOSContainer@3/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Recovery@1", false, {}); - disk("/dev/disk2s2", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/RecoveryOSContainer@3/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Update@2", false, {}); - disk("/dev/disk3s1", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/Container@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Macintosh HD@1", false, {}); - disk("/dev/disk3s4", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/Container@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Update@4", false, {"/System/Volumes/Update"}); - disk("/dev/disk3s5", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/Container@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Data@5", false, {"/System/Volumes/Data"}); - disk("/dev/disk3s2", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/Container@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Preboot@2", false, {"/System/Volumes/Preboot"}); - disk("/dev/disk3s3", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/Container@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Recovery@3", false, {}); - disk("/dev/disk3s6", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/Container@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/VM@6", false, {"/System/Volumes/VM"}); - disk("/dev/disk3s1s1", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/Container@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Macintosh HD@1/com.apple.os.update-EA882DCA7A28EBA0A6E94689836BB10D77D84D1AEE2468E17775A447AA815278@1", false, {"/"}); - - vector<Drive> writeable = find_unmounted (disks); - BOOST_REQUIRE_EQUAL (writeable.size(), 1U); - BOOST_CHECK_EQUAL (writeable[0].device(), "/dev/disk4"); - - disks.clear (); - disk("/dev/disk4s1", "IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@0/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media/IOGUIDPartitionScheme/disk image@1", false, {}); - disk("/dev/disk4", "IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@0/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media", true, {}); - disk("/dev/disk3s1", "IODeviceTree:/PCI0@0/XHC1@14/@2:1", false, {}); - disk("/dev/disk3", "IODeviceTree:/PCI0@0/XHC1@14/@2:0", true, {}); - disk("/dev/disk0", "IODeviceTree:/PCI0@0/SATA@1F,2/PRT1@1/PMP@0/@0:0", true, {}); - disk("/dev/disk0s1", "IODeviceTree:/PCI0@0/SATA@1F,2/PRT1@1/PMP@0/@0:1", false, {}); - disk("/dev/disk0s2", "IODeviceTree:/PCI0@0/SATA@1F,2/PRT1@1/PMP@0/@0:2", false, {"/Volumes/Macintosh HD"}); - disk("/dev/disk0s3", "IODeviceTree:/PCI0@0/SATA@1F,2/PRT1@1/PMP@0/@0:3", false, {}); - disk("/dev/disk0s4", "IODeviceTree:/PCI0@0/SATA@1F,2/PRT1@1/PMP@0/@0:4", false, {}); - disk("/dev/disk0s5", "IODeviceTree:/PCI0@0/SATA@1F,2/PRT1@1/PMP@0/@0:5", false, {"/Volumes/High Sierra"}); - disk("/dev/disk0s6", "IODeviceTree:/PCI0@0/SATA@1F,2/PRT1@1/PMP@0/@0:6", false, {}); - disk("/dev/disk0s7", "IODeviceTree:/PCI0@0/SATA@1F,2/PRT1@1/PMP@0/@0:7", false, {"/Volumes/Recovery HD"}); - disk("/dev/disk1", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 3@3/AppleAPFSContainerScheme/AppleAPFSMedia", true, {}); - disk("/dev/disk", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 4@4/AppleAPFSContainerScheme/AppleAPFSMedia", true, {}); - disk("/dev/disk1s1", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 3@3/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Untitled - Data@1", false, {"/Volumes/Untitled - Data"}); - disk("/dev/disk1s2", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 3@3/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Preboot@2", false, {}); - disk("/dev/disk1s3", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 3@3/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Recovery@3", false, {}); - disk("/dev/disk1s4", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 3@3/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/VM@4", false, {}); - disk("/dev/disk1s5", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 3@3/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Untitled@5", false, {"/Volumes/Untitled"}); - disk("/dev/disk2s1", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 4@4/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Catalina - Data@1", false, {}); - disk("/dev/disk2s2", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 4@4/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Preboot@2", false, {}); - disk("/dev/disk2s3", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 4@4/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Recovery@3", false, {}); - disk("/dev/disk2s4", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 4@4/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/VM@4", false, {"/private/var/vm"}); - disk("/dev/disk2s5", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 4@4/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Catalina@5", false, {"/"}); - - writeable = find_unmounted (disks); - BOOST_REQUIRE_EQUAL (writeable.size(), 1U); - BOOST_CHECK_EQUAL (writeable[0].device(), "/dev/disk3"); - - disks.clear (); - disk("/dev/disk7", "IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@3/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media", true, {}); - disk("/dev/disk7s1", "IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@3/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media/IOGUIDPartitionScheme/disk image@1", false, {}); - disk("/dev/disk6s1", "MediaPathKey is IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@2/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media/IOGUIDPartitionScheme/disk image@1", false, {}); - disk("/dev/disk6", "IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@2/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media", true, {}); - disk("/dev/disk5s1", "IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@1/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media/IOGUIDPartitionScheme/disk image@1", false, {}); - disk("/dev/disk5", "IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@1/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media", true, {}); - disk("/dev/disk4s1", "IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@0/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media/IOGUIDPartitionScheme/disk image@1", false, {}); - disk("/dev/disk4", "IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@0/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media", true, {}); - disk("/dev/disk0", "IODeviceTree:/PCI0@1e0000/pci8086,2829@1F,2/PRT3@3/PMP@0/@0:0", true, {}); - disk("/dev/disk2", "IODeviceTree:/PCI0@1e0000/pci8086,2829@1F,2/PRT1@1/PMP@0/@0:0", true, {}); - disk("/dev/disk1", "IODeviceTree:/PCI0@1e0000/pci8086,2829@1F,2/PRT0@0/PMP@0/@0:0", true, {}); - disk("/dev/disk1s1", "IODeviceTree:/PCI0@1e0000/pci8086,2829@1F,2/PRT0@0/PMP@0/@0:1", false, {"/Volumes/EFI"}); - disk("/dev/disk2s1", "IODeviceTree:/PCI0@1e0000/pci8086,2829@1F,2/PRT1@1/PMP@0/@0:1", false, {}); - disk("/dev/disk2s2", "IODeviceTree:/PCI0@1e0000/pci8086,2829@1F,2/PRT1@1/PMP@0/@0:2", false, {}); - disk("/dev/disk3", "IOService:/AppleACPIPlatformExpert/PCI0@1e0000/AppleACPIPCI/pci8086,2829@1F,2/AppleAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/VBOX HARDDISK Media/IOGUIDPartitionScheme/disk image@2/AppleAPFSContainerScheme/AppleAPFSMedia", false, {}); - disk("/dev/disk3s1", "IOService:/AppleACPIPlatformExpert/PCI0@1e0000/AppleACPIPCI/pci8086,2829@1F,2/AppleAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/VBOX HARDDISK Media/IOGUIDPartitionScheme/disk image@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/macOS - Data@1", false, {"/System/Volumes/Data"}); - disk("/dev/disk3s2", "IOService:/AppleACPIPlatformExpert/PCI0@1e0000/AppleACPIPCI/pci8086,2829@1F,2/AppleAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/VBOX HARDDISK Media/IOGUIDPartitionScheme/disk image@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Preboot@2", false, {"/System/Volumes/Preboot"}); - disk("/dev/disk3s3", "IOService:/AppleACPIPlatformExpert/PCI0@1e0000/AppleACPIPCI/pci8086,2829@1F,2/AppleAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/VBOX HARDDISK Media/IOGUIDPartitionScheme/disk image@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Recovery@3", false, {}); - disk("/dev/disk3s4", "IOService:/AppleACPIPlatformExpert/PCI0@1e0000/AppleACPIPCI/pci8086,2829@1F,2/AppleAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/VBOX HARDDISK Media/IOGUIDPartitionScheme/disk image@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/VM@4", false, {"/System/Volumes/VM"}); - disk("/dev/disk3s5", "IOService:/AppleACPIPlatformExpert/PCI0@1e0000/AppleACPIPCI/pci8086,2829@1F,2/AppleAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/VBOX HARDDISK Media/IOGUIDPartitionScheme/disk image@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/macOS@5", false, {}); - disk("/dev/disk3s6", "IOService:/AppleACPIPlatformExpert/PCI0@1e0000/AppleACPIPCI/pci8086,2829@1F,2/AppleAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/VBOX HARDDISK Media/IOGUIDPartitionScheme/disk image@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Update@6", false, {"/System/Volumes/Update"}); - disk("/dev/disk3s5s1", "IOService:/AppleACPIPlatformExpert/PCI0@1e0000/AppleACPIPCI/pci8086,2829@1F,2/AppleAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/VBOX HARDDISK Media/IOGUIDPartitionScheme/disk image@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/macOS@5/com.apple.os.update-5523D8E63431315F9F949CCDD0274BF797F5CEE4EAF616D4C66A01B8D6A83C7B@1", false, {"/"}); - - writeable = find_unmounted (disks); - BOOST_REQUIRE_EQUAL (writeable.size(), 1U); - BOOST_CHECK_EQUAL (writeable[0].device(), "/dev/disk0"); -} - diff --git a/test/dkdm_recipient_list_test.cc b/test/dkdm_recipient_list_test.cc new file mode 100644 index 000000000..406d181a1 --- /dev/null +++ b/test/dkdm_recipient_list_test.cc @@ -0,0 +1,57 @@ +/* + Copyright (C) 2024 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic 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. + + DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + + +#include "lib/config.h" +#include "lib/dkdm_recipient.h" +#include "lib/dkdm_recipient_list.h" +#include "test.h" +#include <dcp/filesystem.h> +#include <boost/test/unit_test.hpp> + + +BOOST_AUTO_TEST_CASE(dkdm_receipient_list_copy_from_xml_test) +{ + ConfigRestorer cr("build/test/dkdm_recipient_list_copy_config"); + + dcp::filesystem::remove_all(*Config::override_path); + dcp::filesystem::create_directories(*Config::override_path); + dcp::filesystem::copy_file("test/data/dkdm_recipients.xml", *Config::override_path / "dkdm_recipients.xml"); + + DKDMRecipientList dkdm_recipient_list; + dkdm_recipient_list.read_legacy_file(Config::instance()->read_path("dkdm_recipients.xml")); + auto dkdm_recipients = dkdm_recipient_list.dkdm_recipients(); + BOOST_REQUIRE_EQUAL(dkdm_recipients.size(), 2U); + + auto dkdm_recipient_iter = dkdm_recipients.begin(); + BOOST_CHECK_EQUAL(dkdm_recipient_iter->second.name, "Bob's Epics"); + BOOST_CHECK_EQUAL(dkdm_recipient_iter->second.emails.size(), 2U); + BOOST_CHECK_EQUAL(dkdm_recipient_iter->second.emails[0], "epicbob@gmail.com"); + BOOST_CHECK_EQUAL(dkdm_recipient_iter->second.emails[1], "boblikesemlong@cinema-bob.com"); + BOOST_CHECK_EQUAL(dkdm_recipient_iter->second.recipient->subject_dn_qualifier(), "r5/Q5f3UTm7qzoF5QzNZP6aEuvI="); + ++dkdm_recipient_iter; + + BOOST_CHECK_EQUAL(dkdm_recipient_iter->second.name, "Sharon's Shorts"); + BOOST_CHECK_EQUAL(dkdm_recipient_iter->second.notes, "Even if it sucks, at least it's over quickly"); + BOOST_CHECK_EQUAL(dkdm_recipient_iter->second.recipient->subject_dn_qualifier(), "FHerM3Us/DWuqD1MnztStSlFJO0="); + ++dkdm_recipient_iter; +} + + diff --git a/test/empty_caption_test.cc b/test/empty_caption_test.cc index 3138c4af2..d9ae4a1c7 100644 --- a/test/empty_caption_test.cc +++ b/test/empty_caption_test.cc @@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE (check_for_no_empty_text_nodes_in_failure_case) Cleanup cl; auto content = content_factory("test/data/empty.srt"); - auto film = new_test_film2("check_for_no_empty_text_nodes_in_failure_case", content, &cl); + auto film = new_test_film("check_for_no_empty_text_nodes_in_failure_case", content, &cl); auto text = content[0]->text.front(); text->set_type (TextType::CLOSED_CAPTION); text->set_dcp_track({"English", dcp::LanguageTag("en")}); diff --git a/test/empty_test.cc b/test/empty_test.cc index b186954b3..922d6a5b1 100644 --- a/test/empty_test.cc +++ b/test/empty_test.cc @@ -55,7 +55,7 @@ has_video (shared_ptr<const Content> content) BOOST_AUTO_TEST_CASE (empty_test1) { - auto film = new_test_film2 ("empty_test1"); + auto film = new_test_film("empty_test1"); film->set_sequence (false); auto contentA = make_shared<ImageContent>("test/data/simple_testcard_640x480.png"); auto contentB = make_shared<ImageContent>("test/data/simple_testcard_640x480.png"); @@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE (empty_test1) /** Some tests where the first empty period is not at time 0 */ BOOST_AUTO_TEST_CASE (empty_test2) { - auto film = new_test_film2 ("empty_test2"); + auto film = new_test_film("empty_test2"); film->set_sequence (false); auto contentA = make_shared<ImageContent>("test/data/simple_testcard_640x480.png"); auto contentB = make_shared<ImageContent>("test/data/simple_testcard_640x480.png"); @@ -127,7 +127,7 @@ BOOST_AUTO_TEST_CASE (empty_test2) /** Test for when the film's playlist is not the same as the one passed into Empty */ BOOST_AUTO_TEST_CASE (empty_test3) { - auto film = new_test_film2 ("empty_test3"); + auto film = new_test_film("empty_test3"); film->set_sequence (false); auto contentA = make_shared<ImageContent>("test/data/simple_testcard_640x480.png"); auto contentB = make_shared<ImageContent>("test/data/simple_testcard_640x480.png"); @@ -160,7 +160,7 @@ BOOST_AUTO_TEST_CASE (empty_test3) BOOST_AUTO_TEST_CASE (empty_test_with_overlapping_content) { - auto film = new_test_film2 ("empty_test_with_overlapping_content"); + auto film = new_test_film("empty_test_with_overlapping_content"); film->set_sequence (false); auto contentA = make_shared<ImageContent>("test/data/simple_testcard_640x480.png"); auto contentB = make_shared<ImageContent>("test/data/simple_testcard_640x480.png"); diff --git a/test/encryption_test.cc b/test/encryption_test.cc index 9cadd087e..97359cd44 100644 --- a/test/encryption_test.cc +++ b/test/encryption_test.cc @@ -36,7 +36,7 @@ using std::make_shared; BOOST_AUTO_TEST_CASE (smpte_dcp_with_subtitles_can_be_decrypted) { auto content = content_factory("test/data/15s.srt"); - auto film = new_test_film2 ("smpte_dcp_with_subtitles_can_be_decrypted", content); + auto film = new_test_film("smpte_dcp_with_subtitles_can_be_decrypted", content); film->set_interop (false); film->set_encrypted (true); make_and_verify_dcp ( diff --git a/test/ffmpeg_audio_only_test.cc b/test/ffmpeg_audio_only_test.cc index ea9a9c4e5..d994de91b 100644 --- a/test/ffmpeg_audio_only_test.cc +++ b/test/ffmpeg_audio_only_test.cc @@ -78,12 +78,8 @@ audio (std::shared_ptr<AudioBuffers> audio, int channels) static shared_ptr<Film> test (boost::filesystem::path file) { - auto film = new_test_film ("ffmpeg_audio_only_test"); - film->set_name ("test_film"); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); auto c = make_shared<FFmpegContent>(file); - film->examine_and_add_content (c); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("ffmpeg_audio_only_test", { c }); film->write_metadata (); /* See if can make a DCP without any errors */ diff --git a/test/ffmpeg_audio_test.cc b/test/ffmpeg_audio_test.cc index b2a83aad8..01bc38da3 100644 --- a/test/ffmpeg_audio_test.cc +++ b/test/ffmpeg_audio_test.cc @@ -51,12 +51,8 @@ using std::string; BOOST_AUTO_TEST_CASE (ffmpeg_audio_test) { - auto film = new_test_film ("ffmpeg_audio_test"); - film->set_name ("ffmpeg_audio_test"); auto c = make_shared<FFmpegContent> ("test/data/staircase.mov"); - film->examine_and_add_content (c); - - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("ffmpeg_audio_test", { c }); int constexpr audio_channels = 6; @@ -103,7 +99,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_audio_test) /** Decode a file containing truehd so we can profile it; this is with the player set to normal */ BOOST_AUTO_TEST_CASE (ffmpeg_audio_test2) { - auto film = new_test_film2 ("ffmpeg_audio_test2"); + auto film = new_test_film("ffmpeg_audio_test2"); auto content = content_factory(TestPaths::private_data() / "wayne.mkv")[0]; film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); @@ -116,7 +112,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_audio_test2) /** Decode a file containing truehd so we can profile it; this is with the player set to fast */ BOOST_AUTO_TEST_CASE (ffmpeg_audio_test3) { - auto film = new_test_film2 ("ffmpeg_audio_test3"); + auto film = new_test_film("ffmpeg_audio_test3"); auto content = content_factory(TestPaths::private_data() / "wayne.mkv")[0]; film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); @@ -130,7 +126,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_audio_test3) /** Decode a file whose audio previously crashed DCP-o-matic (#1857) */ BOOST_AUTO_TEST_CASE (ffmpeg_audio_test4) { - auto film = new_test_film2 ("ffmpeg_audio_test4"); + auto film = new_test_film("ffmpeg_audio_test4"); auto content = content_factory(TestPaths::private_data() / "Actuellement aout 2020.wmv")[0]; film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); diff --git a/test/ffmpeg_dcp_test.cc b/test/ffmpeg_dcp_test.cc index c332759c8..96a3618be 100644 --- a/test/ffmpeg_dcp_test.cc +++ b/test/ffmpeg_dcp_test.cc @@ -43,18 +43,10 @@ using std::make_shared; BOOST_AUTO_TEST_CASE (ffmpeg_dcp_test) { - auto film = new_test_film ("ffmpeg_dcp_test"); - film->set_name ("test_film2"); auto c = make_shared<FFmpegContent>("test/data/test.mp4"); - film->examine_and_add_content (c); - - BOOST_REQUIRE (!wait_for_jobs()); - - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); + auto film = new_test_film("ffmpeg_dcp_test", { c }); + film->set_name("test_film2"); make_and_verify_dcp (film); - - BOOST_REQUIRE (!wait_for_jobs()); } diff --git a/test/ffmpeg_decoder_error_test.cc b/test/ffmpeg_decoder_error_test.cc index 1bb289feb..b53eabac5 100644 --- a/test/ffmpeg_decoder_error_test.cc +++ b/test/ffmpeg_decoder_error_test.cc @@ -39,7 +39,7 @@ BOOST_AUTO_TEST_CASE (check_exception_during_flush) { auto content = content_factory(TestPaths::private_data() / "3d_thx_broadway_2010_lossless.m2ts"); - auto film = new_test_film2 ("check_exception_during_flush", content); + auto film = new_test_film("check_exception_during_flush", content); content[0]->set_trim_start(film, dcpomatic::ContentTime(2310308)); content[0]->set_trim_end(dcpomatic::ContentTime(116020)); @@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE (check_exception_during_flush) BOOST_AUTO_TEST_CASE (check_exception_with_multiple_video_frames_per_packet) { auto content = content_factory(TestPaths::private_data() / "chk.mkv")[0]; - auto film = new_test_film2 ("check_exception_with_multiple_video_frames_per_packet", { content }); + auto film = new_test_film("check_exception_with_multiple_video_frames_per_packet", { content }); auto player = std::make_shared<Player>(film, film->playlist()); while (!player->pass()) {} diff --git a/test/ffmpeg_decoder_seek_test.cc b/test/ffmpeg_decoder_seek_test.cc index 4dceae86b..796db043f 100644 --- a/test/ffmpeg_decoder_seek_test.cc +++ b/test/ffmpeg_decoder_seek_test.cc @@ -64,30 +64,28 @@ store (ContentVideo v) static void -check (shared_ptr<FFmpegDecoder> decoder, int frame) +check (shared_ptr<FFmpegDecoder> decoder, ContentTime time) { BOOST_REQUIRE (decoder->ffmpeg_content()->video_frame_rate ()); - decoder->seek (ContentTime::from_frames (frame, decoder->ffmpeg_content()->video_frame_rate().get()), true); + decoder->seek(time, true); stored = optional<ContentVideo> (); while (!decoder->pass() && !stored) {} - BOOST_CHECK (stored->frame <= frame); + BOOST_CHECK(stored->time <= time); } static void -test (boost::filesystem::path file, vector<int> frames) +test (boost::filesystem::path file, vector<ContentTime> times) { auto path = TestPaths::private_data() / file; BOOST_REQUIRE (boost::filesystem::exists (path)); - auto film = new_test_film ("ffmpeg_decoder_seek_test_" + file.string()); auto content = make_shared<FFmpegContent>(path); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("ffmpeg_decoder_seek_test_" + file.string(), { content }); auto decoder = make_shared<FFmpegDecoder>(film, content, false); decoder->video->Data.connect (bind (&store, _1)); - for (auto i: frames) { + for (auto i: times) { check (decoder, i); } } @@ -95,10 +93,43 @@ test (boost::filesystem::path file, vector<int> frames) BOOST_AUTO_TEST_CASE (ffmpeg_decoder_seek_test) { - vector<int> frames = { 0, 42, 999, 0 }; - - test ("boon_telly.mkv", frames); - test ("Sintel_Trailer1.480p.DivX_Plus_HD.mkv", frames); - test ("prophet_long_clip.mkv", { 15, 42, 999, 15 }); - test ("dolby_aurora.vob", { 0, 125, 250, 41 }); + test( + "boon_telly.mkv", + { + ContentTime::from_frames(0, 29.97), + ContentTime::from_frames(42, 29.97), + ContentTime::from_frames(999, 29.97), + ContentTime::from_frames(0, 29.97), + } + ); + + test( + "Sintel_Trailer1.480p.DivX_Plus_HD.mkv", + { + ContentTime::from_frames(0, 24), + ContentTime::from_frames(42, 24), + ContentTime::from_frames(999, 24), + ContentTime::from_frames(0, 24), + } + ); + + test( + "prophet_long_clip.mkv", + { + ContentTime::from_frames(15, 23.976), + ContentTime::from_frames(42, 23.976), + ContentTime::from_frames(999, 23.976), + ContentTime::from_frames(15, 23.976) + } + ); + + test( + "dolby_aurora.vob", + { + ContentTime::from_frames(0, 25), + ContentTime::from_frames(125, 25), + ContentTime::from_frames(250, 25), + ContentTime::from_frames(41, 25) + } + ); } diff --git a/test/ffmpeg_decoder_sequential_test.cc b/test/ffmpeg_decoder_sequential_test.cc index 73eea719f..c0fe26ea3 100644 --- a/test/ffmpeg_decoder_sequential_test.cc +++ b/test/ffmpeg_decoder_sequential_test.cc @@ -70,11 +70,8 @@ ffmpeg_decoder_sequential_test_one (boost::filesystem::path file, float fps, int auto path = TestPaths::private_data() / file; BOOST_REQUIRE (boost::filesystem::exists (path)); - auto film = new_test_film ("ffmpeg_decoder_sequential_test_" + file.string()); auto content = make_shared<FFmpegContent>(path); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); - film->write_metadata (); + auto film = new_test_film("ffmpeg_decoder_sequential_test_" + file.string(), { content }); auto player = make_shared<Player>(film, Image::Alignment::COMPACT); BOOST_REQUIRE (content->video_frame_rate()); diff --git a/test/ffmpeg_encoder_test.cc b/test/ffmpeg_encoder_test.cc index dc57b473b..b42ff92d8 100644 --- a/test/ffmpeg_encoder_test.cc +++ b/test/ffmpeg_encoder_test.cc @@ -28,8 +28,8 @@ #include "lib/dcp_content.h" #include "lib/dcpomatic_log.h" #include "lib/ffmpeg_content.h" -#include "lib/ffmpeg_encoder.h" #include "lib/ffmpeg_examiner.h" +#include "lib/ffmpeg_film_encoder.h" #include "lib/film.h" #include "lib/image_content.h" #include "lib/ratio.h" @@ -76,7 +76,7 @@ ffmpeg_content_test (int number, boost::filesystem::path content, ExportFormat f name = String::compose("%1_test%2", name, number); auto c = make_shared<FFmpegContent>(content); - auto film = new_test_film2 (name, {c}, &cl); + auto film = new_test_film(name, {c}, &cl); film->set_name (name); film->set_audio_channels (6); @@ -84,7 +84,7 @@ ffmpeg_content_test (int number, boost::filesystem::path content, ExportFormat f auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE); auto file = boost::filesystem::path("build") / "test" / String::compose("%1.%2", name, extension); cl.add (file); - FFmpegEncoder encoder (film, job, file, format, false, false, false, 23); + FFmpegFilmEncoder encoder(film, job, file, format, false, false, false, 23); encoder.go (); cl.run (); @@ -122,42 +122,39 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test4) /** Still image -> Prores */ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test5) { - auto film = new_test_film ("ffmpeg_encoder_prores_test5"); - film->set_name ("ffmpeg_encoder_prores_test5"); + boost::filesystem::path const output = "build/test/ffmpeg_encoder_prores_test5.mov"; + Cleanup cl; + cl.add(output); + auto c = make_shared<ImageContent>(TestPaths::private_data() / "bbc405.png"); - film->set_container (Ratio::from_id ("185")); + auto film = new_test_film("ffmpeg_encoder_prores_test5", { c }); film->set_audio_channels (6); - film->examine_and_add_content (c); - BOOST_REQUIRE (!wait_for_jobs ()); - c->video->set_length (240); film->write_metadata (); auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test5.mov", ExportFormat::PRORES_HQ, false, false, false, 23); + FFmpegFilmEncoder encoder(film, job, output, ExportFormat::PRORES_HQ, false, false, false, 23); encoder.go (); + + cl.run(); } /** Subs -> Prores */ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test6) { - auto film = new_test_film ("ffmpeg_encoder_prores_test6"); - film->set_name ("ffmpeg_encoder_prores_test6"); - film->set_container (Ratio::from_id ("185")); + auto s = make_shared<StringTextFileContent>("test/data/subrip2.srt"); + auto film = new_test_film("ffmpeg_encoder_prores_test6", { s }); film->set_audio_channels (6); - auto s = make_shared<StringTextFileContent>("test/data/subrip2.srt"); - film->examine_and_add_content (s); - BOOST_REQUIRE (!wait_for_jobs ()); s->only_text()->set_colour (dcp::Colour (255, 255, 0)); s->only_text()->set_effect (dcp::Effect::SHADOW); s->only_text()->set_effect_colour (dcp::Colour (0, 255, 255)); film->write_metadata(); auto job = make_shared<TranscodeJob> (film, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test6.mov", ExportFormat::PRORES_HQ, false, false, false, 23); + FFmpegFilmEncoder encoder(film, job, "build/test/ffmpeg_encoder_prores_test6.mov", ExportFormat::PRORES_HQ, false, false, false, 23); encoder.go (); } @@ -165,25 +162,24 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test6) /** Video + subs -> Prores */ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test7) { - auto film = new_test_film ("ffmpeg_encoder_prores_test7"); - film->set_name ("ffmpeg_encoder_prores_test7"); - film->set_container (Ratio::from_id ("185")); - film->set_audio_channels (6); + boost::filesystem::path const output = "build/test/ffmpeg_encoder_prores_test7.mov"; + Cleanup cl; + cl.add(output); auto c = make_shared<FFmpegContent>("test/data/test.mp4"); - film->examine_and_add_content (c); - BOOST_REQUIRE (!wait_for_jobs ()); - auto s = make_shared<StringTextFileContent>("test/data/subrip.srt"); - film->examine_and_add_content (s); - BOOST_REQUIRE (!wait_for_jobs ()); + auto film = new_test_film("ffmpeg_encoder_prores_test7", { c, s }); + film->set_audio_channels (6); + s->only_text()->set_colour (dcp::Colour (255, 255, 0)); s->only_text()->set_effect (dcp::Effect::SHADOW); s->only_text()->set_effect_colour (dcp::Colour (0, 255, 255)); auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test7.mov", ExportFormat::PRORES_HQ, false, false, false, 23); + FFmpegFilmEncoder encoder(film, job, output, ExportFormat::PRORES_HQ, false, false, false, 23); encoder.go (); + + cl.run(); } @@ -197,21 +193,17 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test1) /** Just subtitles -> H264 */ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test2) { - auto film = new_test_film ("ffmpeg_encoder_h264_test2"); - film->set_name ("ffmpeg_encoder_h264_test2"); - film->set_container (Ratio::from_id ("185")); + auto s = make_shared<StringTextFileContent>("test/data/subrip2.srt"); + auto film = new_test_film("ffmpeg_encoder_h264_test2", { s }); film->set_audio_channels (6); - auto s = make_shared<StringTextFileContent>("test/data/subrip2.srt"); - film->examine_and_add_content (s); - BOOST_REQUIRE (!wait_for_jobs ()); s->only_text()->set_colour (dcp::Colour (255, 255, 0)); s->only_text()->set_effect (dcp::Effect::SHADOW); s->only_text()->set_effect_colour (dcp::Colour (0, 255, 255)); film->write_metadata(); auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test2.mp4", ExportFormat::H264_AAC, false, false, false, 23); + FFmpegFilmEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test2.mp4", ExportFormat::H264_AAC, false, false, false, 23); encoder.go (); } @@ -219,25 +211,18 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test2) /** Video + subs -> H264 */ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test3) { - auto film = new_test_film ("ffmpeg_encoder_h264_test3"); - film->set_name ("ffmpeg_encoder_h264_test3"); - film->set_container (Ratio::from_id ("185")); - film->set_audio_channels (6); - auto c = make_shared<FFmpegContent>("test/data/test.mp4"); - film->examine_and_add_content (c); - BOOST_REQUIRE (!wait_for_jobs()); - auto s = make_shared<StringTextFileContent>("test/data/subrip.srt"); - film->examine_and_add_content (s); - BOOST_REQUIRE (!wait_for_jobs ()); + auto film = new_test_film("ffmpeg_encoder_h264_test3", { c, s }); + film->set_audio_channels (6); + s->only_text()->set_colour (dcp::Colour (255, 255, 0)); s->only_text()->set_effect (dcp::Effect::SHADOW); s->only_text()->set_effect_colour (dcp::Colour (0, 255, 255)); film->write_metadata(); auto job = make_shared<TranscodeJob> (film, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test3.mp4", ExportFormat::H264_AAC, false, false, false, 23); + FFmpegFilmEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test3.mp4", ExportFormat::H264_AAC, false, false, false, 23); encoder.go (); } @@ -245,13 +230,13 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test3) /** Scope-in-flat DCP -> H264 */ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test4) { - auto film = new_test_film2("ffmpeg_encoder_h264_test4", {make_shared<DCPContent>("test/data/scope_dcp")}); + auto film = new_test_film("ffmpeg_encoder_h264_test4", {make_shared<DCPContent>("test/data/scope_dcp")}); BOOST_REQUIRE(!wait_for_jobs()); film->set_container(Ratio::from_id("185")); auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test4.mp4", ExportFormat::H264_AAC, false, false, false, 23); + FFmpegFilmEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test4.mp4", ExportFormat::H264_AAC, false, false, false, 23); encoder.go(); } @@ -259,24 +244,15 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test4) /** Test mixdown from 5.1 to stereo */ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test5) { - auto film = new_test_film ("ffmpeg_transcoder_h264_test5"); - film->set_name ("ffmpeg_transcoder_h264_test5"); - film->set_container (Ratio::from_id ("185")); - film->set_audio_channels (6); - auto L = make_shared<FFmpegContent>("test/data/L.wav"); - film->examine_and_add_content (L); auto R = make_shared<FFmpegContent>("test/data/R.wav"); - film->examine_and_add_content (R); auto C = make_shared<FFmpegContent>("test/data/C.wav"); - film->examine_and_add_content (C); auto Ls = make_shared<FFmpegContent>("test/data/Ls.wav"); - film->examine_and_add_content (Ls); auto Rs = make_shared<FFmpegContent>("test/data/Rs.wav"); - film->examine_and_add_content (Rs); auto Lfe = make_shared<FFmpegContent>("test/data/Lfe.wav"); - film->examine_and_add_content (Lfe); - BOOST_REQUIRE (!wait_for_jobs ()); + + auto film = new_test_film("ffmpeg_encoder_h264_test5", { L, R, C, Ls, Rs, Lfe }); + film->set_audio_channels (6); AudioMapping map (1, MAX_DCP_AUDIO_CHANNELS); @@ -306,7 +282,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test5) Rs->audio->set_mapping (map); auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test5.mp4", ExportFormat::H264_AAC, true, false, false, 23); + FFmpegFilmEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test5.mp4", ExportFormat::H264_AAC, true, false, false, 23); encoder.go (); check_ffmpeg ("build/test/ffmpeg_encoder_h264_test5.mp4", "test/data/ffmpeg_encoder_h264_test5.mp4", 1); @@ -316,12 +292,12 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test5) /** Test export of a VF */ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test6) { - auto film = new_test_film2 ("ffmpeg_encoder_h264_test6_ov"); + auto film = new_test_film("ffmpeg_encoder_h264_test6_ov"); film->examine_and_add_content (make_shared<ImageContent>(TestPaths::private_data() / "bbc405.png")); BOOST_REQUIRE (!wait_for_jobs()); make_and_verify_dcp (film); - auto film2 = new_test_film2 ("ffmpeg_encoder_h264_test6_vf"); + auto film2 = new_test_film("ffmpeg_encoder_h264_test6_vf"); auto ov = make_shared<DCPContent>("build/test/ffmpeg_encoder_h264_test6_ov/" + film->dcp_name(false)); film2->examine_and_add_content (ov); BOOST_REQUIRE (!wait_for_jobs()); @@ -334,7 +310,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test6) } auto job = make_shared<TranscodeJob>(film2, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_h264_test6_vf.mp4", ExportFormat::H264_AAC, true, false, false, 23); + FFmpegFilmEncoder encoder(film2, job, "build/test/ffmpeg_encoder_h264_test6_vf.mp4", ExportFormat::H264_AAC, true, false, false, 23); encoder.go (); } @@ -342,12 +318,18 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test6) /** Test export of a 3D DCP in a 2D project */ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_3d_dcp_to_h264) { + boost::filesystem::path const output = "build/test/ffmpeg_encoder_3d_dcp_to_h264.mp4"; + Cleanup cl; + cl.add(output); + auto dcp = make_shared<DCPContent>(TestPaths::private_data() / "xm"); - auto film2 = new_test_film2 ("ffmpeg_encoder_3d_dcp_to_h264_export", {dcp}); + auto film2 = new_test_film("ffmpeg_encoder_3d_dcp_to_h264_export", {dcp}); auto job = make_shared<TranscodeJob>(film2, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_3d_dcp_to_h264.mp4", ExportFormat::H264_AAC, true, false, false, 23); + FFmpegFilmEncoder encoder(film2, job, output, ExportFormat::H264_AAC, true, false, false, 23); encoder.go (); + + cl.run(); } @@ -356,7 +338,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test7) { auto L = make_shared<ImageContent>(TestPaths::private_data() / "bbc405.png"); auto R = make_shared<ImageContent>(TestPaths::private_data() / "bbc405.png"); - auto film = new_test_film2 ("ffmpeg_encoder_h264_test7_data", {L, R}); + auto film = new_test_film("ffmpeg_encoder_h264_test7_data", {L, R}); L->video->set_frame_type (VideoFrameType::THREE_D_LEFT); L->set_position (film, DCPTime()); R->video->set_frame_type (VideoFrameType::THREE_D_RIGHT); @@ -365,10 +347,10 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test7) make_and_verify_dcp (film); auto dcp = make_shared<DCPContent>(film->dir(film->dcp_name())); - auto film2 = new_test_film2 ("ffmpeg_encoder_h264_test7_export", {dcp}); + auto film2 = new_test_film("ffmpeg_encoder_h264_test7_export", {dcp}); auto job = make_shared<TranscodeJob> (film2, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_h264_test7.mp4", ExportFormat::H264_AAC, true, false, false, 23); + FFmpegFilmEncoder encoder(film2, job, "build/test/ffmpeg_encoder_h264_test7.mp4", ExportFormat::H264_AAC, true, false, false, 23); encoder.go (); } @@ -376,11 +358,11 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test7) BOOST_AUTO_TEST_CASE(ffmpeg_encoder_2d_content_in_3d_project) { auto content = make_shared<ImageContent>(TestPaths::private_data() / "bbc405.png"); - auto film = new_test_film2("ffmpeg_encoder_2d_content_in_3d_project", { content }); + auto film = new_test_film("ffmpeg_encoder_2d_content_in_3d_project", { content }); film->set_three_d(true); auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder(film, job, "build/test/ffmpeg_encoder_2d_content_in_3d_project.mp4", ExportFormat::H264_AAC, true, false, false, 23); + FFmpegFilmEncoder encoder(film, job, "build/test/ffmpeg_encoder_2d_content_in_3d_project.mp4", ExportFormat::H264_AAC, true, false, false, 23); encoder.go(); } @@ -388,13 +370,13 @@ BOOST_AUTO_TEST_CASE(ffmpeg_encoder_2d_content_in_3d_project) /** Stereo project with mixdown-to-stereo set */ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test8) { - auto film = new_test_film2("ffmpeg_encoder_h264_test4"); + auto film = new_test_film("ffmpeg_encoder_h264_test4"); film->examine_and_add_content(make_shared<DCPContent>("test/data/scope_dcp")); BOOST_REQUIRE(!wait_for_jobs()); film->set_audio_channels (2); auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test8.mp4", ExportFormat::H264_AAC, true, false, false, 23); + FFmpegFilmEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test8.mp4", ExportFormat::H264_AAC, true, false, false, 23); encoder.go(); } @@ -403,7 +385,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test8) BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test9) { auto c = make_shared<ImageContent>(TestPaths::private_data() / "bbc405.png"); - auto film = new_test_film2("ffmpeg_encoder_prores_test9", { c }); + auto film = new_test_film("ffmpeg_encoder_prores_test9", { c }); film->set_name ("ffmpeg_encoder_prores_test9"); film->set_container (Ratio::from_id ("185")); film->set_audio_channels (12); @@ -415,7 +397,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test9) film->write_metadata (); auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test9.mov", ExportFormat::H264_AAC, false, false, false, 23); + FFmpegFilmEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test9.mov", ExportFormat::H264_AAC, false, false, false, 23); encoder.go (); } @@ -424,13 +406,13 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test9) BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_from_dcp_with_crop) { auto dcp = make_shared<DCPContent>("test/data/import_dcp_test2"); - auto film = new_test_film2 ("ffmpeg_encoder_prores_from_dcp_with_crop", { dcp }); + auto film = new_test_film("ffmpeg_encoder_prores_from_dcp_with_crop", { dcp }); dcp->video->set_left_crop (32); dcp->video->set_right_crop (32); film->write_metadata (); auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_from_dcp_with_crop.mov", ExportFormat::PRORES_HQ, false, false, false, 23); + FFmpegFilmEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_from_dcp_with_crop.mov", ExportFormat::PRORES_HQ, false, false, false, 23); encoder.go (); } @@ -439,13 +421,13 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_from_dcp_with_crop) BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_from_dcp_with_crop) { auto dcp = make_shared<DCPContent>("test/data/import_dcp_test2"); - auto film = new_test_film2 ("ffmpeg_encoder_h264_from_dcp_with_crop", { dcp }); + auto film = new_test_film("ffmpeg_encoder_h264_from_dcp_with_crop", { dcp }); dcp->video->set_left_crop (32); dcp->video->set_right_crop (32); film->write_metadata (); auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_from_dcp_with_crop.mov", ExportFormat::H264_AAC, false, false, false, 23); + FFmpegFilmEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_from_dcp_with_crop.mov", ExportFormat::H264_AAC, false, false, false, 23); encoder.go (); } @@ -455,13 +437,13 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_with_reels) { auto content1 = content_factory("test/data/flat_red.png")[0]; auto content2 = content_factory("test/data/flat_red.png")[0]; - auto film = new_test_film2 ("ffmpeg_encoder_h264_with_reels", { content1, content2 }); + auto film = new_test_film("ffmpeg_encoder_h264_with_reels", { content1, content2 }); film->set_reel_type (ReelType::BY_VIDEO_CONTENT); content1->video->set_length (240); content2->video->set_length (240); auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_with_reels.mov", ExportFormat::H264_AAC, false, true, false, 23); + FFmpegFilmEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_with_reels.mov", ExportFormat::H264_AAC, false, true, false, 23); encoder.go (); auto check = [](boost::filesystem::path path) { @@ -482,10 +464,10 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_regression_1) Cleanup cl; auto content = content_factory(TestPaths::private_data() / "arrietty_JP-EN.mkv")[0]; - auto film = new_test_film2 ("ffmpeg_encoder_prores_regression_1", { content }); + auto film = new_test_film("ffmpeg_encoder_prores_regression_1", { content }); auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_regression_1.mov", ExportFormat::PRORES_HQ, false, true, false, 23); + FFmpegFilmEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_regression_1.mov", ExportFormat::PRORES_HQ, false, true, false, 23); encoder.go (); cl.add("build/test/ffmpeg_encoder_prores_regression_1.mov"); @@ -502,10 +484,10 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_regression_2) dcpomatic_log->set_types(logs | LogEntry::TYPE_DEBUG_PLAYER); auto content = content_factory(TestPaths::private_data() / "tge_clip.mkv")[0]; - auto film = new_test_film2 ("ffmpeg_encoder_prores_regression_2", { content }); + auto film = new_test_film("ffmpeg_encoder_prores_regression_2", { content }); auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_regression_2.mov", ExportFormat::PRORES_HQ, false, true, false, 23); + FFmpegFilmEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_regression_2.mov", ExportFormat::PRORES_HQ, false, true, false, 23); encoder.go (); dcpomatic_log->set_types(logs); @@ -518,13 +500,13 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_regression_2) BOOST_AUTO_TEST_CASE(ffmpeg_encoder_missing_frame_at_end) { auto content = content_factory(TestPaths::private_data() / "1s1f.mov"); - auto film = new_test_film2("ffmpeg_encoder_missing_frame_at_end", content); + auto film = new_test_film("ffmpeg_encoder_missing_frame_at_end", content); boost::filesystem::path output("build/test/ffmpeg_encoder_missing_frame_at_end.mov"); boost::filesystem::path log("build/test/ffmpeg_encoder_missing_frame_at_end.log"); auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE); - FFmpegEncoder encoder(film, job, output, ExportFormat::PRORES_HQ, false, true, false, 23); + FFmpegFilmEncoder encoder(film, job, output, ExportFormat::PRORES_HQ, false, true, false, 23); encoder.go(); run_ffprobe(output, log, false, "-show_frames -show_format -show_streams -select_streams v:0"); diff --git a/test/ffmpeg_examiner_test.cc b/test/ffmpeg_examiner_test.cc index c745335ae..c07900db8 100644 --- a/test/ffmpeg_examiner_test.cc +++ b/test/ffmpeg_examiner_test.cc @@ -41,8 +41,8 @@ using namespace dcpomatic; */ BOOST_AUTO_TEST_CASE (ffmpeg_examiner_test) { - auto film = new_test_film ("ffmpeg_examiner_test"); auto content = make_shared<FFmpegContent>("test/data/count300bd24.m2ts"); + auto film = new_test_film("ffmpeg_examiner_test", { content }); auto examiner = make_shared<FFmpegExaminer>(content); BOOST_CHECK_EQUAL (examiner->first_video().get().get(), ContentTime::from_seconds(600).get()); @@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_examiner_probesize_test) BOOST_CHECK_EQUAL (examiner->audio_streams()[0]->frame_rate(), 48000); BOOST_CHECK_EQUAL (examiner->audio_streams()[0]->channels(), 2); BOOST_CHECK_EQUAL (examiner->audio_streams()[1]->frame_rate(), 48000); - BOOST_CHECK_EQUAL (examiner->audio_streams()[1]->channels(), 5); + BOOST_CHECK_EQUAL (examiner->audio_streams()[1]->channels(), 6); } diff --git a/test/ffmpeg_properties_test.cc b/test/ffmpeg_properties_test.cc index 15773ec2f..1e0cdc42f 100644 --- a/test/ffmpeg_properties_test.cc +++ b/test/ffmpeg_properties_test.cc @@ -37,7 +37,7 @@ colour_range_test(string name, boost::filesystem::path file, string ref) { auto content = content_factory(file); BOOST_REQUIRE(!content.empty()); - auto film = new_test_film2(String::compose("ffmpeg_properties_test_%1", name), { content.front() }); + auto film = new_test_film(String::compose("ffmpeg_properties_test_%1", name), { content.front() }); auto properties = content.front()->user_properties(film); auto iter = std::find_if(properties.begin(), properties.end(), [](UserProperty const& property) { return property.key == "Colour range"; }); diff --git a/test/ffmpeg_pts_offset_test.cc b/test/ffmpeg_pts_offset_test.cc index 1f994374d..642d85ff2 100644 --- a/test/ffmpeg_pts_offset_test.cc +++ b/test/ffmpeg_pts_offset_test.cc @@ -41,10 +41,8 @@ using namespace dcpomatic; BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test) { - auto film = new_test_film ("ffmpeg_pts_offset_test"); auto content = make_shared<FFmpegContent>("test/data/test.mp4"); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("ffmpeg_pts_offset_test", { content }); content->audio = make_shared<AudioContent>(content.get()); content->audio->add_stream (shared_ptr<FFmpegAudioStream> (new FFmpegAudioStream)); diff --git a/test/file_extension_test.cc b/test/file_extension_test.cc index 87b55114a..99075fd1c 100644 --- a/test/file_extension_test.cc +++ b/test/file_extension_test.cc @@ -36,7 +36,7 @@ BOOST_AUTO_TEST_CASE (interop_file_extension_test) auto video = content_factory("test/data/flat_red.png")[0]; auto audio = content_factory("test/data/sine_440.wav")[0]; auto sub = content_factory("test/data/15s.srt")[0]; - auto film = new_test_film2("interop_file_extension_test", { video, audio, sub }); + auto film = new_test_film("interop_file_extension_test", { video, audio, sub }); film->set_interop(true); sub->only_text()->set_language(dcp::LanguageTag("de")); @@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE (smpte_file_extension_test) auto video = content_factory("test/data/flat_red.png")[0]; auto audio = content_factory("test/data/sine_440.wav")[0]; auto sub = content_factory("test/data/15s.srt")[0]; - auto film = new_test_film2("smpte_file_extension_test", { video, audio, sub }); + auto film = new_test_film("smpte_file_extension_test", { video, audio, sub }); film->set_interop(false); make_and_verify_dcp( diff --git a/test/file_naming_test.cc b/test/file_naming_test.cc index 1b5871bd2..2aa81cd4f 100644 --- a/test/file_naming_test.cc +++ b/test/file_naming_test.cc @@ -61,17 +61,11 @@ BOOST_AUTO_TEST_CASE (file_naming_test) ConfigRestorer cr; Config::instance()->set_dcp_asset_filename_format (dcp::NameFormat("%c")); - auto film = new_test_film ("file_naming_test"); - film->set_name ("file_naming_test"); - film->set_video_frame_rate (24); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); auto r = make_shared<FFmpegContent>("test/data/flat_red.png"); - film->examine_and_add_content (r); auto g = make_shared<FFmpegContent>("test/data/flat_green.png"); - film->examine_and_add_content (g); auto b = make_shared<FFmpegContent>("test/data/flat_blue.png"); - film->examine_and_add_content (b); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("file_naming_test", { r, g, b }); + film->set_video_frame_rate (24); r->set_position (film, dcpomatic::DCPTime::from_seconds(0)); r->set_video_frame_rate(film, 24); @@ -115,10 +109,6 @@ BOOST_AUTO_TEST_CASE (file_naming_test2) Config::instance()->set_dcp_asset_filename_format (dcp::NameFormat ("%c")); - auto film = new_test_film ("file_naming_test2"); - film->set_name ("file_naming_test2"); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); - #ifdef DCPOMATIC_WINDOWS /* This is necessary so that the UTF8 string constant below gets converted properly */ std::locale::global(boost::locale::generator().generate("")); @@ -126,12 +116,9 @@ BOOST_AUTO_TEST_CASE (file_naming_test2) #endif auto r = make_shared<FFmpegContent>("test/data/flät_red.png"); - film->examine_and_add_content (r); auto g = make_shared<FFmpegContent>("test/data/flat_green.png"); - film->examine_and_add_content (g); auto b = make_shared<FFmpegContent>("test/data/flat_blue.png"); - film->examine_and_add_content (b); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("file_naming_test2", { r, g, b }); r->set_position (film, dcpomatic::DCPTime::from_seconds(0)); r->set_video_frame_rate(film, 24); @@ -175,7 +162,7 @@ BOOST_AUTO_TEST_CASE (subtitle_file_naming) Config::instance()->set_dcp_asset_filename_format(dcp::NameFormat("%t ostrabagalous %c")); auto content = content_factory("test/data/15s.srt"); - auto film = new_test_film2("subtitle_file_naming", content); + auto film = new_test_film("subtitle_file_naming", content); film->set_interop(false); make_and_verify_dcp ( @@ -208,7 +195,7 @@ BOOST_AUTO_TEST_CASE(remove_bad_characters_from_template) Config::instance()->set_dcp_asset_filename_format(dcp::NameFormat("%c%z")); auto content = content_factory("test/data/flat_red.png"); - auto film = new_test_film2("remove_bad_characters_from_template", content); + auto film = new_test_film("remove_bad_characters_from_template", content); make_and_verify_dcp( film, { diff --git a/test/film_metadata_test.cc b/test/film_metadata_test.cc index 878e60254..b99d1a572 100644 --- a/test/film_metadata_test.cc +++ b/test/film_metadata_test.cc @@ -47,17 +47,17 @@ using std::vector; BOOST_AUTO_TEST_CASE (film_metadata_test) { - auto film = new_test_film ("film_metadata_test"); + auto film = new_test_film("film_metadata_test"); auto dir = test_film_dir ("film_metadata_test"); film->_isdcf_date = boost::gregorian::from_undelimited_string ("20130211"); BOOST_CHECK (film->container() == Ratio::from_id ("185")); - BOOST_CHECK (film->dcp_content_type() == nullptr); + BOOST_CHECK (film->dcp_content_type() == DCPContentType::from_isdcf_name("TST")); film->set_name ("fred"); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("SHR")); film->set_container (Ratio::from_id ("185")); - film->set_j2k_bandwidth (200000000); + film->set_video_bit_rate(VideoEncoding::JPEG2000, 200000000); film->set_interop (false); film->set_chain (string("")); film->set_distributor (string("")); @@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE (film_metadata_test) film->set_audio_channels(6); film->write_metadata (); - list<string> ignore = { "Key", "ContextID", "LastWrittenBy" }; + list<Glib::ustring> ignore = { "Key", "ContextID", "LastWrittenBy" }; check_xml ("test/data/metadata.xml.ref", dir.string() + "/metadata.xml", ignore); auto g = make_shared<Film>(dir); @@ -84,9 +84,11 @@ BOOST_AUTO_TEST_CASE (film_metadata_test) /** Check a bug where <Content> tags with multiple <Text>s would fail to load */ BOOST_AUTO_TEST_CASE (multiple_text_nodes_are_allowed) { + Cleanup cl; + auto subs = content_factory("test/data/15s.srt")[0]; auto caps = content_factory("test/data/15s.srt")[0]; - auto film = new_test_film2("multiple_text_nodes_are_allowed1", { subs, caps }); + auto film = new_test_film("multiple_text_nodes_are_allowed1", { subs, caps }, &cl); caps->only_text()->set_type(TextType::CLOSED_CAPTION); make_and_verify_dcp ( film, @@ -97,11 +99,13 @@ BOOST_AUTO_TEST_CASE (multiple_text_nodes_are_allowed) }); auto reload = make_shared<DCPContent>(film->dir(film->dcp_name())); - auto film2 = new_test_film2("multiple_text_nodes_are_allowed2", { reload }); + auto film2 = new_test_film("multiple_text_nodes_are_allowed2", { reload }); film2->write_metadata (); auto test = make_shared<Film>(boost::filesystem::path("build/test/multiple_text_nodes_are_allowed2")); test->read_metadata(); + + cl.run(); } @@ -217,7 +221,7 @@ BOOST_AUTO_TEST_CASE (metadata_video_range_guessed_for_png) BOOST_AUTO_TEST_CASE(effect_node_not_inserted_incorrectly) { auto sub = content_factory("test/data/15s.srt"); - auto film = new_test_film2("effect_node_not_inserted_incorrectly", sub); + auto film = new_test_film("effect_node_not_inserted_incorrectly", sub); film->write_metadata(); namespace fs = boost::filesystem; diff --git a/test/film_test.cc b/test/film_test.cc index e8f04dc93..3493c79ce 100644 --- a/test/film_test.cc +++ b/test/film_test.cc @@ -31,16 +31,16 @@ BOOST_AUTO_TEST_CASE(film_contains_atmos_content_test) auto image = content_factory("test/data/flat_red.png")[0]; auto sound = content_factory("test/data/white.wav")[0]; - auto film1 = new_test_film2("film_contains_atmos_content_test1", { atmos, image, sound }); + auto film1 = new_test_film("film_contains_atmos_content_test1", { atmos, image, sound }); BOOST_CHECK(film1->contains_atmos_content()); - auto film2 = new_test_film2("film_contains_atmos_content_test2", { sound, atmos, image }); + auto film2 = new_test_film("film_contains_atmos_content_test2", { sound, atmos, image }); BOOST_CHECK(film2->contains_atmos_content()); - auto film3 = new_test_film2("film_contains_atmos_content_test3", { image, sound, atmos }); + auto film3 = new_test_film("film_contains_atmos_content_test3", { image, sound, atmos }); BOOST_CHECK(film3->contains_atmos_content()); - auto film4 = new_test_film2("film_contains_atmos_content_test4", { image, sound }); + auto film4 = new_test_film("film_contains_atmos_content_test4", { image, sound }); BOOST_CHECK(!film4->contains_atmos_content()); } diff --git a/test/find_missing_test.cc b/test/find_missing_test.cc index 51ae5800c..c85ddea7f 100644 --- a/test/find_missing_test.cc +++ b/test/find_missing_test.cc @@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE (find_missing_test_with_single_files) copy_file ("test/data/flat_red.png", content_dir / "C.png"); /* Make a film with that content */ - auto film = new_test_film2 (name + "_film", { + auto film = new_test_film(name + "_film", { content_factory(content_dir / "A.png")[0], content_factory(content_dir / "B.png")[0], content_factory(content_dir / "C.png")[0] @@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE (find_missing_test_with_multiple_files) } /* Make a film containing that DCP */ - auto film = new_test_film2 (name + "_film", { make_shared<DCPContent>(content_dir) }); + auto film = new_test_film(name + "_film", { make_shared<DCPContent>(content_dir) }); film->write_metadata (); /* Move the DCP's content elsewhere */ @@ -126,7 +126,7 @@ BOOST_AUTO_TEST_CASE (find_missing_test_with_multiple_files_one_incorrect) } /* Make a film containing that DCP */ - auto film = new_test_film2 (name + "_film", { make_shared<DCPContent>(content_dir) }); + auto film = new_test_film(name + "_film", { make_shared<DCPContent>(content_dir) }); film->write_metadata (); /* Move the DCP's content elsewhere */ diff --git a/test/frame_rate_test.cc b/test/frame_rate_test.cc index d54868b3f..d87f7bfc5 100644 --- a/test/frame_rate_test.cc +++ b/test/frame_rate_test.cc @@ -44,11 +44,8 @@ */ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single) { - auto film = new_test_film("best_dcp_frame_rate_test_single"); - /* Get any piece of content, it doesn't matter what */ auto content = std::make_shared<FFmpegContent>("test/data/test.mp4"); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("best_dcp_frame_rate_test_single", { content }); /* Run some tests with a limited range of allowed rates */ @@ -222,20 +219,13 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single) */ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_double) { - auto film = new_test_film("best_dcp_frame_rate_test_double"); - /* Get any old content, it doesn't matter what */ auto A = std::make_shared<FFmpegContent>("test/data/test.mp4"); - film->examine_and_add_content (A); auto B = std::make_shared<FFmpegContent>("test/data/test.mp4"); - film->examine_and_add_content (B); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("best_dcp_frame_rate_test_double", { A, B }); /* Run some tests with a limited range of allowed rates */ - std::list<int> afr; - afr.push_back (24); - afr.push_back (25); - afr.push_back (30); + std::list<int> afr = { 24, 25, 30 }; Config::instance()->set_allowed_dcp_frame_rates (afr); A->_video_frame_rate = 30; @@ -253,16 +243,10 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_double) BOOST_AUTO_TEST_CASE (audio_sampling_rate_test) { - auto film = new_test_film("audio_sampling_rate_test"); - /* Get any piece of content, it doesn't matter what */ auto content = std::make_shared<FFmpegContent>("test/data/test.mp4"); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("audio_sampling_rate_test", { content }); - std::list<int> afr; - afr.push_back (24); - afr.push_back (25); - afr.push_back (30); + std::list<int> afr = { 24, 25, 30 }; Config::instance()->set_allowed_dcp_frame_rates (afr); auto stream = std::make_shared<FFmpegAudioStream>("foo", 0, 0, 0, 0, 0); diff --git a/test/guess_crop_test.cc b/test/guess_crop_test.cc index ccced0b3e..c58432382 100644 --- a/test/guess_crop_test.cc +++ b/test/guess_crop_test.cc @@ -35,7 +35,7 @@ using namespace dcpomatic; BOOST_AUTO_TEST_CASE (guess_crop_image_test1) { auto content = content_factory(TestPaths::private_data() / "arrietty_724.tiff"); - auto film = new_test_film2 ("guess_crop_image_test1", content); + auto film = new_test_film("guess_crop_image_test1", content); BOOST_CHECK (guess_crop(film, content[0], 0.1, {}) == Crop(0, 0, 11, 11)); } @@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE (guess_crop_image_test1) BOOST_AUTO_TEST_CASE (guess_crop_image_test2) { auto content = content_factory(TestPaths::private_data() / "prophet_frame.tiff"); - auto film = new_test_film2 ("guess_crop_image_test2", content); + auto film = new_test_film("guess_crop_image_test2", content); BOOST_CHECK(guess_crop(film, content[0], 0.1, {}) == Crop(0, 0, 22, 22)); } @@ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE (guess_crop_image_test2) BOOST_AUTO_TEST_CASE (guess_crop_image_test3) { auto content = content_factory(TestPaths::private_data() / "pillarbox.png"); - auto film = new_test_film2 ("guess_crop_image_test3", content); + auto film = new_test_film("guess_crop_image_test3", content); BOOST_CHECK(guess_crop(film, content[0], 0.1, {}) == Crop(113, 262, 0, 0)); } diff --git a/test/hints_test.cc b/test/hints_test.cc index 949ba18c0..8768815ad 100644 --- a/test/hints_test.cc +++ b/test/hints_test.cc @@ -72,7 +72,7 @@ static void check (TextType type, string name, optional<string> expected_hint = optional<string>()) { - auto film = new_test_film2 (name); + auto film = new_test_film(name); auto content = content_factory("test/data/" + name + ".srt")[0]; content->text.front()->set_type (type); content->text.front()->set_language (dcp::LanguageTag("en-US")); @@ -183,7 +183,7 @@ BOOST_AUTO_TEST_CASE (hint_subtitle_mxf_too_big) { string const name = "hint_subtitle_mxf_too_big"; - auto film = new_test_film2 (name); + auto film = new_test_film(name); for (int i = 0; i < 4; ++i) { dcp::File fake_font("build/test/hint_subtitle_mxf_too_big.ttf", "w"); @@ -218,7 +218,7 @@ BOOST_AUTO_TEST_CASE (hint_closed_caption_xml_too_big) { string const name = "hint_closed_caption_xml_too_big"; - auto film = new_test_film2 (name); + auto film = new_test_film(name); dcp::File ccap(String::compose("build/test/%1.srt", name), "w"); BOOST_REQUIRE (ccap); @@ -249,7 +249,7 @@ BOOST_AUTO_TEST_CASE (hint_closed_caption_xml_too_big) BOOST_AUTO_TEST_CASE (hints_destroyed_while_running) { - auto film = new_test_film2 ("hints_destroyed_while_running"); + auto film = new_test_film("hints_destroyed_while_running"); auto content = content_factory(TestPaths::private_data() / "boon_telly.mkv")[0]; film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs()); @@ -265,7 +265,7 @@ BOOST_AUTO_TEST_CASE (hints_destroyed_while_running) BOOST_AUTO_TEST_CASE (hints_audio_with_no_language) { auto content = content_factory("test/data/sine_440.wav")[0]; - auto film = new_test_film2 ("hints_audio_with_no_language", { content }); + auto film = new_test_film("hints_audio_with_no_language", { content }); content->audio->set_gain (-6); auto hints = get_hints (film); @@ -284,7 +284,7 @@ BOOST_AUTO_TEST_CASE (hints_certificate_validity) Config::instance()->set_signer_chain(make_shared<dcp::CertificateChain>(openssl_path(), 40 * 365)); - auto film = new_test_film2 ("hints_certificate_validity"); + auto film = new_test_film("hints_certificate_validity"); auto hints = get_hints (film); BOOST_REQUIRE_EQUAL (hints.size(), 1U); BOOST_CHECK_EQUAL ( diff --git a/test/image_content_fade_test.cc b/test/image_content_fade_test.cc index d7f03ad51..5ac63405a 100644 --- a/test/image_content_fade_test.cc +++ b/test/image_content_fade_test.cc @@ -33,7 +33,7 @@ using std::list; BOOST_AUTO_TEST_CASE (image_content_fade_test) { - auto film = new_test_film2 ("image_content_fade_test"); + auto film = new_test_film("image_content_fade_test"); auto content = content_factory("test/data/flat_red.png")[0]; film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs()); diff --git a/test/image_filename_sorter_test.cc b/test/image_filename_sorter_test.cc index eb662a120..29b550753 100644 --- a/test/image_filename_sorter_test.cc +++ b/test/image_filename_sorter_test.cc @@ -28,9 +28,10 @@ #include "lib/image_filename_sorter.h" #include "lib/compose.hpp" #include <boost/test/unit_test.hpp> +#include <algorithm> +#include <random> -using std::random_shuffle; using std::sort; using std::vector; @@ -69,7 +70,11 @@ BOOST_AUTO_TEST_CASE (image_filename_sorter_test2) for (int i = 0; i < 100000; ++i) { paths.push_back(String::compose("some.filename.with.%1.number.tiff", i)); } - random_shuffle (paths.begin(), paths.end()); + + std::random_device rd; + std::mt19937 generator(rd()); + std::shuffle(paths.begin(), paths.end(), generator); + sort (paths.begin(), paths.end(), ImageFilenameSorter()); for (int i = 0; i < 100000; ++i) { BOOST_CHECK_EQUAL(paths[i].string(), String::compose("some.filename.with.%1.number.tiff", i)); diff --git a/test/import_dcp_test.cc b/test/import_dcp_test.cc index 7387c7be7..e9f7f068b 100644 --- a/test/import_dcp_test.cc +++ b/test/import_dcp_test.cc @@ -56,17 +56,10 @@ BOOST_AUTO_TEST_CASE (import_dcp_test) { ConfigRestorer cr; - auto A = new_test_film ("import_dcp_test"); - A->set_container (Ratio::from_id ("185")); - A->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); - A->set_name ("frobozz"); - A->set_interop (false); - auto c = make_shared<FFmpegContent>("test/data/test.mp4"); - A->examine_and_add_content (c); + auto A = new_test_film("import_dcp_test", { c }); A->set_encrypted (true); - BOOST_CHECK (!wait_for_jobs ()); - + A->set_dcp_content_type(DCPContentType::from_isdcf_name("TLR")); make_and_verify_dcp (A); dcp::DCP A_dcp ("build/test/import_dcp_test/" + A->dcp_name()); @@ -80,20 +73,11 @@ BOOST_AUTO_TEST_CASE (import_dcp_test) auto const decrypted_kdm = A->make_kdm(A_dcp.cpls().front()->file().get(), dcp::LocalTime ("2030-07-21T00:00:00+00:00"), dcp::LocalTime ("2031-07-21T00:00:00+00:00")); auto const kdm = decrypted_kdm.encrypt(signer, Config::instance()->decryption_chain()->leaf(), {}, dcp::Formulation::MODIFIED_TRANSITIONAL_1, true, 0); - auto B = new_test_film ("import_dcp_test2"); - B->set_container (Ratio::from_id ("185")); - B->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); - B->set_name ("frobozz"); - B->set_interop (false); - B->set_audio_channels(16); - auto d = make_shared<DCPContent>("build/test/import_dcp_test/" + A->dcp_name()); - B->examine_and_add_content (d); - BOOST_CHECK (!wait_for_jobs ()); d->add_kdm (kdm); - JobManager::instance()->add (make_shared<ExamineContentJob>(B, d)); - BOOST_CHECK (!wait_for_jobs ()); - + auto B = new_test_film("import_dcp_test2", { d }); + B->set_dcp_content_type(DCPContentType::from_isdcf_name("TLR")); + B->set_audio_channels(16); make_and_verify_dcp (B); /* Should be 1s red, 1s green, 1s blue */ @@ -108,7 +92,7 @@ BOOST_AUTO_TEST_CASE (import_dcp_markers_test) /* Make a DCP with some markers */ auto content = content_factory("test/data/flat_red.png"); - auto film = new_test_film2 ("import_dcp_markers_test", content, &cl); + auto film = new_test_film("import_dcp_markers_test", content, &cl); content[0]->video->set_length (24 * 60 * 10); @@ -120,7 +104,7 @@ BOOST_AUTO_TEST_CASE (import_dcp_markers_test) /* Import the DCP to a new film and check the markers */ auto imported = make_shared<DCPContent>(film->dir(film->dcp_name())); - auto film2 = new_test_film2 ("import_dcp_markers_test2", {imported}, &cl); + auto film2 = new_test_film("import_dcp_markers_test2", {imported}, &cl); film2->write_metadata (); /* When import_dcp_markers_test was made a LFOC marker will automatically @@ -157,7 +141,7 @@ BOOST_AUTO_TEST_CASE (import_dcp_markers_test) BOOST_AUTO_TEST_CASE (import_dcp_metadata_test) { /* Make a DCP with some ratings and a content version */ - auto film = new_test_film2 ("import_dcp_metadata_test"); + auto film = new_test_film("import_dcp_metadata_test"); auto content = content_factory("test/data/flat_red.png")[0]; film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs()); @@ -173,7 +157,7 @@ BOOST_AUTO_TEST_CASE (import_dcp_metadata_test) make_and_verify_dcp (film); /* Import the DCP to a new film and check the metadata */ - auto film2 = new_test_film2 ("import_dcp_metadata_test2"); + auto film2 = new_test_film("import_dcp_metadata_test2"); auto imported = make_shared<DCPContent>(film->dir(film->dcp_name())); film2->examine_and_add_content (imported); BOOST_REQUIRE (!wait_for_jobs()); diff --git a/test/interrupt_encoder_test.cc b/test/interrupt_encoder_test.cc index f0755d3a0..c786a3110 100644 --- a/test/interrupt_encoder_test.cc +++ b/test/interrupt_encoder_test.cc @@ -45,14 +45,8 @@ using std::make_shared; */ BOOST_AUTO_TEST_CASE (interrupt_encoder_test) { - auto film = new_test_film ("interrupt_encoder_test"); - film->set_dcp_content_type (DCPContentType::from_isdcf_name("FTR")); - film->set_container (Ratio::from_id("185")); - film->set_name ("interrupt_encoder_test"); - auto content = make_shared<FFmpegContent>(TestPaths::private_data() / "prophet_long_clip.mkv"); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("interrupt_encoder_test", { content }); make_dcp (film, TranscodeJob::ChangedBehaviour::IGNORE); diff --git a/test/isdcf_name_test.cc b/test/isdcf_name_test.cc index 56686d2ac..3897aabbe 100644 --- a/test/isdcf_name_test.cc +++ b/test/isdcf_name_test.cc @@ -46,7 +46,8 @@ using std::string; BOOST_AUTO_TEST_CASE (isdcf_name_test) { - auto film = new_test_film ("isdcf_name_test"); + auto audio = content_factory("test/data/sine_440.wav")[0]; + auto film = new_test_film("isdcf_name_test", { audio }); /* A basic test */ @@ -54,9 +55,6 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test) film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); film->set_container (Ratio::from_id ("185")); film->_isdcf_date = boost::gregorian::date (2014, boost::gregorian::Jul, 4); - auto audio = content_factory("test/data/sine_440.wav")[0]; - film->examine_and_add_content (audio); - BOOST_REQUIRE (!wait_for_jobs()); film->set_audio_language(dcp::LanguageTag("en-US")); film->set_content_versions({"1"}); film->set_release_territory(dcp::LanguageTag::RegionSubtag("GB")); @@ -103,7 +101,7 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test) /* Test interior aspect ratio: shouldn't be shown with trailers */ - shared_ptr<ImageContent> content (new ImageContent ("test/data/simple_testcard_640x480.png")); + auto content = std::make_shared<ImageContent>("test/data/simple_testcard_640x480.png"); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs()); content->video->set_custom_ratio (1.33); @@ -242,7 +240,7 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test) BOOST_AUTO_TEST_CASE(isdcf_name_with_atmos) { auto content = content_factory(TestPaths::private_data() / "atmos_asset.mxf"); - auto film = new_test_film2("isdcf_name_with_atmos", content); + auto film = new_test_film("isdcf_name_with_atmos", content); film->_isdcf_date = boost::gregorian::date(2023, boost::gregorian::Jan, 18); film->set_name("Hello"); @@ -253,7 +251,7 @@ BOOST_AUTO_TEST_CASE(isdcf_name_with_atmos) BOOST_AUTO_TEST_CASE(isdcf_name_with_ccap) { auto content = content_factory("test/data/short.srt")[0]; - auto film = new_test_film2("isdcf_name_with_ccap", { content }); + auto film = new_test_film("isdcf_name_with_ccap", { content }); content->text[0]->set_use(true); content->text[0]->set_type(TextType::CLOSED_CAPTION); content->text[0]->set_dcp_track(DCPTextTrack("Foo", dcp::LanguageTag("de-DE"))); diff --git a/test/j2k_encode_threading_test.cc b/test/j2k_encode_threading_test.cc new file mode 100644 index 000000000..1f57f4143 --- /dev/null +++ b/test/j2k_encode_threading_test.cc @@ -0,0 +1,117 @@ +/* + Copyright (C) 2023 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic 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. + + DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + + +#include "lib/config.h" +#include "lib/content_factory.h" +#include "lib/dcp_film_encoder.h" +#include "lib/dcp_transcode_job.h" +#include "lib/encode_server_description.h" +#include "lib/film.h" +#include "lib/j2k_encoder.h" +#include "lib/job_manager.h" +#include "lib/make_dcp.h" +#include "lib/transcode_job.h" +#include "test.h" +#include <dcp/cpl.h> +#include <dcp/dcp.h> +#include <dcp/reel.h> +#include <dcp/reel_picture_asset.h> +#include <boost/test/unit_test.hpp> + + +using std::dynamic_pointer_cast; +using std::list; + + +BOOST_AUTO_TEST_CASE(local_threads_created_and_destroyed) +{ + auto film = new_test_film("local_threads_created_and_destroyed", {}); + Writer writer(film, {}, "foo"); + J2KEncoder encoder(film, writer); + + encoder.remake_threads(32, 0, {}); + BOOST_CHECK_EQUAL(encoder._threads.size(), 32U); + + encoder.remake_threads(9, 0, {}); + BOOST_CHECK_EQUAL(encoder._threads.size(), 9U); + + encoder.end(); + BOOST_CHECK_EQUAL(encoder._threads.size(), 0U); +} + + +BOOST_AUTO_TEST_CASE(remote_threads_created_and_destroyed) +{ + auto film = new_test_film("remote_threads_created_and_destroyed", {}); + Writer writer(film, {}, "foo"); + J2KEncoder encoder(film, writer); + + list<EncodeServerDescription> servers = { + { "fred", 7, SERVER_LINK_VERSION }, + { "jim", 2, SERVER_LINK_VERSION }, + { "sheila", 14, SERVER_LINK_VERSION }, + }; + + encoder.remake_threads(0, 0, servers); + BOOST_CHECK_EQUAL(encoder._threads.size(), 7U + 2U + 14U); + + servers = { + { "fred", 7, SERVER_LINK_VERSION }, + { "jim", 5, SERVER_LINK_VERSION }, + { "sheila", 14, SERVER_LINK_VERSION }, + }; + + encoder.remake_threads(0, 0, servers); + BOOST_CHECK_EQUAL(encoder._threads.size(), 7U + 5U + 14U); + + servers = { + { "fred", 0, SERVER_LINK_VERSION }, + { "jim", 0, SERVER_LINK_VERSION }, + { "sheila", 11, SERVER_LINK_VERSION }, + }; + + encoder.remake_threads(0, 0, servers); + BOOST_CHECK_EQUAL(encoder._threads.size(), 11U); +} + + +BOOST_AUTO_TEST_CASE(frames_not_lost_when_threads_disappear) +{ + auto content = content_factory(TestPaths::private_data() / "clapperboard.mp4"); + auto film = new_test_film("frames_not_lost", content); + film->write_metadata(); + auto job = make_dcp(film, TranscodeJob::ChangedBehaviour::IGNORE); + auto encoder = dynamic_cast<J2KEncoder*>(dynamic_pointer_cast<DCPFilmEncoder>(job->_encoder)->_encoder.get()); + + while (JobManager::instance()->work_to_do()) { + encoder->remake_threads(rand() % 8, 0, {}); + dcpomatic_sleep_seconds(1); + } + + BOOST_CHECK(!JobManager::instance()->errors()); + + dcp::DCP dcp(film->dir(film->dcp_name())); + dcp.read(); + BOOST_REQUIRE_EQUAL(dcp.cpls().size(), 1U); + BOOST_REQUIRE_EQUAL(dcp.cpls()[0]->reels().size(), 1U); + BOOST_REQUIRE_EQUAL(dcp.cpls()[0]->reels()[0]->main_picture()->intrinsic_duration(), 423U); +} + diff --git a/test/j2k_encoder_test.cc b/test/j2k_encoder_test.cc index bc3bd97b2..083a61cf8 100644 --- a/test/j2k_encoder_test.cc +++ b/test/j2k_encoder_test.cc @@ -42,10 +42,10 @@ BOOST_AUTO_TEST_CASE(j2k_encoder_deadlock_test) { ConfigRestorer cr; - auto film = new_test_film2("j2k_encoder_deadlock_test"); + auto film = new_test_film("j2k_encoder_deadlock_test"); /* Don't call ::start() on this Writer, so it can never write anything */ - Writer writer(film, {}); + Writer writer(film, {}, {}); writer.set_encoder_threads(4); /* We want to test the case where the writer queue fills, and this can't happen unless there @@ -71,7 +71,7 @@ BOOST_AUTO_TEST_CASE(j2k_encoder_deadlock_test) optional<ColourConversion>(), VideoRange::VIDEO, weak_ptr<Content>(), - optional<Frame>(), + optional<dcpomatic::ContentTime>(), false ), {} diff --git a/test/j2k_bandwidth_test.cc b/test/j2k_video_bit_rate_test.cc index f9e47c4b9..b3eccd98a 100644 --- a/test/j2k_bandwidth_test.cc +++ b/test/j2k_video_bit_rate_test.cc @@ -19,7 +19,7 @@ */ -/** @file test/bandwidth_test.cc +/** @file test/j2k_video_bit_rate_test.cc * @brief Test whether we output whatever J2K bandwidth is requested. * @ingroup feature */ @@ -41,16 +41,14 @@ using std::string; static void check (int target_bits_per_second) { + Cleanup cl; + int const duration = 10; string const name = "bandwidth_test_" + dcp::raw_convert<string> (target_bits_per_second); - auto film = new_test_film (name); - film->set_name (name); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); - film->set_j2k_bandwidth (target_bits_per_second); auto content = make_shared<ImageContent>(TestPaths::private_data() / "prophet_frame.tiff"); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film(name, { content }, &cl); + film->set_video_bit_rate(VideoEncoding::JPEG2000, target_bits_per_second); content->video->set_length (24 * duration); make_and_verify_dcp ( film, @@ -65,15 +63,14 @@ check (int target_bits_per_second) target_bits_per_second <= 250000000 ); - boost::filesystem::directory_iterator i (boost::filesystem::path("build") / "test" / name / "video"); - boost::filesystem::path test = *i++; - BOOST_REQUIRE (i == boost::filesystem::directory_iterator()); - + auto test = find_file(film->dir(film->dcp_name()), "j2c_"); double actual_bits_per_second = boost::filesystem::file_size(test) * 8.0 / duration; /* Check that we're within 85% to 115% of target on average */ BOOST_CHECK ((actual_bits_per_second / target_bits_per_second) > 0.85); BOOST_CHECK ((actual_bits_per_second / target_bits_per_second) < 1.15); + + cl.run(); } diff --git a/test/kdm_cli_test.cc b/test/kdm_cli_test.cc index e79e37b2d..f8c85cb5a 100644 --- a/test/kdm_cli_test.cc +++ b/test/kdm_cli_test.cc @@ -20,8 +20,11 @@ #include "lib/cinema.h" +#include "lib/cinema_list.h" #include "lib/config.h" #include "lib/content_factory.h" +#include "lib/cross.h" +#include "lib/dkdm_wrapper.h" #include "lib/film.h" #include "lib/kdm_cli.h" #include "lib/screen.h" @@ -33,13 +36,14 @@ #include <iostream> +using std::dynamic_pointer_cast; using std::string; using std::vector; using boost::optional; optional<string> -run(vector<string> const& args, vector<string>& output) +run(vector<string> const& args, vector<string>& output, bool dump_errors = true) { std::vector<char*> argv(args.size()); for (auto i = 0U; i < args.size(); ++i) { @@ -47,7 +51,7 @@ run(vector<string> const& args, vector<string>& output) } auto error = kdm_cli(args.size(), argv.data(), [&output](string s) { output.push_back(s); }); - if (error) { + if (error && dump_errors) { std::cout << *error << "\n"; } @@ -62,7 +66,7 @@ BOOST_AUTO_TEST_CASE (kdm_cli_test_certificate) "--verbose", "--valid-from", "now", "--valid-duration", "2 weeks", - "--certificate", "test/data/cert.pem", + "--projector-certificate", "test/data/cert.pem", "-S", "my great screen", "-o", "build/test", "test/data/dkdm.xml" @@ -80,6 +84,70 @@ BOOST_AUTO_TEST_CASE (kdm_cli_test_certificate) } +BOOST_AUTO_TEST_CASE(kdm_cli_specify_decryption_key_test) +{ + using boost::filesystem::path; + + ConfigRestorer cr; + + path const dir = "build/test/kdm_cli_specify_decryption_key_test"; + + boost::system::error_code ec; + boost::filesystem::remove_all(dir, ec); + boost::filesystem::create_directories(dir); + + dcp::CertificateChain chain(openssl_path(), 365); + dcp::write_string_to_file(chain.leaf().certificate(true), dir / "cert.pem"); + dcp::write_string_to_file(*chain.key(), dir / "key.pem"); + + vector<string> make_args = { + "kdm_cli", + "--valid-from", "now", + "--valid-duration", "2 weeks", + "--projector-certificate", path(dir / "cert.pem").string(), + "-S", "base", + "-o", dir.string(), + "test/data/dkdm.xml" + }; + + vector<string> output; + auto error = run(make_args, output); + BOOST_CHECK(!error); + + vector<string> bad_args = { + "kdm_cli", + "--valid-from", "now", + "--valid-duration", "2 weeks", + "--projector-certificate", path(dir / "cert.pem").string(), + "-S", "bad", + "-o", dir.string(), + path(dir / "KDM_Test_FTR-1_F-133_XX-XX_MOS_2K_20220109_SMPTE_OV__base.xml").string() + }; + + /* This should fail because we're using the wrong decryption certificate */ + output.clear(); + error = run(bad_args, output, false); + BOOST_REQUIRE(error); + BOOST_CHECK_MESSAGE(error->find("Could not decrypt KDM") != string::npos, "Error was " << *error); + + vector<string> good_args = { + "kdm_cli", + "--valid-from", "now", + "--valid-duration", "2 weeks", + "--projector-certificate", path(dir / "cert.pem").string(), + "--decryption-key", path(dir / "key.pem").string(), + "-S", "good", + "-o", dir.string(), + path(dir / "KDM_Test_FTR-1_F-133_XX-XX_MOS_2K_20220109_SMPTE_OV__base.xml").string() + }; + + /* This should succeed */ + output.clear(); + error = run(good_args, output); + BOOST_CHECK(!error); +} + + static void setup_test_config() @@ -87,16 +155,16 @@ setup_test_config() auto config = Config::instance(); auto const cert = dcp::Certificate(dcp::file_to_string("test/data/cert.pem")); - auto cinema_a = std::make_shared<Cinema>("Dean's Screens", vector<string>(), "", 0, 0); - cinema_a->add_screen(std::make_shared<dcpomatic::Screen>("Screen 1", "", cert, boost::none, std::vector<TrustedDevice>())); - cinema_a->add_screen(std::make_shared<dcpomatic::Screen>("Screen 2", "", cert, boost::none, std::vector<TrustedDevice>())); - cinema_a->add_screen(std::make_shared<dcpomatic::Screen>("Screen 3", "", cert, boost::none, std::vector<TrustedDevice>())); - config->add_cinema(cinema_a); + CinemaList cinemas(config->cinemas_file()); - auto cinema_b = std::make_shared<Cinema>("Floyd's Celluloid", vector<string>(), "", 0, 0); - cinema_b->add_screen(std::make_shared<dcpomatic::Screen>("Foo", "", cert, boost::none, std::vector<TrustedDevice>())); - cinema_b->add_screen(std::make_shared<dcpomatic::Screen>("Bar", "", cert, boost::none, std::vector<TrustedDevice>())); - config->add_cinema(cinema_b); + auto cinema_a = cinemas.add_cinema({"Dean's Screens", {}, "", dcp::UTCOffset()}); + cinemas.add_screen(cinema_a, {"Screen 1", "", cert, boost::none, {}}); + cinemas.add_screen(cinema_a, {"Screen 2", "", cert, boost::none, {}}); + cinemas.add_screen(cinema_a, {"Screen 3", "", cert, boost::none, {}}); + + auto cinema_b = cinemas.add_cinema({"Floyd's Celluloid", {}, "", dcp::UTCOffset()}); + cinemas.add_screen(cinema_b, {"Foo", "", cert, boost::none, std::vector<TrustedDevice>()}); + cinemas.add_screen(cinema_b, {"Bar", "", cert, boost::none, std::vector<TrustedDevice>()}); } @@ -183,8 +251,8 @@ BOOST_AUTO_TEST_CASE(kdm_cli_specify_cinemas_file) vector<string> args = { "kdm_cli", "--cinemas-file", - "test/data/cinemas.xml", - "--list-cinemas" + "test/data/cinemas.sqlite3", + "list-cinemas" }; vector<string> output; @@ -192,9 +260,9 @@ BOOST_AUTO_TEST_CASE(kdm_cli_specify_cinemas_file) BOOST_CHECK(!error); BOOST_REQUIRE_EQUAL(output.size(), 3U); - BOOST_CHECK_EQUAL(output[0], "stinking dump ()"); + BOOST_CHECK_EQUAL(output[0], "Great (julie@tinyscreen.com)"); BOOST_CHECK_EQUAL(output[1], "classy joint ()"); - BOOST_CHECK_EQUAL(output[2], "Great ()"); + BOOST_CHECK_EQUAL(output[2], "stinking dump (bob@odourscreen.com, alice@whiff.com)"); } @@ -205,7 +273,7 @@ BOOST_AUTO_TEST_CASE(kdm_cli_specify_cert) boost::system::error_code ec; boost::filesystem::remove(kdm_filename, ec); - auto film = new_test_film2("kdm_cli_specify_cert", content_factory("test/data/flat_red.png")); + auto film = new_test_film("kdm_cli_specify_cert", content_factory("test/data/flat_red.png")); film->set_encrypted(true); film->set_name("KDMCLI"); film->set_use_isdcf_name(false); @@ -217,6 +285,7 @@ BOOST_AUTO_TEST_CASE(kdm_cli_specify_cert) "--valid-duration", "2 weeks", "-C", "test/data/cert.pem", "-o", "build/test", + "create", "build/test/kdm_cli_specify_cert" }; @@ -228,3 +297,66 @@ BOOST_AUTO_TEST_CASE(kdm_cli_specify_cert) BOOST_CHECK(boost::filesystem::exists(kdm_filename)); } + +BOOST_AUTO_TEST_CASE(kdm_cli_time) +{ + ConfigRestorer cr; + + setup_test_config(); + + boost::filesystem::path kdm_filename = "build/test/KDM_Test_FTR-1_F-133_XX-XX_MOS_2K_20220109_SMPTE_OV_Deans_Screens_Screen_2.xml"; + + boost::system::error_code ec; + boost::filesystem::remove(kdm_filename, ec); + + dcp::LocalTime now; + now.add_days(2); + + vector<string> args = { + "kdm_cli", + "--verbose", + "--valid-from", now.as_string(), + "--valid-duration", "2 weeks", + "-c", "Dean's Screens", + "-S", "Screen 2", + "-o", "build/test", + "test/data/dkdm.xml" + }; + + vector<string> output; + auto error = run(args, output); + BOOST_CHECK(!error); + + BOOST_REQUIRE_EQUAL(output.size(), 2U); + BOOST_CHECK(boost::algorithm::starts_with(output[0], "Making KDMs valid from")); + BOOST_CHECK_EQUAL(output[1], "Wrote 1 KDM files to build/test"); + + BOOST_CHECK(boost::filesystem::exists(kdm_filename)); +} + + +BOOST_AUTO_TEST_CASE(kdm_cli_add_dkdm) +{ + ConfigRestorer cr; + + setup_test_config(); + + BOOST_CHECK_EQUAL(Config::instance()->dkdms()->children().size(), 0U); + + vector<string> args = { + "kdm_cli", + "add-dkdm", + "test/data/dkdm.xml" + }; + + vector<string> output; + auto error = run(args, output); + BOOST_CHECK(!error); + + auto dkdms = Config::instance()->dkdms()->children(); + BOOST_CHECK_EQUAL(dkdms.size(), 1U); + auto dkdm = dynamic_pointer_cast<DKDM>(dkdms.front()); + BOOST_CHECK(dkdm); + BOOST_CHECK_EQUAL(dkdm->dkdm().as_xml(), dcp::file_to_string("test/data/dkdm.xml")); +} + diff --git a/test/kdm_naming_test.cc b/test/kdm_naming_test.cc index 32500553e..fe7da7f31 100644 --- a/test/kdm_naming_test.cc +++ b/test/kdm_naming_test.cc @@ -20,6 +20,7 @@ #include "lib/cinema.h" +#include "lib/cinema_list.h" #include "lib/config.h" #include "lib/content_factory.h" #include "lib/film.h" @@ -32,6 +33,7 @@ using std::dynamic_pointer_cast; using std::list; using std::make_shared; +using std::pair; using std::shared_ptr; using std::string; using std::vector; @@ -46,40 +48,44 @@ confirm_overwrite (boost::filesystem::path) } -static shared_ptr<dcpomatic::Screen> cinema_a_screen_1; -static shared_ptr<dcpomatic::Screen> cinema_a_screen_2; -static shared_ptr<dcpomatic::Screen> cinema_b_screen_x; -static shared_ptr<dcpomatic::Screen> cinema_b_screen_y; -static shared_ptr<dcpomatic::Screen> cinema_b_screen_z; +struct Context +{ + Context() + { + CinemaList cinemas; + + auto crypt_cert = Config::instance()->decryption_chain()->leaf(); + + cinema_a = cinemas.add_cinema({"Cinema A", {}, "", dcp::UTCOffset(4, 30)}); + cinema_a_screen_1 = cinemas.add_screen(cinema_a, {"Screen 1", "", crypt_cert, boost::none, {}}); + cinema_a_screen_2 = cinemas.add_screen(cinema_a, {"Screen 2", "", crypt_cert, boost::none, {}}); + + cinema_b = cinemas.add_cinema({"Cinema B", {}, "", dcp::UTCOffset(-1, 0)}); + cinema_b_screen_x = cinemas.add_screen(cinema_b, {"Screen X", "", crypt_cert, boost::none, {}}); + cinema_b_screen_y = cinemas.add_screen(cinema_b, {"Screen Y", "", crypt_cert, boost::none, {}}); + cinema_b_screen_z = cinemas.add_screen(cinema_b, {"Screen Z", "", crypt_cert, boost::none, {}}); + } + + CinemaID cinema_a = 0; + CinemaID cinema_b = 0; + ScreenID cinema_a_screen_1 = 0; + ScreenID cinema_a_screen_2 = 0; + ScreenID cinema_b_screen_x = 0; + ScreenID cinema_b_screen_y = 0; + ScreenID cinema_b_screen_z = 0; +}; BOOST_AUTO_TEST_CASE (single_kdm_naming_test) { auto c = Config::instance(); - auto crypt_cert = c->decryption_chain()->leaf(); - - /* Cinema A: UTC +4:30 */ - auto cinema_a = make_shared<Cinema>("Cinema A", vector<string>(), "", 4, 30); - cinema_a_screen_1 = std::make_shared<dcpomatic::Screen>("Screen 1", "", crypt_cert, boost::none, vector<TrustedDevice>()); - cinema_a->add_screen (cinema_a_screen_1); - cinema_a_screen_2 = std::make_shared<dcpomatic::Screen>("Screen 2", "", crypt_cert, boost::none, vector<TrustedDevice>()); - cinema_a->add_screen (cinema_a_screen_2); - c->add_cinema (cinema_a); - - /* Cinema B: UTC -1:00 */ - auto cinema_b = make_shared<Cinema>("Cinema B", vector<string>(), "", -1, 0); - cinema_b_screen_x = std::make_shared<dcpomatic::Screen>("Screen X", "", crypt_cert, boost::none, vector<TrustedDevice>()); - cinema_b->add_screen (cinema_b_screen_x); - cinema_b_screen_y = std::make_shared<dcpomatic::Screen>("Screen Y", "", crypt_cert, boost::none, vector<TrustedDevice>()); - cinema_b->add_screen (cinema_b_screen_y); - cinema_b_screen_z = std::make_shared<dcpomatic::Screen>("Screen Z", "", crypt_cert, boost::none, vector<TrustedDevice>()); - cinema_b->add_screen (cinema_b_screen_z); - c->add_cinema (cinema_a); + Context context; + CinemaList cinemas; /* Film */ boost::filesystem::remove_all ("build/test/single_kdm_naming_test"); - auto film = new_test_film2 ("single_kdm_naming_test"); + auto film = new_test_film("single_kdm_naming_test"); film->set_name ("my_great_film"); film->examine_and_add_content (content_factory("test/data/flat_black.png")[0]); BOOST_REQUIRE (!wait_for_jobs()); @@ -90,14 +96,11 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test) auto sign_cert = c->signer_chain()->leaf(); - dcp::LocalTime from (sign_cert.not_before()); + dcp::LocalTime from = sign_cert.not_before(); from.add_months (2); - dcp::LocalTime until (sign_cert.not_after()); + dcp::LocalTime until = sign_cert.not_after(); until.add_months (-2); - auto const from_string = from.date() + " " + from.time_of_day(true, false); - auto const until_string = until.date() + " " + until.time_of_day(true, false); - std::vector<KDMCertificatePeriod> period_checks; auto cpl = cpls.front().cpl_file; @@ -106,9 +109,11 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test) }; auto kdm = kdm_for_screen ( make_kdm, - cinema_a_screen_1, - boost::posix_time::time_from_string(from_string), - boost::posix_time::time_from_string(until_string), + context.cinema_a, + *cinemas.cinema(context.cinema_a), + *cinemas.screen(context.cinema_a_screen_1), + from, + until, dcp::Formulation::MODIFIED_TRANSITIONAL_1, false, optional<int>(), @@ -133,13 +138,16 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test) } -BOOST_AUTO_TEST_CASE (directory_kdm_naming_test, * boost::unit_test::depends_on("single_kdm_naming_test")) +BOOST_AUTO_TEST_CASE(directory_kdm_naming_test) { using boost::filesystem::path; + Context context; + CinemaList cinemas; + /* Film */ boost::filesystem::remove_all ("build/test/directory_kdm_naming_test"); - auto film = new_test_film2 ( + auto film = new_test_film( "directory_kdm_naming_test", { content_factory("test/data/flat_black.png")[0] } ); @@ -157,11 +165,11 @@ BOOST_AUTO_TEST_CASE (directory_kdm_naming_test, * boost::unit_test::depends_on( dcp::LocalTime until (sign_cert.not_after()); until.add_months (-2); - string const from_string = from.date() + " " + from.time_of_day(true, false); - string const until_string = until.date() + " " + until.time_of_day(true, false); - - vector<shared_ptr<dcpomatic::Screen>> screens = { - cinema_a_screen_2, cinema_b_screen_x, cinema_a_screen_1, (cinema_b_screen_z) + vector<pair<CinemaID, ScreenID>> screens = { + { context.cinema_a, context.cinema_a_screen_2 }, + { context.cinema_b, context.cinema_b_screen_x }, + { context.cinema_a, context.cinema_a_screen_1 }, + { context.cinema_b, context.cinema_b_screen_z } }; auto const cpl = cpls.front().cpl_file; @@ -174,12 +182,14 @@ BOOST_AUTO_TEST_CASE (directory_kdm_naming_test, * boost::unit_test::depends_on( return film->make_kdm(cpls.front().cpl_file, begin, end); }; - for (auto i: screens) { + for (auto screen: screens) { auto kdm = kdm_for_screen ( make_kdm, - i, - boost::posix_time::time_from_string(from_string), - boost::posix_time::time_from_string(until_string), + screen.first, + *cinemas.cinema(screen.first), + *cinemas.screen(screen.second), + from, + until, dcp::Formulation::MODIFIED_TRANSITIONAL_1, false, optional<int>(), diff --git a/test/low_bitrate_test.cc b/test/low_bitrate_test.cc index 7050dd771..52b8d54be 100644 --- a/test/low_bitrate_test.cc +++ b/test/low_bitrate_test.cc @@ -31,6 +31,7 @@ extern "C" { using std::make_shared; +using namespace dcpomatic; BOOST_AUTO_TEST_CASE (low_bitrate_test) @@ -51,7 +52,7 @@ BOOST_AUTO_TEST_CASE (low_bitrate_test) boost::optional<ColourConversion>(), VideoRange::FULL, std::weak_ptr<Content>(), - boost::optional<Frame>(), + boost::optional<ContentTime>(), false ); diff --git a/test/map_cli_test.cc b/test/map_cli_test.cc index ed2a7e5ec..aaf5b944f 100644 --- a/test/map_cli_test.cc +++ b/test/map_cli_test.cc @@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE(map_simple_dcp_copy) string const out = String::compose("build/test/%1_out", name); auto content = content_factory("test/data/flat_red.png"); - auto film = new_test_film2(name + "_in", content); + auto film = new_test_film(name + "_in", content); make_and_verify_dcp(film); vector<string> const args = { @@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE(map_simple_dcp_copy_by_id) string const out = String::compose("build/test/%1_out", name); auto content = content_factory("test/data/flat_red.png"); - auto film = new_test_film2(name + "_in", content); + auto film = new_test_film(name + "_in", content); make_and_verify_dcp(film); dcp::CPL cpl(find_cpl(film->dir(film->dcp_name()))); @@ -155,7 +155,7 @@ BOOST_AUTO_TEST_CASE(map_simple_dcp_copy_with_symlinks) string const out = String::compose("build/test/%1_out", name); auto content = content_factory("test/data/flat_red.png"); - auto film = new_test_film2(name + "_in", content); + auto film = new_test_film(name + "_in", content); make_and_verify_dcp(film); vector<string> const args = { @@ -188,7 +188,7 @@ BOOST_AUTO_TEST_CASE(map_simple_dcp_copy_with_hardlinks) string const out = String::compose("build/test/%1_out", name); auto content = content_factory("test/data/flat_red.png"); - auto film = new_test_film2(name + "_in", content); + auto film = new_test_film(name + "_in", content); make_and_verify_dcp(film); vector<string> const args = { @@ -207,8 +207,7 @@ BOOST_AUTO_TEST_CASE(map_simple_dcp_copy_with_hardlinks) verify_dcp(out, {}); - /* The video file will have 3 links because DoM also makes a link into the video directory */ - BOOST_CHECK_EQUAL(boost::filesystem::hard_link_count(find_prefix(out, "j2c_")), 3U); + BOOST_CHECK_EQUAL(boost::filesystem::hard_link_count(find_prefix(out, "j2c_")), 2U); BOOST_CHECK_EQUAL(boost::filesystem::hard_link_count(find_prefix(out, "pcm_")), 2U); } @@ -221,7 +220,7 @@ BOOST_AUTO_TEST_CASE(map_simple_interop_dcp_with_subs) auto picture = content_factory("test/data/flat_red.png").front(); auto subs = content_factory("test/data/15s.srt").front(); - auto film = new_test_film2(name + "_in", { picture, subs }); + auto film = new_test_film(name + "_in", { picture, subs }); film->set_interop(true); subs->only_text()->set_language(dcp::LanguageTag("de")); make_and_verify_dcp(film, {dcp::VerificationNote::Code::INVALID_STANDARD}); @@ -251,13 +250,13 @@ test_map_ov_vf_copy(vector<string> extra_args = {}) string const out = String::compose("build/test/%1_out", name); auto ov_content = content_factory("test/data/flat_red.png"); - auto ov_film = new_test_film2(name + "_ov", ov_content); + auto ov_film = new_test_film(name + "_ov", ov_content); make_and_verify_dcp(ov_film); auto const ov_dir = ov_film->dir(ov_film->dcp_name()); auto vf_ov = make_shared<DCPContent>(ov_dir); auto vf_sound = content_factory("test/data/sine_440.wav").front(); - auto vf_film = new_test_film2(name + "_vf", { vf_ov, vf_sound }); + auto vf_film = new_test_film(name + "_vf", { vf_ov, vf_sound }); vf_ov->set_reference_video(true); make_and_verify_dcp(vf_film, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false); @@ -302,7 +301,7 @@ BOOST_AUTO_TEST_CASE(map_ov_vf_copy_multiple_reference) string const out = String::compose("build/test/%1_out", name); auto ov_content = content_factory("test/data/flat_red.png"); - auto ov_film = new_test_film2(name + "_ov", ov_content); + auto ov_film = new_test_film(name + "_ov", ov_content); make_and_verify_dcp(ov_film); auto const ov_dir = ov_film->dir(ov_film->dcp_name()); @@ -310,7 +309,7 @@ BOOST_AUTO_TEST_CASE(map_ov_vf_copy_multiple_reference) auto vf_ov1 = make_shared<DCPContent>(ov_dir); auto vf_ov2 = make_shared<DCPContent>(ov_dir); auto vf_sound = content_factory("test/data/sine_440.wav").front(); - auto vf_film = new_test_film2(name + "_vf", { vf_ov1, vf_ov2, vf_sound }); + auto vf_film = new_test_film(name + "_vf", { vf_ov1, vf_ov2, vf_sound }); vf_film->set_reel_type(ReelType::BY_VIDEO_CONTENT); vf_ov2->set_position(vf_film, vf_ov1->end(vf_film)); vf_ov1->set_reference_video(true); @@ -350,7 +349,7 @@ BOOST_AUTO_TEST_CASE(map_simple_dcp_copy_with_rename) string const out = String::compose("build/test/%1_out", name); auto content = content_factory("test/data/flat_red.png"); - auto film = new_test_film2(name + "_in", content); + auto film = new_test_film(name + "_in", content); make_and_verify_dcp(film); vector<string> const args = { @@ -409,7 +408,7 @@ test_two_cpls_each_with_subs(string name, bool interop) for (auto i = 0; i < 2; ++i) { auto picture = content_factory("test/data/flat_red.png").front(); auto subs = content_factory("test/data/15s.srt").front(); - films[i] = new_test_film2(String::compose("%1_%2_in", name, i), { picture, subs }); + films[i] = new_test_film(String::compose("%1_%2_in", name, i), { picture, subs }); films[i]->set_interop(interop); subs->only_text()->set_language(dcp::LanguageTag("de")); make_and_verify_dcp(films[i], acceptable_errors); @@ -454,7 +453,7 @@ BOOST_AUTO_TEST_CASE(map_with_given_config) string const out = String::compose("build/test/%1_out", name); auto content = content_factory("test/data/flat_red.png"); - auto film = new_test_film2(name + "_in", content); + auto film = new_test_film(name + "_in", content); make_and_verify_dcp(film); vector<string> const args = { @@ -466,6 +465,7 @@ BOOST_AUTO_TEST_CASE(map_with_given_config) }; boost::filesystem::remove_all(out); + boost::filesystem::remove_all("test/data/map_with_given_config/2.18"); Config::instance()->drop(); vector<string> output_messages; @@ -488,7 +488,7 @@ BOOST_AUTO_TEST_CASE(map_multireel_interop_ov_and_vf_adding_ccaps) content_factory("test/data/flat_red.png")[0] }; - auto ov = new_test_film2(name + "_ov", { video[0], video[1], video[2] }); + auto ov = new_test_film(name + "_ov", { video[0], video[1], video[2] }); ov->set_reel_type(ReelType::BY_VIDEO_CONTENT); ov->set_interop(true); make_and_verify_dcp(ov, { dcp::VerificationNote::Code::INVALID_STANDARD }); @@ -501,7 +501,7 @@ BOOST_AUTO_TEST_CASE(map_multireel_interop_ov_and_vf_adding_ccaps) content_factory("test/data/short.srt")[0] }; - auto vf = new_test_film2(name + "_vf", { ov_dcp, ccap[0], ccap[1], ccap[2] }); + auto vf = new_test_film(name + "_vf", { ov_dcp, ccap[0], ccap[1], ccap[2] }); vf->set_interop(true); vf->set_reel_type(ReelType::BY_VIDEO_CONTENT); ov_dcp->set_reference_video(true); @@ -548,7 +548,7 @@ BOOST_AUTO_TEST_CASE(map_uses_config_for_issuer_and_creator) string const out = String::compose("build/test/%1_out", name); auto content = content_factory("test/data/flat_red.png"); - auto film = new_test_film2(name + "_in", content); + auto film = new_test_film(name + "_in", content); make_and_verify_dcp(film); vector<string> const args = { @@ -580,7 +580,7 @@ BOOST_AUTO_TEST_CASE(map_handles_interop_png_subs) { string const name = "map_handles_interop_png_subs"; auto arrietty = content_factory(TestPaths::private_data() / "arrietty_JP-EN.mkv")[0]; - auto film = new_test_film2(name + "_input", { arrietty }); + auto film = new_test_film(name + "_input", { arrietty }); film->set_interop(true); arrietty->set_trim_end(dcpomatic::ContentTime::from_seconds(110)); arrietty->text[0]->set_use(true); diff --git a/test/markers_test.cc b/test/markers_test.cc index a3c46af44..f7ff3a6b5 100644 --- a/test/markers_test.cc +++ b/test/markers_test.cc @@ -43,7 +43,7 @@ using boost::optional; BOOST_AUTO_TEST_CASE (automatic_ffoc_lfoc_markers_test1) { string const name = "automatic_ffoc_lfoc_markers_test1"; - auto film = new_test_film2 (name); + auto film = new_test_film(name); film->examine_and_add_content (content_factory("test/data/flat_red.png")[0]); BOOST_REQUIRE (!wait_for_jobs()); @@ -72,7 +72,7 @@ BOOST_AUTO_TEST_CASE (automatic_ffoc_lfoc_markers_test1) BOOST_AUTO_TEST_CASE (automatic_ffoc_lfoc_markers_test2) { string const name = "automatic_ffoc_lfoc_markers_test2"; - auto film = new_test_film2 (name); + auto film = new_test_film(name); film->examine_and_add_content (content_factory("test/data/flat_red.png")[0]); BOOST_REQUIRE (!wait_for_jobs()); @@ -110,7 +110,7 @@ BOOST_AUTO_TEST_CASE(markers_correct_with_reels) string const name = "markers_correct_with_reels"; auto content1 = content_factory("test/data/flat_red.png")[0]; auto content2 = content_factory("test/data/flat_red.png")[0]; - auto film = new_test_film2(name, { content1, content2}); + auto film = new_test_film(name, { content1, content2}); film->set_interop(false); film->set_reel_type(ReelType::BY_VIDEO_CONTENT); @@ -143,7 +143,7 @@ BOOST_AUTO_TEST_CASE(markers_correct_with_reels) BOOST_AUTO_TEST_CASE(no_markers_with_interop) { string const name = "no_markers_with_interop"; - auto film = new_test_film2(name, content_factory("test/data/flat_red.png")); + auto film = new_test_film(name, content_factory("test/data/flat_red.png")); film->set_interop(true); make_and_verify_dcp(film, { dcp::VerificationNote::Code::INVALID_STANDARD }); diff --git a/test/mca_subdescriptors_test.cc b/test/mca_subdescriptors_test.cc index e34a909f4..ad146700e 100644 --- a/test/mca_subdescriptors_test.cc +++ b/test/mca_subdescriptors_test.cc @@ -42,7 +42,7 @@ test_descriptors(int mxf_channels, vector<dcp::Channel> active_channels, vector< for (auto i = 0; i < mxf_channels; ++i) { content.push_back(content_factory("test/data/C.wav").front()); } - auto film = new_test_film2("mca_subdescriptors_written_correctly", content); + auto film = new_test_film("mca_subdescriptors_written_correctly", content); film->set_interop(false); film->set_audio_channels(mxf_channels); diff --git a/test/no_use_video_test.cc b/test/no_use_video_test.cc index d9e2c7c00..441d64166 100644 --- a/test/no_use_video_test.cc +++ b/test/no_use_video_test.cc @@ -50,7 +50,7 @@ using std::make_shared; */ BOOST_AUTO_TEST_CASE (no_use_video_test1) { - auto film = new_test_film2 ("no_use_video_test1"); + auto film = new_test_film("no_use_video_test1"); auto A = content_factory("test/data/flat_red.png")[0]; auto B = content_factory("test/data/flat_green.png")[0]; film->examine_and_add_content (A); @@ -72,13 +72,12 @@ BOOST_AUTO_TEST_CASE (no_use_video_test1) /** Overlay two muxed sources and disable the video on one */ BOOST_AUTO_TEST_CASE (no_use_video_test2) { - auto film = new_test_film2 ("no_use_video_test2"); + Cleanup cl; + auto A = content_factory(TestPaths::private_data() / "dolby_aurora.vob")[0]; auto B = content_factory(TestPaths::private_data() / "big_buck_bunny_trailer_480p.mov")[0]; - film->examine_and_add_content (A); - film->examine_and_add_content (B); - BOOST_REQUIRE (!wait_for_jobs()); - + auto film = new_test_film("no_use_video_test2", { A, B }, &cl); + film->set_video_bit_rate(VideoEncoding::JPEG2000, 100000000); A->set_position (film, dcpomatic::DCPTime()); B->set_position (film, dcpomatic::DCPTime()); A->video->set_use (false); @@ -88,13 +87,15 @@ BOOST_AUTO_TEST_CASE (no_use_video_test2) make_and_verify_dcp (film); check_dcp (TestPaths::private_data() / "no_use_video_test2", film); + + cl.run(); } /** Make two DCPs and make a VF with the audio from one and the video from another */ BOOST_AUTO_TEST_CASE (no_use_video_test3) { - auto ov_a = new_test_film2 ("no_use_video_test3_ov_a"); + auto ov_a = new_test_film("no_use_video_test3_ov_a"); auto ov_a_pic = content_factory("test/data/flat_red.png")[0]; BOOST_REQUIRE (ov_a_pic); auto ov_a_snd = content_factory("test/data/sine_16_48_220_10.wav")[0]; @@ -104,7 +105,7 @@ BOOST_AUTO_TEST_CASE (no_use_video_test3) BOOST_REQUIRE (!wait_for_jobs()); make_and_verify_dcp (ov_a); - auto ov_b = new_test_film2("no_use_video_test3_ov_b"); + auto ov_b = new_test_film("no_use_video_test3_ov_b"); auto ov_b_pic = content_factory("test/data/flat_green.png")[0]; BOOST_REQUIRE (ov_b_pic); auto ov_b_snd = content_factory("test/data/sine_16_48_880_10.wav")[0]; @@ -114,7 +115,7 @@ BOOST_AUTO_TEST_CASE (no_use_video_test3) BOOST_REQUIRE (!wait_for_jobs()); make_and_verify_dcp (ov_b); - auto vf = new_test_film2 ("no_use_video_test3_vf"); + auto vf = new_test_film("no_use_video_test3_vf"); auto A = make_shared<DCPContent>(ov_a->dir(ov_a->dcp_name())); auto B = make_shared<DCPContent>(ov_b->dir(ov_b->dcp_name())); vf->examine_and_add_content (A); diff --git a/test/optimise_stills_test.cc b/test/optimise_stills_test.cc index cad7d7d26..c0049507d 100644 --- a/test/optimise_stills_test.cc +++ b/test/optimise_stills_test.cc @@ -22,7 +22,6 @@ #include "lib/content.h" #include "lib/content_factory.h" #include "lib/dcp_content_type.h" -#include "lib/dcp_encoder.h" #include "lib/dcpomatic_log.h" #include "lib/film.h" #include "lib/job_manager.h" @@ -75,14 +74,9 @@ check (string name, int check_full, int check_repeat) /** Make a 2D DCP out of a 2D still and check that the J2K encoding is only done once for each frame */ BOOST_AUTO_TEST_CASE (optimise_stills_test1) { - auto film = new_test_film ("optimise_stills_test1"); - LogSwitcher ls (film->log()); - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); - film->set_name ("frobozz"); auto content = content_factory("test/data/flat_red.png")[0]; - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs ()); + auto film = new_test_film("optimise_stills_test1", { content }); + LogSwitcher ls (film->log()); make_and_verify_dcp (film); check ("optimise_stills_test1", 1, 10 * 24 - 1); @@ -92,14 +86,9 @@ BOOST_AUTO_TEST_CASE (optimise_stills_test1) /** Make a 3D DCP out of a 3D L/R still and check that the J2K encoding is only done once for L and R */ BOOST_AUTO_TEST_CASE (optimise_stills_test2) { - auto film = new_test_film ("optimise_stills_test2"); - LogSwitcher ls (film->log()); - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name("TLR")); - film->set_name ("frobozz"); auto content = content_factory("test/data/flat_red.png")[0]; - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs ()); + auto film = new_test_film("optimise_stills_test2", { content }); + LogSwitcher ls (film->log()); content->video->set_frame_type (VideoFrameType::THREE_D_LEFT_RIGHT); film->set_three_d (true); make_and_verify_dcp (film); diff --git a/test/overlap_video_test.cc b/test/overlap_video_test.cc index cb5fcb430..01d7a9fcb 100644 --- a/test/overlap_video_test.cc +++ b/test/overlap_video_test.cc @@ -30,8 +30,8 @@ #include <dcp/cpl.h> #include <dcp/dcp.h> #include <dcp/j2k_transcode.h> -#include <dcp/mono_picture_asset.h> -#include <dcp/mono_picture_frame.h> +#include <dcp/mono_j2k_picture_asset.h> +#include <dcp/mono_j2k_picture_frame.h> #include <dcp/openjpeg_image.h> #include <dcp/reel.h> #include <dcp/reel_mono_picture_asset.h> @@ -49,7 +49,7 @@ BOOST_AUTO_TEST_CASE (overlap_video_test1) auto A = content_factory("test/data/flat_red.png")[0]; auto B = content_factory("test/data/flat_green.png")[0]; auto C = content_factory("test/data/flat_blue.png")[0]; - auto film = new_test_film2("overlap_video_test1", { A, B, C }); + auto film = new_test_film("overlap_video_test1", { A, B, C }); film->set_sequence (false); auto const fps = 24; @@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE (overlap_video_test1) BOOST_REQUIRE (reel->main_picture()); auto mono_picture = dynamic_pointer_cast<dcp::ReelMonoPictureAsset>(reel->main_picture()); BOOST_REQUIRE (mono_picture); - auto asset = mono_picture->mono_asset(); + auto asset = mono_picture->mono_j2k_asset(); BOOST_REQUIRE (asset); BOOST_CHECK_EQUAL (asset->intrinsic_duration(), fps * 5); auto reader = asset->start_read (); diff --git a/test/player_test.cc b/test/player_test.cc index a13b50352..cac5dffe9 100644 --- a/test/player_test.cc +++ b/test/player_test.cc @@ -55,6 +55,7 @@ using std::cout; using std::list; using std::shared_ptr; using std::make_shared; +using std::vector; using boost::bind; using boost::optional; #if BOOST_VERSION >= 106100 @@ -77,15 +78,10 @@ accumulate (shared_ptr<AudioBuffers> audio, DCPTime) /** Check that the Player correctly generates silence when used with a silent FFmpegContent */ BOOST_AUTO_TEST_CASE (player_silence_padding_test) { - auto film = new_test_film ("player_silence_padding_test"); - film->set_name ("player_silence_padding_test"); auto c = std::make_shared<FFmpegContent>("test/data/test.mp4"); - film->set_container (Ratio::from_id ("185")); + auto film = new_test_film("player_silence_padding_test", { c }); film->set_audio_channels (6); - film->examine_and_add_content (c); - BOOST_REQUIRE (!wait_for_jobs()); - accumulated = std::make_shared<AudioBuffers>(film->audio_channels(), 0); Player player(film, Image::Alignment::COMPACT); @@ -105,18 +101,11 @@ BOOST_AUTO_TEST_CASE (player_silence_padding_test) /* Test insertion of black frames between separate bits of video content */ BOOST_AUTO_TEST_CASE (player_black_fill_test) { - auto film = new_test_film ("black_fill_test"); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); - film->set_name ("black_fill_test"); - film->set_container (Ratio::from_id ("185")); - film->set_sequence (false); - film->set_interop (false); auto contentA = std::make_shared<ImageContent>("test/data/simple_testcard_640x480.png"); auto contentB = std::make_shared<ImageContent>("test/data/simple_testcard_640x480.png"); - - film->examine_and_add_content (contentA); - film->examine_and_add_content (contentB); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("black_fill_test", { contentA, contentB }); + film->set_dcp_content_type(DCPContentType::from_isdcf_name("FTR")); + film->set_sequence (false); contentA->video->set_length (3); contentA->set_position (film, DCPTime::from_frames(2, film->video_frame_rate())); @@ -154,16 +143,9 @@ BOOST_AUTO_TEST_CASE (player_black_fill_test) /** Check behaviour with an awkward playlist whose data does not end on a video frame start */ BOOST_AUTO_TEST_CASE (player_subframe_test) { - auto film = new_test_film ("reels_test7"); - film->set_name ("reels_test7"); - film->set_container (Ratio::from_id("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name("TST")); auto A = content_factory("test/data/flat_red.png")[0]; - film->examine_and_add_content (A); - BOOST_REQUIRE (!wait_for_jobs()); auto B = content_factory("test/data/awkward_length.wav")[0]; - film->examine_and_add_content (B); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("reels_test7", { A, B }); film->set_video_frame_rate (24); A->video->set_length (3 * 24); @@ -201,18 +183,10 @@ audio (shared_ptr<AudioBuffers> audio, DCPTime) /** Check with a video-only file that the video and audio emissions happen more-or-less together */ BOOST_AUTO_TEST_CASE (player_interleave_test) { - auto film = new_test_film ("ffmpeg_transcoder_basic_test_subs"); - film->set_name ("ffmpeg_transcoder_basic_test"); - film->set_container (Ratio::from_id ("185")); - film->set_audio_channels (6); - auto c = std::make_shared<FFmpegContent>("test/data/test.mp4"); - film->examine_and_add_content (c); - BOOST_REQUIRE (!wait_for_jobs ()); - auto s = std::make_shared<StringTextFileContent>("test/data/subrip.srt"); - film->examine_and_add_content (s); - BOOST_REQUIRE (!wait_for_jobs ()); + auto film = new_test_film("ffmpeg_transcoder_basic_test_subs", { c, s }); + film->set_audio_channels (6); Player player(film, Image::Alignment::COMPACT); player.Video.connect(bind(&video, _1, _2)); @@ -297,7 +271,7 @@ BOOST_AUTO_TEST_CASE (player_seek_test2) /** Test a bug when trimmed content follows other content */ BOOST_AUTO_TEST_CASE (player_trim_test) { - auto film = new_test_film2 ("player_trim_test"); + auto film = new_test_film("player_trim_test"); auto A = content_factory("test/data/flat_red.png")[0]; film->examine_and_add_content (A); BOOST_REQUIRE (!wait_for_jobs ()); @@ -336,7 +310,7 @@ store (list<Sub>* out, PlayerText text, TextType type, optional<DCPTextTrack> tr /** Test ignoring both video and audio */ BOOST_AUTO_TEST_CASE (player_ignore_video_and_audio_test) { - auto film = new_test_film2 ("player_ignore_video_and_audio_test"); + auto film = new_test_film("player_ignore_video_and_audio_test"); auto ff = content_factory(TestPaths::private_data() / "boon_telly.mkv")[0]; film->examine_and_add_content (ff); auto text = content_factory("test/data/subrip.srt")[0]; @@ -360,7 +334,7 @@ BOOST_AUTO_TEST_CASE (player_ignore_video_and_audio_test) /** Trigger a crash due to the assertion failure in Player::emit_audio */ BOOST_AUTO_TEST_CASE (player_trim_crash) { - auto film = new_test_film2 ("player_trim_crash"); + auto film = new_test_film("player_trim_crash"); auto boon = content_factory(TestPaths::private_data() / "boon_telly.mkv")[0]; film->examine_and_add_content (boon); BOOST_REQUIRE (!wait_for_jobs()); @@ -388,21 +362,21 @@ BOOST_AUTO_TEST_CASE (player_trim_crash) /** Test a crash when the gap between the last audio and the start of a silent period is more than 1 sample */ BOOST_AUTO_TEST_CASE (player_silence_crash) { - auto film = new_test_film2 ("player_silence_crash"); - auto sine = content_factory("test/data/impulse_train.wav")[0]; - film->examine_and_add_content (sine); - BOOST_REQUIRE (!wait_for_jobs()); + Cleanup cl; + auto sine = content_factory("test/data/impulse_train.wav")[0]; + auto film = new_test_film("player_silence_crash", { sine }, &cl); sine->set_video_frame_rate(film, 23.976); - film->write_metadata (); make_and_verify_dcp (film, {dcp::VerificationNote::Code::MISSING_CPL_METADATA}); + + cl.run(); } /** Test a crash when processing a 3D DCP */ BOOST_AUTO_TEST_CASE (player_3d_test_1) { - auto film = new_test_film2 ("player_3d_test_1a"); + auto film = new_test_film("player_3d_test_1a"); auto left = content_factory("test/data/flat_red.png")[0]; film->examine_and_add_content (left); auto right = content_factory("test/data/flat_blue.png")[0]; @@ -418,7 +392,7 @@ BOOST_AUTO_TEST_CASE (player_3d_test_1) make_and_verify_dcp (film); auto dcp = std::make_shared<DCPContent>(film->dir(film->dcp_name())); - auto film2 = new_test_film2 ("player_3d_test_1b", {dcp}); + auto film2 = new_test_film("player_3d_test_1b", {dcp}); film2->set_three_d (true); make_and_verify_dcp (film2); @@ -430,7 +404,7 @@ BOOST_AUTO_TEST_CASE (player_3d_test_2) { auto left = content_factory("test/data/flat_red.png")[0]; auto right = content_factory("test/data/flat_blue.png")[0]; - auto film = new_test_film2 ("player_3d_test_2a", {left, right}); + auto film = new_test_film("player_3d_test_2a", {left, right}); left->video->set_frame_type (VideoFrameType::THREE_D_LEFT); left->set_position (film, DCPTime()); @@ -441,7 +415,7 @@ BOOST_AUTO_TEST_CASE (player_3d_test_2) make_and_verify_dcp (film); auto dcp = std::make_shared<DCPContent>(film->dir(film->dcp_name())); - auto film2 = new_test_film2 ("player_3d_test_2b", {dcp}); + auto film2 = new_test_film("player_3d_test_2b", {dcp}); make_and_verify_dcp (film2); } @@ -454,14 +428,14 @@ BOOST_AUTO_TEST_CASE (player_silence_at_end_crash) { /* 25fps DCP with some audio */ auto content1 = content_factory("test/data/flat_red.png")[0]; - auto film1 = new_test_film2 ("player_silence_at_end_crash_1", {content1}); + auto film1 = new_test_film("player_silence_at_end_crash_1", {content1}); content1->video->set_length (25); film1->set_video_frame_rate (25); make_and_verify_dcp (film1); /* Make another project importing this DCP */ auto content2 = std::make_shared<DCPContent>(film1->dir(film1->dcp_name())); - auto film2 = new_test_film2 ("player_silence_at_end_crash_2", {content2}); + auto film2 = new_test_film("player_silence_at_end_crash_2", {content2}); /* and importing just the video MXF on its own at the end */ optional<boost::filesystem::path> video; @@ -485,7 +459,7 @@ BOOST_AUTO_TEST_CASE (player_silence_at_end_crash) BOOST_AUTO_TEST_CASE (encrypted_dcp_with_no_kdm_gives_no_butler_error) { auto content = content_factory("test/data/flat_red.png")[0]; - auto film = new_test_film2 ("encrypted_dcp_with_no_kdm_gives_no_butler_error", { content }); + auto film = new_test_film("encrypted_dcp_with_no_kdm_gives_no_butler_error", { content }); int constexpr length = 24 * 25; content->video->set_length(length); film->set_encrypted (true); @@ -496,7 +470,7 @@ BOOST_AUTO_TEST_CASE (encrypted_dcp_with_no_kdm_gives_no_butler_error) }); auto content2 = std::make_shared<DCPContent>(film->dir(film->dcp_name())); - auto film2 = new_test_film2 ("encrypted_dcp_with_no_kdm_gives_no_butler_error2", { content2 }); + auto film2 = new_test_film("encrypted_dcp_with_no_kdm_gives_no_butler_error2", { content2 }); Player player(film, Image::Alignment::COMPACT); Butler butler(film2, player, AudioMapping(), 2, bind(PlayerVideo::force, AV_PIX_FMT_RGB24), VideoRange::FULL, Image::Alignment::PADDED, true, false, Butler::Audio::ENABLED); @@ -531,7 +505,7 @@ BOOST_AUTO_TEST_CASE (interleaved_subtitle_are_emitted_correctly) auto subs1 = content_factory(paths[0])[0]; auto subs2 = content_factory(paths[1])[0]; - auto film = new_test_film2("interleaved_subtitle_are_emitted_correctly", { subs1, subs2 }); + auto film = new_test_film("interleaved_subtitle_are_emitted_correctly", { subs1, subs2 }); film->set_sequence(false); subs1->set_position(film, DCPTime()); subs2->set_position(film, DCPTime()); @@ -558,7 +532,7 @@ BOOST_AUTO_TEST_CASE(multiple_sound_files_bug) auto B = content_factory(TestPaths::private_data() / "kook" / "2.wav").front(); auto C = content_factory(TestPaths::private_data() / "kook" / "3.wav").front(); - auto film = new_test_film2("multiple_sound_files_bug", { A, B, C }, &cl); + auto film = new_test_film("multiple_sound_files_bug", { A, B, C }, &cl); film->set_audio_channels(16); C->set_position(film, DCPTime(3840000)); @@ -574,7 +548,7 @@ BOOST_AUTO_TEST_CASE(trimmed_sound_mix_bug_13) { auto A = content_factory("test/data/sine_16_48_440_10.wav").front(); auto B = content_factory("test/data/sine_16_44.1_440_10.wav").front(); - auto film = new_test_film2("trimmed_sound_mix_bug_13", { A, B }); + auto film = new_test_film("trimmed_sound_mix_bug_13", { A, B }); film->set_audio_channels(16); A->set_position(film, DCPTime()); @@ -592,7 +566,7 @@ BOOST_AUTO_TEST_CASE(trimmed_sound_mix_bug_13_frame_rate_change) { auto A = content_factory("test/data/sine_16_48_440_10.wav").front(); auto B = content_factory("test/data/sine_16_44.1_440_10.wav").front(); - auto film = new_test_film2("trimmed_sound_mix_bug_13_frame_rate_change", { A, B }); + auto film = new_test_film("trimmed_sound_mix_bug_13_frame_rate_change", { A, B }); A->set_position(film, DCPTime()); A->audio->set_gain(-12); @@ -614,7 +588,7 @@ BOOST_AUTO_TEST_CASE(two_d_in_three_d_duplicates) { auto A = content_factory("test/data/flat_red.png").front(); auto B = content_factory("test/data/flat_green.png").front(); - auto film = new_test_film2("two_d_in_three_d_duplicates", { A, B }); + auto film = new_test_film("two_d_in_three_d_duplicates", { A, B }); film->set_three_d(true); B->video->set_frame_type(VideoFrameType::THREE_D_LEFT_RIGHT); @@ -668,7 +642,7 @@ BOOST_AUTO_TEST_CASE(three_d_in_two_d_chooses_left) auto right = content_factory("test/data/flat_green.png").front(); auto mono = content_factory("test/data/flat_blue.png").front(); - auto film = new_test_film2("three_d_in_two_d_chooses_left", { left, right, mono }); + auto film = new_test_film("three_d_in_two_d_chooses_left", { left, right, mono }); left->video->set_frame_type(VideoFrameType::THREE_D_LEFT); left->set_position(film, dcpomatic::DCPTime()); @@ -712,10 +686,38 @@ BOOST_AUTO_TEST_CASE(three_d_in_two_d_chooses_left) } +BOOST_AUTO_TEST_CASE(check_seek_with_no_video) +{ + auto content = content_factory(TestPaths::private_data() / "Fight.Club.1999.720p.BRRip.x264-x0r.srt")[0]; + auto film = new_test_film("check_seek_with_no_video", { content }); + auto player = std::make_shared<Player>(film, film->playlist()); + + boost::signals2::signal<void (std::shared_ptr<PlayerVideo>, dcpomatic::DCPTime)> Video; + + optional<dcpomatic::DCPTime> earliest; + + player->Video.connect( + [&earliest](shared_ptr<PlayerVideo>, dcpomatic::DCPTime time) { + if (!earliest || time < *earliest) { + earliest = time; + } + }); + + player->seek(dcpomatic::DCPTime::from_seconds(60 * 60), false); + + for (int i = 0; i < 10; ++i) { + player->pass(); + } + + BOOST_REQUIRE(earliest); + BOOST_CHECK(*earliest >= dcpomatic::DCPTime(60 * 60)); +} + + BOOST_AUTO_TEST_CASE(unmapped_audio_does_not_raise_buffer_error) { auto content = content_factory(TestPaths::private_data() / "arrietty_JP-EN.mkv")[0]; - auto film = new_test_film2("unmapped_audio_does_not_raise_buffer_error", { content }); + auto film = new_test_film("unmapped_audio_does_not_raise_buffer_error", { content }); content->audio->set_mapping(AudioMapping(6 * 2, MAX_DCP_AUDIO_CHANNELS)); diff --git a/test/playlist_test.cc b/test/playlist_test.cc index e2b9f3ff8..e279e9cc8 100644 --- a/test/playlist_test.cc +++ b/test/playlist_test.cc @@ -39,7 +39,7 @@ setup(vector<shared_ptr<Content>>& content, vector<dcpomatic::DCPTime>& position content.push_back(content_factory("test/data/flat_red.png")[0]); } - auto film = new_test_film2("playlist_move_later_test", content); + auto film = new_test_film("playlist_move_later_test", content); for (auto i: content) { positions.push_back(i->position()); diff --git a/test/pulldown_detect_test.cc b/test/pulldown_detect_test.cc index 432bdf26f..9830d12cd 100644 --- a/test/pulldown_detect_test.cc +++ b/test/pulldown_detect_test.cc @@ -29,7 +29,7 @@ BOOST_AUTO_TEST_CASE (pulldown_detect_test1) { auto content = content_factory(TestPaths::private_data() / "greatbrain.mkv"); - auto film = new_test_film2("pulldown_detect_test1", content); + auto film = new_test_film("pulldown_detect_test1", content); BOOST_REQUIRE(static_cast<bool>(content[0]->video_frame_rate())); BOOST_CHECK_CLOSE(content[0]->video_frame_rate().get(), 23.976, 0.1); diff --git a/test/recover_test.cc b/test/recover_test.cc index 63c611831..ba06fcde9 100644 --- a/test/recover_test.cc +++ b/test/recover_test.cc @@ -33,8 +33,8 @@ #include "lib/video_content.h" #include "lib/ratio.h" #include <dcp/equality_options.h> -#include <dcp/mono_picture_asset.h> -#include <dcp/stereo_picture_asset.h> +#include <dcp/mono_j2k_picture_asset.h> +#include <dcp/stereo_j2k_picture_asset.h> #include <boost/test/unit_test.hpp> #include <iostream> @@ -58,15 +58,9 @@ note (dcp::NoteType t, string n) BOOST_AUTO_TEST_CASE (recover_test_2d) { - auto film = new_test_film("recover_test_2d"); - film->set_interop (false); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); - film->set_container (Ratio::from_id ("185")); - film->set_name ("recover_test"); - auto content = make_shared<FFmpegContent>("test/data/count300bd24.m2ts"); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("recover_test_2d", { content }); + film->set_video_bit_rate(VideoEncoding::JPEG2000, 100000000); make_and_verify_dcp ( film, @@ -75,13 +69,16 @@ BOOST_AUTO_TEST_CASE (recover_test_2d) dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE }); - boost::filesystem::path const video = "build/test/recover_test_2d/video/185_2K_4650f318cea570763a0c6411c8c098ce_24_100000000_P_S_L21_0_1200000.mxf"; + auto video = [film]() { + return find_file(boost::filesystem::path("build/test/recover_test_2d") / film->dcp_name(false), "j2c_"); + }; + boost::filesystem::copy_file ( - video, + video(), "build/test/recover_test_2d/original.mxf" ); - boost::filesystem::resize_file (video, 2 * 1024 * 1024); + boost::filesystem::resize_file(video(), 2 * 1024 * 1024); make_and_verify_dcp( film, @@ -94,8 +91,8 @@ BOOST_AUTO_TEST_CASE (recover_test_2d) false ); - auto A = make_shared<dcp::MonoPictureAsset>("build/test/recover_test_2d/original.mxf"); - auto B = make_shared<dcp::MonoPictureAsset>(video); + auto A = make_shared<dcp::MonoJ2KPictureAsset>("build/test/recover_test_2d/original.mxf"); + auto B = make_shared<dcp::MonoJ2KPictureAsset>(video()); dcp::EqualityOptions eq; BOOST_CHECK (A->equals (B, eq, boost::bind (¬e, _1, _2))); @@ -104,28 +101,24 @@ BOOST_AUTO_TEST_CASE (recover_test_2d) BOOST_AUTO_TEST_CASE (recover_test_3d, * boost::unit_test::depends_on("recover_test_2d")) { - auto film = new_test_film ("recover_test_3d"); - film->set_interop (false); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); - film->set_container (Ratio::from_id ("185")); - film->set_name ("recover_test"); - film->set_three_d (true); - auto content = make_shared<ImageContent>("test/data/3d_test"); content->video->set_frame_type (VideoFrameType::THREE_D_LEFT_RIGHT); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("recover_test_3d", { content }); + film->set_three_d (true); + film->set_video_bit_rate(VideoEncoding::JPEG2000, 100000000); make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE }); - boost::filesystem::path const video = "build/test/recover_test_3d/video/185_2K_60a75a531ca9546bdd513163117e2214_24_100000000_P_S_L21_3D_0_96000.mxf"; + auto video = [film]() { + return find_file(boost::filesystem::path("build/test/recover_test_3d") / film->dcp_name(false), "j2c_"); + }; boost::filesystem::copy_file ( - video, + video(), "build/test/recover_test_3d/original.mxf" ); - boost::filesystem::resize_file (video, 2 * 1024 * 1024); + boost::filesystem::resize_file(video(), 2 * 1024 * 1024); make_and_verify_dcp( film, @@ -137,8 +130,8 @@ BOOST_AUTO_TEST_CASE (recover_test_3d, * boost::unit_test::depends_on("recover_t false ); - auto A = make_shared<dcp::StereoPictureAsset>("build/test/recover_test_3d/original.mxf"); - auto B = make_shared<dcp::StereoPictureAsset>(video); + auto A = make_shared<dcp::StereoJ2KPictureAsset>("build/test/recover_test_3d/original.mxf"); + auto B = make_shared<dcp::StereoJ2KPictureAsset>(video()); dcp::EqualityOptions eq; BOOST_CHECK (A->equals (B, eq, boost::bind (¬e, _1, _2))); @@ -147,29 +140,24 @@ BOOST_AUTO_TEST_CASE (recover_test_3d, * boost::unit_test::depends_on("recover_t BOOST_AUTO_TEST_CASE (recover_test_2d_encrypted, * boost::unit_test::depends_on("recover_test_3d")) { - auto film = new_test_film ("recover_test_2d_encrypted"); - film->set_interop (false); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); - film->set_container (Ratio::from_id ("185")); - film->set_name ("recover_test"); + auto content = make_shared<FFmpegContent>("test/data/count300bd24.m2ts"); + auto film = new_test_film("recover_test_2d_encrypted", { content }); film->set_encrypted (true); film->_key = dcp::Key("eafcb91c9f5472edf01f3a2404c57258"); - - auto content = make_shared<FFmpegContent>("test/data/count300bd24.m2ts"); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); + film->set_video_bit_rate(VideoEncoding::JPEG2000, 100000000); make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE }); - boost::filesystem::path const video = - "build/test/recover_test_2d_encrypted/video/185_2K_4650f318cea570763a0c6411c8c098ce_24_100000000_Eeafcb91c9f5472edf01f3a2404c57258_S_L21_0_1200000.mxf"; + auto video = [film]() { + return find_file(boost::filesystem::path("build/test/recover_test_2d_encrypted") / film->dcp_name(false), "j2c_"); + }; boost::filesystem::copy_file ( - video, + video(), "build/test/recover_test_2d_encrypted/original.mxf" ); - boost::filesystem::resize_file (video, 2 * 1024 * 1024); + boost::filesystem::resize_file(video(), 2 * 1024 * 1024); make_and_verify_dcp( film, @@ -181,9 +169,9 @@ BOOST_AUTO_TEST_CASE (recover_test_2d_encrypted, * boost::unit_test::depends_on( false ); - auto A = make_shared<dcp::MonoPictureAsset>("build/test/recover_test_2d_encrypted/original.mxf"); + auto A = make_shared<dcp::MonoJ2KPictureAsset>("build/test/recover_test_2d_encrypted/original.mxf"); A->set_key (film->key ()); - auto B = make_shared<dcp::MonoPictureAsset>(video); + auto B = make_shared<dcp::MonoJ2KPictureAsset>(video()); B->set_key (film->key ()); dcp::EqualityOptions eq; diff --git a/test/reel_writer_test.cc b/test/reel_writer_test.cc index ec2469898..411de9b1f 100644 --- a/test/reel_writer_test.cc +++ b/test/reel_writer_test.cc @@ -30,6 +30,7 @@ #include "lib/content_factory.h" #include "lib/cross.h" #include "lib/film.h" +#include "lib/frame_info.h" #include "lib/reel_writer.h" #include "lib/video_content.h" #include "test.h" @@ -46,59 +47,59 @@ using std::string; using boost::optional; -static bool equal (dcp::FrameInfo a, ReelWriter const & writer, shared_ptr<InfoFileHandle> file, Frame frame, Eyes eyes) +static bool equal(J2KFrameInfo a, shared_ptr<InfoFileHandle> file, Frame frame, Eyes eyes) { - auto b = writer.read_frame_info(file, frame, eyes); + auto b = J2KFrameInfo(file, frame, eyes); return a.offset == b.offset && a.size == b.size && a.hash == b.hash; } BOOST_AUTO_TEST_CASE (write_frame_info_test) { - auto film = new_test_film2 ("write_frame_info_test"); + auto film = new_test_film("write_frame_info_test"); dcpomatic::DCPTimePeriod const period (dcpomatic::DCPTime(0), dcpomatic::DCPTime(96000)); - ReelWriter writer (film, period, shared_ptr<Job>(), 0, 1, false); + ReelWriter writer(film, period, shared_ptr<Job>(), 0, 1, false, "foo"); /* Write the first one */ - dcp::FrameInfo info1(0, 123, "12345678901234567890123456789012"); - writer.write_frame_info (0, Eyes::LEFT, info1); + J2KFrameInfo info1(0, 123, "12345678901234567890123456789012"); + info1.write(film->info_file_handle(period, false), 0, Eyes::LEFT); { auto file = film->info_file_handle(period, true); - BOOST_CHECK (equal(info1, writer, file, 0, Eyes::LEFT)); + BOOST_CHECK(equal(info1, file, 0, Eyes::LEFT)); } /* Write some more */ - dcp::FrameInfo info2(596, 14921, "123acb789f1234ae782012n456339522"); - writer.write_frame_info (5, Eyes::RIGHT, info2); + J2KFrameInfo info2(596, 14921, "123acb789f1234ae782012n456339522"); + info2.write(film->info_file_handle(period, false), 5, Eyes::RIGHT); { auto file = film->info_file_handle(period, true); - BOOST_CHECK (equal(info1, writer, file, 0, Eyes::LEFT)); - BOOST_CHECK (equal(info2, writer, file, 5, Eyes::RIGHT)); + BOOST_CHECK(equal(info1, file, 0, Eyes::LEFT)); + BOOST_CHECK(equal(info2, file, 5, Eyes::RIGHT)); } - dcp::FrameInfo info3(12494, 99157123, "xxxxyyyyabc12356ffsfdsf456339522"); - writer.write_frame_info (10, Eyes::LEFT, info3); + J2KFrameInfo info3(12494, 99157123, "xxxxyyyyabc12356ffsfdsf456339522"); + info3.write(film->info_file_handle(period, false), 10, Eyes::LEFT); { auto file = film->info_file_handle(period, true); - BOOST_CHECK (equal(info1, writer, file, 0, Eyes::LEFT)); - BOOST_CHECK (equal(info2, writer, file, 5, Eyes::RIGHT)); - BOOST_CHECK (equal(info3, writer, file, 10, Eyes::LEFT)); + BOOST_CHECK(equal(info1, file, 0, Eyes::LEFT)); + BOOST_CHECK(equal(info2, file, 5, Eyes::RIGHT)); + BOOST_CHECK(equal(info3, file, 10, Eyes::LEFT)); } /* Overwrite one */ - dcp::FrameInfo info4(55512494, 123599157123, "ABCDEFGyabc12356ffsfdsf4563395ZZ"); - writer.write_frame_info (5, Eyes::RIGHT, info4); + J2KFrameInfo info4(55512494, 123599157123, "ABCDEFGyabc12356ffsfdsf4563395ZZ"); + info4.write(film->info_file_handle(period, false), 5, Eyes::RIGHT); { auto file = film->info_file_handle(period, true); - BOOST_CHECK (equal(info1, writer, file, 0, Eyes::LEFT)); - BOOST_CHECK (equal(info4, writer, file, 5, Eyes::RIGHT)); - BOOST_CHECK (equal(info3, writer, file, 10, Eyes::LEFT)); + BOOST_CHECK(equal(info1, file, 0, Eyes::LEFT)); + BOOST_CHECK(equal(info4, file, 5, Eyes::RIGHT)); + BOOST_CHECK(equal(info3, file, 10, Eyes::LEFT)); } } @@ -111,7 +112,7 @@ BOOST_AUTO_TEST_CASE (reel_reuse_video_test) /* Make a DCP */ auto video = content_factory("test/data/flat_red.png")[0]; auto audio = content_factory("test/data/white.wav")[0]; - auto film = new_test_film2 ("reel_reuse_video_test", { video, audio }); + auto film = new_test_film("reel_reuse_video_test", { video, audio }); make_and_verify_dcp (film); /* Find main picture and sound asset IDs */ diff --git a/test/reels_test.cc b/test/reels_test.cc index d4a783f91..7ba01b8a9 100644 --- a/test/reels_test.cc +++ b/test/reels_test.cc @@ -54,16 +54,20 @@ using std::vector; using namespace dcpomatic; +static +void +filter_ok(std::vector<dcp::VerificationNote>& notes) +{ + notes.erase(std::remove_if(notes.begin(), notes.end(), [](dcp::VerificationNote const& note) { return note.type() == dcp::VerificationNote::Type::OK; }), notes.end()); +} + + /** Test Film::reels() */ BOOST_AUTO_TEST_CASE (reels_test1) { - auto film = new_test_film ("reels_test1"); - film->set_container (Ratio::from_id ("185")); auto A = make_shared<FFmpegContent>("test/data/test.mp4"); - film->examine_and_add_content (A); auto B = make_shared<FFmpegContent>("test/data/test.mp4"); - film->examine_and_add_content (B); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("reels_test1", { A, B }); BOOST_CHECK_EQUAL (A->full_length(film).get(), 288000); film->set_reel_type (ReelType::SINGLE); @@ -80,7 +84,7 @@ BOOST_AUTO_TEST_CASE (reels_test1) BOOST_CHECK_EQUAL (r.back().from.get(), 288000); BOOST_CHECK_EQUAL (r.back().to.get(), 288000 * 2); - film->set_j2k_bandwidth (100000000); + film->set_video_bit_rate(VideoEncoding::JPEG2000, 100000000); film->set_reel_type (ReelType::BY_LENGTH); /* This is just over 2.5s at 100Mbit/s; should correspond to 60 frames */ film->set_reel_length (31253154); @@ -103,32 +107,13 @@ BOOST_AUTO_TEST_CASE (reels_test1) */ BOOST_AUTO_TEST_CASE (reels_test2) { - auto film = new_test_film ("reels_test2"); - film->set_name ("reels_test2"); - film->set_container (Ratio::from_id ("185")); - film->set_interop (false); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); - - { - auto c = make_shared<ImageContent>("test/data/flat_red.png"); - film->examine_and_add_content (c); - BOOST_REQUIRE (!wait_for_jobs()); - c->video->set_length (24); - } - - { - auto c = make_shared<ImageContent>("test/data/flat_green.png"); - film->examine_and_add_content (c); - BOOST_REQUIRE (!wait_for_jobs()); - c->video->set_length (24); - } - - { - auto c = make_shared<ImageContent>("test/data/flat_blue.png"); - film->examine_and_add_content (c); - BOOST_REQUIRE (!wait_for_jobs()); - c->video->set_length (24); - } + auto r = make_shared<ImageContent>("test/data/flat_red.png"); + auto g = make_shared<ImageContent>("test/data/flat_green.png"); + auto b = make_shared<ImageContent>("test/data/flat_blue.png"); + auto film = new_test_film("reels_test2", { r, g, b }); + r->video->set_length(24); + g->video->set_length(24); + b->video->set_length(24); film->set_reel_type (ReelType::BY_VIDEO_CONTENT); BOOST_CHECK_EQUAL (film->reels().size(), 3U); @@ -141,13 +126,13 @@ BOOST_AUTO_TEST_CASE (reels_test2) check_dcp ("test/data/reels_test2", film->dir (film->dcp_name())); auto c = make_shared<DCPContent>(film->dir(film->dcp_name())); - auto film2 = new_test_film2 ("reels_test2b", {c}); + auto film2 = new_test_film("reels_test2b", {c}); film2->set_reel_type (ReelType::BY_VIDEO_CONTENT); film2->set_audio_channels(16); - auto r = film2->reels (); - BOOST_CHECK_EQUAL (r.size(), 3U); - auto i = r.begin (); + auto reels = film2->reels (); + BOOST_CHECK_EQUAL(reels.size(), 3U); + auto i = reels.begin(); BOOST_CHECK_EQUAL (i->from.get(), 0); BOOST_CHECK_EQUAL (i->to.get(), 96000); ++i; @@ -171,7 +156,7 @@ BOOST_AUTO_TEST_CASE (reels_test3) { auto dcp = make_shared<DCPContent>("test/data/reels_test2"); auto sub = make_shared<StringTextFileContent>("test/data/subrip.srt"); - auto film = new_test_film2 ("reels_test3", {dcp, sub}); + auto film = new_test_film("reels_test3", {dcp, sub}); film->set_reel_type (ReelType::BY_VIDEO_CONTENT); auto reels = film->reels(); @@ -196,7 +181,7 @@ BOOST_AUTO_TEST_CASE (reels_test3) */ BOOST_AUTO_TEST_CASE (reels_test4) { - auto film = new_test_film2 ("reels_test4"); + auto film = new_test_film("reels_test4"); film->set_reel_type (ReelType::BY_VIDEO_CONTENT); film->set_interop (false); @@ -246,7 +231,7 @@ BOOST_AUTO_TEST_CASE (reels_test5) { auto dcp = make_shared<DCPContent>("test/data/reels_test4"); dcp->check_font_ids(); - auto film = new_test_film2 ("reels_test5", {dcp}); + auto film = new_test_film("reels_test5", {dcp}); film->set_sequence (false); /* Set to 2123 but it will be rounded up to the next frame (4000) */ @@ -300,9 +285,9 @@ BOOST_AUTO_TEST_CASE (reels_test5) BOOST_AUTO_TEST_CASE (reels_test6) { auto A = make_shared<FFmpegContent>("test/data/test2.mp4"); - auto film = new_test_film2 ("reels_test6", {A}); + auto film = new_test_film("reels_test6", {A}); - film->set_j2k_bandwidth (100000000); + film->set_video_bit_rate(VideoEncoding::JPEG2000, 100000000); film->set_reel_type (ReelType::BY_LENGTH); /* This is just over 2.5s at 100Mbit/s; should correspond to 60 frames */ film->set_reel_length (31253154); @@ -326,7 +311,7 @@ BOOST_AUTO_TEST_CASE (reels_test7) { auto A = content_factory("test/data/flat_red.png")[0]; auto B = content_factory("test/data/awkward_length.wav")[0]; - auto film = new_test_film2 ("reels_test7", { A, B }); + auto film = new_test_film("reels_test7", { A, B }); film->set_video_frame_rate (24); A->video->set_length (2 * 24); @@ -343,7 +328,7 @@ BOOST_AUTO_TEST_CASE (reels_test7) BOOST_AUTO_TEST_CASE (reels_test8) { auto A = make_shared<FFmpegContent>("test/data/test2.mp4"); - auto film = new_test_film2 ("reels_test8", {A}); + auto film = new_test_film("reels_test8", {A}); A->set_trim_end (ContentTime::from_seconds (1)); make_and_verify_dcp (film); @@ -354,13 +339,13 @@ BOOST_AUTO_TEST_CASE (reels_test8) BOOST_AUTO_TEST_CASE (reels_test9) { auto A = make_shared<FFmpegContent>("test/data/flat_red.png"); - auto film = new_test_film2("reels_test9a", {A}); + auto film = new_test_film("reels_test9a", {A}); A->video->set_length(5 * 24); film->set_video_frame_rate(24); make_and_verify_dcp (film); auto B = make_shared<DCPContent>(film->dir(film->dcp_name())); - auto film2 = new_test_film2("reels_test9b", {B, content_factory("test/data/dcp_sub4.xml")[0]}); + auto film2 = new_test_film("reels_test9b", {B, content_factory("test/data/dcp_sub4.xml")[0]}); B->set_reference_video(true); B->set_reference_audio(true); film2->set_reel_type(ReelType::BY_VIDEO_CONTENT); @@ -385,7 +370,7 @@ BOOST_AUTO_TEST_CASE (reels_test10) /* Make the OV */ auto A = make_shared<FFmpegContent>("test/data/flat_red.png"); auto B = make_shared<FFmpegContent>("test/data/flat_red.png"); - auto ov = new_test_film2("reels_test10_ov", {A, B}); + auto ov = new_test_film("reels_test10_ov", {A, B}); A->video->set_length (5 * 24); B->video->set_length (5 * 24); @@ -395,7 +380,7 @@ BOOST_AUTO_TEST_CASE (reels_test10) /* Now try to make the VF; this used to fail */ auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name())); - auto vf = new_test_film2("reels_test10_vf", {ov_dcp, content_factory("test/data/15s.srt")[0]}); + auto vf = new_test_film("reels_test10_vf", {ov_dcp, content_factory("test/data/15s.srt")[0]}); vf->set_reel_type (ReelType::BY_VIDEO_CONTENT); ov_dcp->set_reference_video (true); ov_dcp->set_reference_audio (true); @@ -418,7 +403,7 @@ BOOST_AUTO_TEST_CASE (reels_test10) BOOST_AUTO_TEST_CASE (reels_test11) { auto A = make_shared<FFmpegContent>("test/data/flat_red.png"); - auto film = new_test_film2 ("reels_test11", {A}); + auto film = new_test_film("reels_test11", {A}); film->set_video_frame_rate (24); A->video->set_length (240); A->set_video_frame_rate(film, 24); @@ -444,7 +429,7 @@ BOOST_AUTO_TEST_CASE (reels_test12) { auto A = make_shared<FFmpegContent>("test/data/flat_red.png"); auto B = make_shared<FFmpegContent>("test/data/flat_red.png"); - auto film = new_test_film2 ("reels_test12", {A, B}); + auto film = new_test_film("reels_test12", {A, B}); film->set_video_frame_rate (24); film->set_reel_type (ReelType::BY_VIDEO_CONTENT); film->set_sequence (false); @@ -497,7 +482,7 @@ BOOST_AUTO_TEST_CASE (reels_should_not_be_short1) { auto A = make_shared<FFmpegContent>("test/data/flat_red.png"); auto B = make_shared<FFmpegContent>("test/data/flat_red.png"); - auto film = new_test_film2 ("reels_should_not_be_short1", {A, B}); + auto film = new_test_film("reels_should_not_be_short1", {A, B}); film->set_video_frame_rate (24); A->video->set_length (23); @@ -508,9 +493,10 @@ BOOST_AUTO_TEST_CASE (reels_should_not_be_short1) make_and_verify_dcp (film); vector<boost::filesystem::path> dirs = { film->dir(film->dcp_name(false)) }; - auto notes = dcp::verify(dirs, {}, boost::bind(&no_op), boost::bind(&no_op), {}, TestPaths::xsd()); - dump_notes (notes); - BOOST_REQUIRE (notes.empty()); + auto result = dcp::verify(dirs, {}, boost::bind(&no_op), boost::bind(&no_op), {}, TestPaths::xsd()); + filter_ok(result.notes); + dump_notes(result.notes); + BOOST_REQUIRE(result.notes.empty()); } @@ -521,7 +507,7 @@ BOOST_AUTO_TEST_CASE (reels_should_not_be_short2) { auto A = make_shared<FFmpegContent>("test/data/flat_red.png"); auto B = make_shared<FFmpegContent>("test/data/flat_red.png"); - auto film = new_test_film2 ("reels_should_not_be_short2", {A, B}); + auto film = new_test_film("reels_should_not_be_short2", {A, B}); film->set_video_frame_rate (24); film->set_reel_type (ReelType::BY_VIDEO_CONTENT); @@ -533,9 +519,10 @@ BOOST_AUTO_TEST_CASE (reels_should_not_be_short2) make_and_verify_dcp (film); vector<boost::filesystem::path> dirs = { film->dir(film->dcp_name(false)) }; - auto const notes = dcp::verify(dirs, {}, boost::bind(&no_op), boost::bind(&no_op), {}, TestPaths::xsd()); - dump_notes (notes); - BOOST_REQUIRE (notes.empty()); + auto result = dcp::verify(dirs, {}, boost::bind(&no_op), boost::bind(&no_op), {}, TestPaths::xsd()); + filter_ok(result.notes); + dump_notes(result.notes); + BOOST_REQUIRE(result.notes.empty()); } @@ -545,7 +532,7 @@ BOOST_AUTO_TEST_CASE (reels_should_not_be_short2) BOOST_AUTO_TEST_CASE (reels_should_not_be_short3) { auto A = make_shared<FFmpegContent>("test/data/flat_red.png"); - auto film = new_test_film2 ("reels_should_not_be_short3", {A}); + auto film = new_test_film("reels_should_not_be_short3", {A}); film->set_video_frame_rate (24); film->set_reel_type (ReelType::BY_LENGTH); film->set_reel_length (1024 * 1024 * 10); @@ -554,9 +541,10 @@ BOOST_AUTO_TEST_CASE (reels_should_not_be_short3) make_and_verify_dcp (film); - auto const notes = dcp::verify({}, {}, boost::bind(&no_op), boost::bind(&no_op), {}, TestPaths::xsd()); - dump_notes (notes); - BOOST_REQUIRE (notes.empty()); + auto result = dcp::verify({}, {}, boost::bind(&no_op), boost::bind(&no_op), {}, TestPaths::xsd()); + filter_ok(result.notes); + dump_notes(result.notes); + BOOST_REQUIRE(result.notes.empty()); } @@ -567,7 +555,7 @@ BOOST_AUTO_TEST_CASE (reels_should_not_be_short4) { auto A = make_shared<FFmpegContent>("test/data/flat_red.png"); auto B = make_shared<FFmpegContent>("test/data/flat_red.png"); - auto film = new_test_film2 ("reels_should_not_be_short4", {A, B}); + auto film = new_test_film("reels_should_not_be_short4", {A, B}); film->set_video_frame_rate (24); film->set_reel_type (ReelType::BY_VIDEO_CONTENT); @@ -584,9 +572,10 @@ BOOST_AUTO_TEST_CASE (reels_should_not_be_short4) BOOST_REQUIRE (!wait_for_jobs()); vector<boost::filesystem::path> dirs = { film->dir(film->dcp_name(false)) }; - auto const notes = dcp::verify(dirs, {}, boost::bind(&no_op), boost::bind(&no_op), {}, TestPaths::xsd()); - dump_notes (notes); - BOOST_REQUIRE (notes.empty()); + auto result = dcp::verify(dirs, {}, boost::bind(&no_op), boost::bind(&no_op), {}, TestPaths::xsd()); + filter_ok(result.notes); + dump_notes(result.notes); + BOOST_REQUIRE(result.notes.empty()); } @@ -598,7 +587,7 @@ BOOST_AUTO_TEST_CASE (repeated_dcp_into_reels) { /* Make a 20s DCP */ auto A = make_shared<FFmpegContent>("test/data/flat_red.png"); - auto film1 = new_test_film2("repeated_dcp_into_reels1", { A }); + auto film1 = new_test_film("repeated_dcp_into_reels1", { A }); auto constexpr frame_rate = 24; auto constexpr length_in_seconds = 20; auto constexpr total_frames = frame_rate * length_in_seconds; @@ -620,7 +609,7 @@ BOOST_AUTO_TEST_CASE (repeated_dcp_into_reels) make_shared<DCPContent>(film1->dir(film1->dcp_name(false))) }; - auto film2 = new_test_film2("repeated_dcp_into_reels2", { original_dcp[0], original_dcp[1], original_dcp[2], original_dcp[3] }); + auto film2 = new_test_film("repeated_dcp_into_reels2", { original_dcp[0], original_dcp[1], original_dcp[2], original_dcp[3] }); film2->set_reel_type(ReelType::BY_VIDEO_CONTENT); film2->set_video_frame_rate(frame_rate); film2->set_sequence(false); diff --git a/test/remake_id_test.cc b/test/remake_id_test.cc index 816a43feb..a919fa12a 100644 --- a/test/remake_id_test.cc +++ b/test/remake_id_test.cc @@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE (remake_id_test1) { /* Make a DCP */ auto content = content_factory("test/data/flat_red.png"); - auto film = new_test_film2 ("remake_id_test1_1", content); + auto film = new_test_film("remake_id_test1_1", content); make_and_verify_dcp (film); /* Copy the video file */ @@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE (remake_id_test2) { /* Make a DCP */ auto content = content_factory("test/data/flat_red.png"); - auto film = new_test_film2 ("remake_id_test2_1", content); + auto film = new_test_film("remake_id_test2_1", content); film->set_encrypted (true); make_and_verify_dcp (film); @@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE (remake_id_test2) /* Import the DCP into a new film */ auto dcp_content = make_shared<DCPContent>(film->dir(film->dcp_name())); - auto film2 = new_test_film2("remake_id_test2_2", { dcp_content }); + auto film2 = new_test_film("remake_id_test2_2", { dcp_content }); dcp_content->add_kdm(kdm); JobManager::instance()->add(make_shared<ExamineContentJob>(film2, dcp_content)); BOOST_REQUIRE(!wait_for_jobs()); diff --git a/test/remake_video_test.cc b/test/remake_video_test.cc index a07659844..5ad9f1a5e 100644 --- a/test/remake_video_test.cc +++ b/test/remake_video_test.cc @@ -26,7 +26,7 @@ #include <dcp/colour_conversion.h> #include <dcp/cpl.h> #include <dcp/dcp.h> -#include <dcp/mono_picture_asset_reader.h> +#include <dcp/mono_j2k_picture_asset_reader.h> #include <dcp/reel.h> #include <dcp/reel_mono_picture_asset.h> #include <boost/test/unit_test.hpp> @@ -41,7 +41,7 @@ using std::vector; BOOST_AUTO_TEST_CASE(remake_video_after_yub_rgb_matrix_changed) { auto content = content_factory("test/data/rgb_grey_testcard.mp4")[0]; - auto film = new_test_film2("remake_video_after_yub_rgb_matrix_changed", { content }); + auto film = new_test_film("remake_video_after_yub_rgb_matrix_changed", { content }); auto conversion = content->video->colour_conversion(); BOOST_REQUIRE(static_cast<bool>(conversion)); @@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(remake_video_after_yub_rgb_matrix_changed) BOOST_REQUIRE(!cpl->reels().empty()); auto reel = cpl->reels()[0]; BOOST_REQUIRE(reel->main_picture()); - auto mono = dynamic_pointer_cast<dcp::MonoPictureAsset>(reel->main_picture()->asset()); + auto mono = dynamic_pointer_cast<dcp::MonoJ2KPictureAsset>(reel->main_picture()->asset()); BOOST_REQUIRE(mono); auto reader = mono->start_read(); diff --git a/test/remake_with_subtitle_test.cc b/test/remake_with_subtitle_test.cc index 57322d3ac..c46a4f70d 100644 --- a/test/remake_with_subtitle_test.cc +++ b/test/remake_with_subtitle_test.cc @@ -35,7 +35,8 @@ using std::dynamic_pointer_cast; */ BOOST_AUTO_TEST_CASE (remake_with_subtitle_test) { - auto film = new_test_film2 ("remake_with_subtitle_test"); + auto film = new_test_film("remake_with_subtitle_test"); + film->set_video_bit_rate(VideoEncoding::JPEG2000, 100000000); auto content = dynamic_pointer_cast<FFmpegContent>(content_factory(TestPaths::private_data() / "prophet_short_clip.mkv")[0]); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); @@ -48,5 +49,9 @@ BOOST_AUTO_TEST_CASE (remake_with_subtitle_test) content->only_text()->set_use (false); make_and_verify_dcp (film); - check_one_frame (film->dir(film->dcp_name()), 325, TestPaths::private_data() / "prophet_frame_325_no_subs.j2c"); +#ifdef DCPOMATIC_OSX + check_one_frame(film->dir(film->dcp_name()), 325, TestPaths::private_data() / "v2.18.x" / "prophet_frame_325_no_subs_mac.j2c"); +#else + check_one_frame(film->dir(film->dcp_name()), 325, TestPaths::private_data() / "v2.18.x" / "prophet_frame_325_no_subs.j2c"); +#endif } diff --git a/test/repeat_frame_test.cc b/test/repeat_frame_test.cc index 0d0f38616..3baed100d 100644 --- a/test/repeat_frame_test.cc +++ b/test/repeat_frame_test.cc @@ -43,7 +43,7 @@ using std::make_shared; BOOST_AUTO_TEST_CASE (repeat_frame_test) { auto c = make_shared<FFmpegContent>("test/data/red_24.mp4"); - auto film = new_test_film2 ("repeat_frame_test", {c}); + auto film = new_test_film("repeat_frame_test", {c}); film->set_interop (false); c->video->set_custom_ratio (1.85); diff --git a/test/required_disk_space_test.cc b/test/required_disk_space_test.cc index b704ccef2..4148126cf 100644 --- a/test/required_disk_space_test.cc +++ b/test/required_disk_space_test.cc @@ -44,17 +44,12 @@ void check_within_n (int64_t a, int64_t b, int64_t n) BOOST_AUTO_TEST_CASE (required_disk_space_test) { - auto film = new_test_film ("required_disk_space_test"); - film->set_j2k_bandwidth (100000000); - film->set_audio_channels(8); - film->set_reel_type (ReelType::BY_VIDEO_CONTENT); auto content_a = content_factory("test/data/flat_blue.png")[0]; - BOOST_REQUIRE (content_a); - film->examine_and_add_content (content_a); auto content_b = make_shared<DCPContent>("test/data/burnt_subtitle_test_dcp"); - film->examine_and_add_content (content_b); - BOOST_REQUIRE (!wait_for_jobs()); - film->write_metadata (); + auto film = new_test_film("required_disk_space_test", { content_a, content_b }); + film->set_video_bit_rate(VideoEncoding::JPEG2000, 100000000); + film->set_audio_channels(8); + film->set_reel_type (ReelType::BY_VIDEO_CONTENT); check_within_n ( film->required_disk_space(), diff --git a/test/scaling_test.cc b/test/scaling_test.cc index 2d453600e..69e81cc69 100644 --- a/test/scaling_test.cc +++ b/test/scaling_test.cc @@ -73,15 +73,9 @@ static void scaling_test_for (shared_ptr<Film> film, shared_ptr<Content> content BOOST_AUTO_TEST_CASE (scaling_test) { - auto film = new_test_film ("scaling_test"); - film->set_dcp_content_type (DCPContentType::from_isdcf_name("FTR")); - film->set_name ("scaling_test"); auto imc = make_shared<ImageContent>("test/data/simple_testcard_640x480.png"); - - film->examine_and_add_content (imc); - - BOOST_REQUIRE (!wait_for_jobs()); - + auto film = new_test_film("scaling_test", { imc }); + film->set_dcp_content_type(DCPContentType::from_isdcf_name("FTR")); imc->video->set_length (1); /* F-133: 133 image in a flat container */ @@ -103,7 +97,7 @@ BOOST_AUTO_TEST_CASE (scaling_test) BOOST_AUTO_TEST_CASE(assertion_failure_when_scaling) { auto content = content_factory("test/data/flat_red.png"); - auto film = new_test_film2("assertion_failure_when_scaling", content); + auto film = new_test_film("assertion_failure_when_scaling", content); content[0]->video->set_custom_size(dcp::Size{3996, 2180}); film->set_resolution(Resolution::FOUR_K); diff --git a/test/shuffler_test.cc b/test/shuffler_test.cc index 2099a0923..37d6749c3 100644 --- a/test/shuffler_test.cc +++ b/test/shuffler_test.cc @@ -33,14 +33,15 @@ using boost::optional; #if BOOST_VERSION >= 106100 using namespace boost::placeholders; #endif +using namespace dcpomatic; static void -push (Shuffler& s, int frame, Eyes eyes) +push(Shuffler& s, int frame, Eyes eyes) { auto piece = make_shared<Piece>(shared_ptr<Content>(), shared_ptr<Decoder>(), FrameRateChange(24, 24)); ContentVideo cv; - cv.frame = frame; + cv.time = ContentTime::from_frames(frame, 24); cv.eyes = eyes; s.video (piece, cv); } @@ -56,8 +57,9 @@ receive (weak_ptr<Piece>, ContentVideo cv) static void check (int frame, Eyes eyes, int line) { + auto const time = ContentTime::from_frames(frame, 24); BOOST_REQUIRE_MESSAGE (!pending_cv.empty(), "Check at " << line << " failed."); - BOOST_CHECK_MESSAGE (pending_cv.front().frame == frame, "Check at " << line << " failed."); + BOOST_CHECK_MESSAGE (pending_cv.front().time == time, "Check at " << line << " failed."); BOOST_CHECK_MESSAGE (pending_cv.front().eyes == eyes, "Check at " << line << " failed."); pending_cv.pop_front(); } diff --git a/test/silence_padding_test.cc b/test/silence_padding_test.cc index 86db117c6..a927510fb 100644 --- a/test/silence_padding_test.cc +++ b/test/silence_padding_test.cc @@ -50,7 +50,7 @@ static void test_silence_padding(int channels, dcp::Standard standard) { string const film_name = "silence_padding_test_" + lexical_cast<string> (channels); - auto film = new_test_film2 ( + auto film = new_test_film( film_name, { make_shared<FFmpegContent>("test/data/flat_red.png"), @@ -134,7 +134,7 @@ BOOST_AUTO_TEST_CASE (silence_padding_test2) Cleanup cl; auto content = make_shared<FFmpegContent>(TestPaths::private_data() / "cars.mov"); - auto film = new_test_film2 ("silence_padding_test2", { content }, &cl); + auto film = new_test_film("silence_padding_test2", { content }, &cl); film->set_video_frame_rate (24); content->set_trim_start(film, dcpomatic::ContentTime(4003)); diff --git a/test/skip_frame_test.cc b/test/skip_frame_test.cc index 8df2fa1d5..6eafd064f 100644 --- a/test/skip_frame_test.cc +++ b/test/skip_frame_test.cc @@ -42,17 +42,8 @@ using std::make_shared; BOOST_AUTO_TEST_CASE (skip_frame_test) { - auto film = new_test_film ("skip_frame_test"); - film->set_name ("skip_frame_test"); - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); - film->set_interop (false); auto c = make_shared<FFmpegContent>("test/data/count300bd48.m2ts"); - film->examine_and_add_content (c); - - BOOST_REQUIRE (!wait_for_jobs()); - - film->write_metadata (); + auto film = new_test_film("skip_frame_test", { c }); film->set_video_frame_rate (24); make_and_verify_dcp (film); diff --git a/test/srt_subtitle_test.cc b/test/srt_subtitle_test.cc index bac0bedec..031749a8c 100644 --- a/test/srt_subtitle_test.cc +++ b/test/srt_subtitle_test.cc @@ -49,16 +49,11 @@ using namespace dcpomatic; /** Make a very short DCP with a single subtitle from .srt with no specified fonts */ BOOST_AUTO_TEST_CASE (srt_subtitle_test) { - auto film = new_test_film ("srt_subtitle_test"); - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); - film->set_name ("frobozz"); - film->set_audio_channels (6); - film->set_interop (false); - film->set_audio_channels(16); auto content = make_shared<StringTextFileContent>("test/data/subrip2.srt"); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("srt_subtitle_test", { content }); + film->set_dcp_content_type(DCPContentType::from_isdcf_name("TLR")); + film->set_name("frobozz"); + film->set_audio_channels(16); content->only_text()->set_use (true); content->only_text()->set_burn (false); @@ -79,15 +74,11 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test) /** Same again but with a `font' specified */ BOOST_AUTO_TEST_CASE (srt_subtitle_test2) { - auto film = new_test_film ("srt_subtitle_test2"); - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); - film->set_name ("frobozz"); - film->set_audio_channels (6); - film->set_interop (false); auto content = make_shared<StringTextFileContent> ("test/data/subrip2.srt"); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("srt_subtitle_test2", { content }); + film->set_dcp_content_type(DCPContentType::from_isdcf_name("TLR")); + film->set_name("frobozz"); + film->set_audio_channels (6); content->only_text()->set_use (true); content->only_text()->set_burn (false); @@ -125,7 +116,7 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test3) Cleanup cl; auto content = make_shared<StringTextFileContent>(TestPaths::private_data() / "Ankoemmling_short.srt"); - auto film = new_test_film2 ("srt_subtitle_test3", { content }, &cl); + auto film = new_test_film("srt_subtitle_test3", { content }, &cl); film->set_name ("frobozz"); film->set_interop (true); @@ -146,16 +137,12 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test3) /** Build a small DCP with no picture and a single subtitle overlaid onto it */ BOOST_AUTO_TEST_CASE (srt_subtitle_test4) { - auto film = new_test_film ("srt_subtitle_test4"); - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); - film->set_name ("frobozz"); - film->set_interop (false); auto content = make_shared<StringTextFileContent>("test/data/subrip2.srt"); + auto film = new_test_film("srt_subtitle_test4", { content }); + film->set_dcp_content_type(DCPContentType::from_isdcf_name("TLR")); + film->set_name("frobozz"); content->only_text()->set_use (true); content->only_text()->set_burn (false); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); make_and_verify_dcp ( film, { @@ -172,10 +159,9 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test4) /** Check the subtitle XML when there are two subtitle files in the project */ BOOST_AUTO_TEST_CASE (srt_subtitle_test5) { - auto film = new_test_film ("srt_subtitle_test5"); - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); - film->set_name ("frobozz"); + auto film = new_test_film("srt_subtitle_test5"); + film->set_dcp_content_type(DCPContentType::from_isdcf_name("TLR")); + film->set_name("frobozz"); film->set_interop (true); film->set_sequence (false); film->set_audio_channels(6); @@ -197,7 +183,7 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test5) BOOST_AUTO_TEST_CASE (srt_subtitle_test6) { auto content = make_shared<StringTextFileContent>("test/data/frames.srt"); - auto film = new_test_film2 ("srt_subtitle_test6", {content}); + auto film = new_test_film("srt_subtitle_test6", {content}); film->set_interop (false); content->only_text()->set_use (true); content->only_text()->set_burn (false); @@ -229,7 +215,7 @@ BOOST_AUTO_TEST_CASE(srt_subtitle_entity) srt.close(); auto content = make_shared<StringTextFileContent>("build/test/srt_subtitle_entity.srt"); - auto film = new_test_film2("srt_subtitle_entity", { content }); + auto film = new_test_film("srt_subtitle_entity", { content }); film->set_interop(false); content->only_text()->set_use(true); content->only_text()->set_burn(false); @@ -270,7 +256,7 @@ BOOST_AUTO_TEST_CASE(srt_subtitle_control_code) srt.close(); auto content = make_shared<StringTextFileContent>("build/test/srt_subtitle_control_code.srt"); - auto film = new_test_film2("srt_subtitle_control_code", { content }); + auto film = new_test_film("srt_subtitle_control_code", { content }); film->set_interop(false); content->only_text()->set_use(true); content->only_text()->set_burn(false); @@ -292,8 +278,8 @@ BOOST_AUTO_TEST_CASE(srt_subtitle_control_code) /** Test rendering of a SubRip subtitle */ BOOST_AUTO_TEST_CASE (srt_subtitle_test4) { - shared_ptr<Film> film = new_test_film ("subrip_render_test"); shared_ptr<StringTextFile> content (new StringTextFile("test/data/subrip.srt")); + shared_ptr<Film> film = new_test_film("subrip_render_test", { content }); content->examine (shared_ptr<Job> (), true); BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds ((3 * 60) + 56.471)); diff --git a/test/ssa_subtitle_test.cc b/test/ssa_subtitle_test.cc index 2565fc035..ffd374d45 100644 --- a/test/ssa_subtitle_test.cc +++ b/test/ssa_subtitle_test.cc @@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE (ssa_subtitle_test1) { Cleanup cl; - auto film = new_test_film2 ("ssa_subtitle_test1", {}, &cl); + auto film = new_test_film("ssa_subtitle_test1", {}, &cl); film->set_container (Ratio::from_id ("185")); film->set_name ("frobozz"); diff --git a/test/stream_test.cc b/test/stream_test.cc index a180739ab..ecd2deac8 100644 --- a/test/stream_test.cc +++ b/test/stream_test.cc @@ -43,38 +43,38 @@ BOOST_AUTO_TEST_CASE (stream_test) { xmlpp::Document doc; auto root = doc.create_root_node("FFmpegAudioStream"); - root->add_child("Name")->add_child_text ("hello there world"); - root->add_child("Id")->add_child_text ("4"); - root->add_child("FrameRate")->add_child_text ("44100"); - root->add_child("Channels")->add_child_text ("2"); + cxml::add_text_child(root, "Name", "hello there world"); + cxml::add_text_child(root, "Id", "4"); + cxml::add_text_child(root, "FrameRate", "44100"); + cxml::add_text_child(root, "Channels", "2"); /* This is the state file version 5 description of the mapping */ - auto mapping = root->add_child("Mapping"); - mapping->add_child("ContentChannels")->add_child_text ("2"); + auto mapping = cxml::add_child(root, "Mapping"); + cxml::add_text_child(mapping, "ContentChannels", "2"); { /* L -> L */ - auto map = mapping->add_child("Map"); - map->add_child("ContentIndex")->add_child_text ("0"); - map->add_child("DCP")->add_child_text ("0"); + auto map = cxml::add_child(mapping, "Map"); + cxml::add_text_child(map, "ContentIndex", "0"); + cxml::add_text_child(map, "DCP", "0"); } { /* L -> C */ - auto map = mapping->add_child("Map"); - map->add_child("ContentIndex")->add_child_text ("0"); - map->add_child("DCP")->add_child_text ("2"); + auto map = cxml::add_child(mapping, "Map"); + cxml::add_text_child(map, "ContentIndex", "0"); + cxml::add_text_child(map, "DCP", "2"); } { /* R -> R */ - auto map = mapping->add_child("Map"); - map->add_child("ContentIndex")->add_child_text ("1"); - map->add_child("DCP")->add_child_text ("1"); + auto map = cxml::add_child(mapping, "Map"); + cxml::add_text_child(map, "ContentIndex", "1"); + cxml::add_text_child(map, "DCP", "1"); } { /* R -> C */ - auto map = mapping->add_child("Map"); - map->add_child("ContentIndex")->add_child_text ("1"); - map->add_child("DCP")->add_child_text ("2"); + auto map = cxml::add_child(mapping, "Map"); + cxml::add_text_child(map, "ContentIndex", "1"); + cxml::add_text_child(map, "DCP", "2"); } FFmpegAudioStream a (cxml::NodePtr (new cxml::Node (root)), 5); diff --git a/test/subtitle_charset_test.cc b/test/subtitle_charset_test.cc index 84f249c65..f4324a646 100644 --- a/test/subtitle_charset_test.cc +++ b/test/subtitle_charset_test.cc @@ -35,7 +35,7 @@ using std::dynamic_pointer_cast; BOOST_AUTO_TEST_CASE (subtitle_charset_test1) { auto content = content_factory(TestPaths::private_data() / "PADDINGTON soustitresVFdef.srt"); - auto film = new_test_film2 ("subtitle_charset_test1", content); + auto film = new_test_film("subtitle_charset_test1", content); } @@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE (subtitle_charset_test1) BOOST_AUTO_TEST_CASE (subtitle_charset_test2) { auto content = content_factory("test/data/osx.srt"); - auto film = new_test_film2 ("subtitle_charset_test2", content); + auto film = new_test_film("subtitle_charset_test2", content); auto ts = dynamic_pointer_cast<StringTextFileContent>(content[0]); BOOST_REQUIRE (ts); /* Make sure we got the subtitle data from the file */ diff --git a/test/subtitle_font_id_change_test.cc b/test/subtitle_font_id_change_test.cc index 385dd1aae..17d732772 100644 --- a/test/subtitle_font_id_change_test.cc +++ b/test/subtitle_font_id_change_test.cc @@ -40,7 +40,7 @@ using std::string; BOOST_AUTO_TEST_CASE(subtitle_font_id_change_test1) { - auto film = new_test_film2("subtitle_font_id_change_test1"); + auto film = new_test_film("subtitle_font_id_change_test1"); boost::filesystem::remove(film->file("metadata.xml")); boost::filesystem::copy_file("test/data/subtitle_font_id_change_test1.xml", film->file("metadata.xml")); film->read_metadata(); @@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(subtitle_font_id_change_test1) BOOST_AUTO_TEST_CASE(subtitle_font_id_change_test2) { - auto film = new_test_film2("subtitle_font_id_change_test2"); + auto film = new_test_film("subtitle_font_id_change_test2"); boost::filesystem::remove(film->file("metadata.xml")); boost::filesystem::copy_file("test/data/subtitle_font_id_change_test2.xml", film->file("metadata.xml")); { @@ -95,7 +95,9 @@ BOOST_AUTO_TEST_CASE(subtitle_font_id_change_test2) BOOST_AUTO_TEST_CASE(subtitle_font_id_change_test3) { - auto film = new_test_film2("subtitle_font_id_change_test3"); + Cleanup cl; + + auto film = new_test_film("subtitle_font_id_change_test3", {}, &cl); boost::filesystem::remove(film->file("metadata.xml")); boost::filesystem::copy_file("test/data/subtitle_font_id_change_test3.xml", film->file("metadata.xml")); { @@ -126,6 +128,8 @@ BOOST_AUTO_TEST_CASE(subtitle_font_id_change_test3) BOOST_CHECK_EQUAL(*font->file(), "test/data/Inconsolata-VF.ttf"); make_and_verify_dcp(film, { dcp::VerificationNote::Code::INVALID_STANDARD }); + + cl.run(); } @@ -133,7 +137,7 @@ BOOST_AUTO_TEST_CASE(subtitle_font_id_change_test4) { Cleanup cl; - auto film = new_test_film2("subtitle_font_id_change_test4", {}, &cl); + auto film = new_test_film("subtitle_font_id_change_test4", {}, &cl); boost::filesystem::remove(film->file("metadata.xml")); boost::filesystem::copy_file("test/data/subtitle_font_id_change_test4.xml", film->file("metadata.xml")); diff --git a/test/subtitle_font_id_test.cc b/test/subtitle_font_id_test.cc index bc09a9cf1..1a4672cfe 100644 --- a/test/subtitle_font_id_test.cc +++ b/test/subtitle_font_id_test.cc @@ -41,7 +41,7 @@ using std::make_shared; BOOST_AUTO_TEST_CASE(full_dcp_subtitle_font_id_test) { auto dcp = make_shared<DCPContent>(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV"); - auto film = new_test_film2("full_dcp_subtitle_font_id_test", { dcp }); + auto film = new_test_film("full_dcp_subtitle_font_id_test", { dcp }); auto content = film->content(); BOOST_REQUIRE_EQUAL(content.size(), 1U); @@ -59,7 +59,7 @@ BOOST_AUTO_TEST_CASE(full_dcp_subtitle_font_id_test) BOOST_AUTO_TEST_CASE(dcp_subtitle_font_id_test) { auto subs = content_factory(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV" / "8b48f6ae-c74b-4b80-b994-a8236bbbad74_sub.mxf"); - auto film = new_test_film2("dcp_subtitle_font_id_test", subs); + auto film = new_test_film("dcp_subtitle_font_id_test", subs); auto content = film->content(); BOOST_REQUIRE_EQUAL(content.size(), 1U); @@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE(dcp_subtitle_font_id_test) BOOST_AUTO_TEST_CASE(make_dcp_with_subs_from_interop_dcp) { auto dcp = make_shared<DCPContent>("test/data/Iopsubs_FTR-1_F_XX-XX_MOS_2K_20220710_IOP_OV"); - auto film = new_test_film2("make_dcp_with_subs_from_interop_dcp", { dcp }); + auto film = new_test_film("make_dcp_with_subs_from_interop_dcp", { dcp }); dcp->text.front()->set_use(true); make_and_verify_dcp( film, @@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE(make_dcp_with_subs_from_smpte_dcp) Cleanup cl; auto dcp = make_shared<DCPContent>(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV"); - auto film = new_test_film2("make_dcp_with_subs_from_smpte_dcp", { dcp }, &cl); + auto film = new_test_film("make_dcp_with_subs_from_smpte_dcp", { dcp }, &cl); dcp->text.front()->set_use(true); make_and_verify_dcp(film); @@ -105,7 +105,7 @@ BOOST_AUTO_TEST_CASE(make_dcp_with_subs_from_smpte_dcp) BOOST_AUTO_TEST_CASE(make_dcp_with_subs_from_mkv) { auto subs = content_factory(TestPaths::private_data() / "clapperboard_with_subs.mkv"); - auto film = new_test_film2("make_dcp_with_subs_from_mkv", subs); + auto film = new_test_film("make_dcp_with_subs_from_mkv", subs); subs[0]->text.front()->set_use(true); subs[0]->text.front()->set_language(dcp::LanguageTag("en")); make_and_verify_dcp(film, { dcp::VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_2K }); @@ -115,7 +115,7 @@ BOOST_AUTO_TEST_CASE(make_dcp_with_subs_from_mkv) BOOST_AUTO_TEST_CASE(make_dcp_with_subs_without_font_tag) { auto subs = content_factory("test/data/no_font.xml"); - auto film = new_test_film2("make_dcp_with_subs_without_font_tag", { subs }); + auto film = new_test_film("make_dcp_with_subs_without_font_tag", { subs }); subs[0]->text.front()->set_use(true); subs[0]->text.front()->set_language(dcp::LanguageTag("de")); make_and_verify_dcp( @@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE(make_dcp_with_subs_in_dcp_without_font_tag) { /* Make a DCP with some subs in */ auto source_subs = content_factory("test/data/short.srt"); - auto source = new_test_film2("make_dcp_with_subs_in_dcp_without_font_tag_source", { source_subs }); + auto source = new_test_film("make_dcp_with_subs_in_dcp_without_font_tag_source", { source_subs }); source->set_interop(true); source_subs[0]->only_text()->set_language(dcp::LanguageTag("de")); make_and_verify_dcp( @@ -175,7 +175,7 @@ BOOST_AUTO_TEST_CASE(make_dcp_with_subs_in_dcp_without_font_tag) /* Now make a project which imports that DCP and makes another DCP from it */ auto dcp_content = make_shared<DCPContent>(source->dir(source->dcp_name())); - auto film = new_test_film2("make_dcp_with_subs_without_font_tag", { dcp_content }); + auto film = new_test_film("make_dcp_with_subs_without_font_tag", { dcp_content }); BOOST_REQUIRE(!dcp_content->text.empty()); dcp_content->text.front()->set_use(true); make_and_verify_dcp( @@ -203,7 +203,7 @@ BOOST_AUTO_TEST_CASE(filler_subtitle_reels_have_load_font_tags) auto video1 = content_factory("test/data/flat_red.png")[0]; auto video2 = content_factory("test/data/flat_red.png")[0]; - auto film = new_test_film2(name, { video1, video2, subs }); + auto film = new_test_film(name, { video1, video2, subs }); film->set_reel_type(ReelType::BY_VIDEO_CONTENT); make_and_verify_dcp( @@ -225,7 +225,7 @@ BOOST_AUTO_TEST_CASE(subtitle_with_no_font_test) auto video2 = content_factory("test/data/flat_red.png")[0]; auto subs = content_factory("test/data/short.srt")[0]; - auto bad_film = new_test_film2(name_base + "_bad", { video1, video2, subs }); + auto bad_film = new_test_film(name_base + "_bad", { video1, video2, subs }); bad_film->set_reel_type(ReelType::BY_VIDEO_CONTENT); video2->set_position(bad_film, video1->end(bad_film)); subs->set_position(bad_film, video1->end(bad_film)); @@ -258,7 +258,7 @@ BOOST_AUTO_TEST_CASE(subtitle_with_no_font_test) BOOST_REQUIRE_EQUAL(check_subs->subtitles().size(), 1U); BOOST_CHECK(!std::dynamic_pointer_cast<const dcp::SubtitleString>(check_subs->subtitles()[0])->font().has_value()); - auto check_film = new_test_film2(name_base + "_check", { make_shared<DCPContent>(bad_film->dir(bad_film->dcp_name())) }); + auto check_film = new_test_film(name_base + "_check", { make_shared<DCPContent>(bad_film->dir(bad_film->dcp_name())) }); make_and_verify_dcp(check_film); } @@ -266,14 +266,14 @@ BOOST_AUTO_TEST_CASE(subtitle_with_no_font_test) BOOST_AUTO_TEST_CASE(load_dcp_with_empty_font_id_test) { auto dcp = std::make_shared<DCPContent>(TestPaths::private_data() / "kr_vf"); - auto film = new_test_film2("load_dcp_with_empty_font_id_test", { dcp }); + auto film = new_test_film("load_dcp_with_empty_font_id_test", { dcp }); } BOOST_AUTO_TEST_CASE(use_first_loadfont_as_default) { auto dcp = std::make_shared<DCPContent>("test/data/use_default_font"); - auto film = new_test_film2("use_first_loadfont_as_default", { dcp }); + auto film = new_test_film("use_first_loadfont_as_default", { dcp }); dcp->only_text()->set_use(true); dcp->only_text()->set_language(dcp::LanguageTag("de")); make_and_verify_dcp( @@ -297,7 +297,7 @@ BOOST_AUTO_TEST_CASE(use_first_loadfont_as_default) BOOST_AUTO_TEST_CASE(no_error_with_ccap_that_mentions_no_font) { auto dcp = make_shared<DCPContent>("test/data/ccap_only"); - auto film = new_test_film2("no_error_with_ccap_that_mentions_no_font", { dcp }); + auto film = new_test_film("no_error_with_ccap_that_mentions_no_font", { dcp }); auto player = Player(film, film->playlist()); while (!player.pass()) {} } diff --git a/test/subtitle_language_test.cc b/test/subtitle_language_test.cc index 6ae0647e9..a1a45eb42 100644 --- a/test/subtitle_language_test.cc +++ b/test/subtitle_language_test.cc @@ -42,7 +42,7 @@ BOOST_AUTO_TEST_CASE (subtitle_language_interop_test) { string const name = "subtitle_language_interop_test"; auto fr = content_factory("test/data/frames.srt"); - auto film = new_test_film2 (name, fr); + auto film = new_test_film(name, fr); fr[0]->only_text()->set_language(dcp::LanguageTag("fr")); film->set_interop (true); @@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE (subtitle_language_smpte_test) { string const name = "subtitle_language_smpte_test"; auto fr = content_factory("test/data/frames.srt"); - auto film = new_test_film2 (name, fr); + auto film = new_test_film(name, fr); fr[0]->only_text()->set_language(dcp::LanguageTag("fr")); film->set_interop (false); @@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(subtitle_language_in_cpl_test) auto subs = content_factory("test/data/frames.srt")[0]; auto video1 = content_factory("test/data/flat_red.png")[0]; auto video2 = content_factory("test/data/flat_red.png")[0]; - auto film = new_test_film2(boost::unit_test::framework::current_test_unit().full_name(), { subs, video1, video2 }); + auto film = new_test_film(boost::unit_test::framework::current_test_unit().full_name(), { subs, video1, video2 }); video2->set_position(film, dcpomatic::DCPTime::from_seconds(5)); film->set_reel_type(ReelType::BY_VIDEO_CONTENT); subs->only_text()->set_language(dcp::LanguageTag("fr")); diff --git a/test/subtitle_position_test.cc b/test/subtitle_position_test.cc index d9dd0c61a..9c71b0d70 100644 --- a/test/subtitle_position_test.cc +++ b/test/subtitle_position_test.cc @@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE(srt_correctly_placed_in_interop) { string const name = "srt_in_interop_position_test"; auto fr = content_factory("test/data/short.srt"); - auto film = new_test_film2(name, fr); + auto film = new_test_film(name, fr); fr[0]->only_text()->set_language(dcp::LanguageTag("de")); film->set_interop(true); @@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(srt_correctly_placed_in_smpte) { string const name = "srt_in_smpte_position_test"; auto fr = content_factory("test/data/short.srt"); - auto film = new_test_film2(name, fr); + auto film = new_test_film(name, fr); fr[0]->text[0]->set_language(dcp::LanguageTag("en")); film->set_interop(false); @@ -114,7 +114,7 @@ vpos_test(dcp::VAlign reference, float position, dcp::SubtitleStandard from, dcp auto name = String::compose("vpos_test_%1_%2", standard, valign_to_string(reference)); auto in = content_factory(String::compose("test/data/%1.xml", name)); - auto film = new_test_film2(name, in); + auto film = new_test_film(name, in); film->set_interop(to == dcp::Standard::INTEROP); diff --git a/test/subtitle_reel_number_test.cc b/test/subtitle_reel_number_test.cc index a48057577..0648ec477 100644 --- a/test/subtitle_reel_number_test.cc +++ b/test/subtitle_reel_number_test.cc @@ -42,19 +42,17 @@ using std::string; /* Check that ReelNumber is setup correctly when making multi-reel subtitled DCPs */ BOOST_AUTO_TEST_CASE (subtitle_reel_number_test) { - auto film = new_test_film ("subtitle_reel_number_test"); - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); - film->set_name ("frobozz"); + Cleanup cl; + auto content = make_shared<StringTextFileContent>("test/data/subrip5.srt"); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs ()); + auto film = new_test_film("subtitle_reel_number_test", { content }, &cl); content->only_text()->set_use (true); content->only_text()->set_burn (false); content->only_text()->set_language(dcp::LanguageTag("de")); film->set_reel_type (ReelType::BY_LENGTH); film->set_interop (true); film->set_reel_length (1024 * 1024 * 512); + film->set_video_bit_rate(VideoEncoding::JPEG2000, 100000000); make_and_verify_dcp (film, {dcp::VerificationNote::Code::INVALID_STANDARD}); dcp::DCP dcp ("build/test/subtitle_reel_number_test/" + film->dcp_name()); @@ -72,4 +70,6 @@ BOOST_AUTO_TEST_CASE (subtitle_reel_number_test) ++n; } } + + cl.run(); } diff --git a/test/subtitle_reel_test.cc b/test/subtitle_reel_test.cc index 147f5c523..8a1a8bece 100644 --- a/test/subtitle_reel_test.cc +++ b/test/subtitle_reel_test.cc @@ -43,7 +43,7 @@ using boost::optional; /* Check that timings are done correctly for multi-reel DCPs with PNG subs */ BOOST_AUTO_TEST_CASE (subtitle_reel_test) { - auto film = new_test_film2 ("subtitle_reel_test"); + auto film = new_test_film("subtitle_reel_test"); film->set_interop (true); auto red_a = make_shared<ImageContent>("test/data/flat_red.png"); auto red_b = make_shared<ImageContent>("test/data/flat_red.png"); @@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE (subtitle_reel_test) */ BOOST_AUTO_TEST_CASE (subtitle_in_all_reels_test) { - auto film = new_test_film2 ("subtitle_in_all_reels_test"); + auto film = new_test_film("subtitle_in_all_reels_test"); film->set_interop (false); film->set_sequence (false); film->set_reel_type (ReelType::BY_VIDEO_CONTENT); @@ -141,7 +141,7 @@ BOOST_AUTO_TEST_CASE (subtitle_in_all_reels_test) */ BOOST_AUTO_TEST_CASE (closed_captions_in_all_reels_test) { - auto film = new_test_film2 ("closed_captions_in_all_reels_test"); + auto film = new_test_film("closed_captions_in_all_reels_test"); film->set_interop (false); film->set_sequence (false); film->set_reel_type (ReelType::BY_VIDEO_CONTENT); @@ -199,7 +199,7 @@ BOOST_AUTO_TEST_CASE (closed_captions_in_all_reels_test) BOOST_AUTO_TEST_CASE (subtitles_split_at_reel_boundaries) { - auto film = new_test_film2 ("subtitles_split_at_reel_boundaries"); + auto film = new_test_film("subtitles_split_at_reel_boundaries"); film->set_interop (true); film->set_sequence (false); diff --git a/test/subtitle_timing_test.cc b/test/subtitle_timing_test.cc index 8bb18f304..2e6b319cb 100644 --- a/test/subtitle_timing_test.cc +++ b/test/subtitle_timing_test.cc @@ -54,7 +54,8 @@ BOOST_AUTO_TEST_CASE (test_subtitle_timing_with_frame_rate_change) auto sub = content_factory("test/data/hour.srt")[0]; sub->text.front()->set_language(dcp::LanguageTag("en")); - auto film = new_test_film2(name, { picture, sub }, &cl); + auto film = new_test_film(name, { picture, sub }, &cl); + film->set_video_bit_rate(VideoEncoding::JPEG2000, 10000000); picture->set_video_frame_rate(film, content_frame_rate); auto const dcp_frame_rate = film->video_frame_rate(); @@ -90,7 +91,7 @@ BOOST_AUTO_TEST_CASE(dvb_subtitles_replace_the_last) */ auto content = content_factory(TestPaths::private_data() / "roh.mkv"); BOOST_REQUIRE(!content.empty()); - auto film = new_test_film2("dvb_subtitles_replace_the_last", { content[0] }); + auto film = new_test_film("dvb_subtitles_replace_the_last", { content[0] }); FFmpegDecoder decoder(film, dynamic_pointer_cast<FFmpegContent>(content[0]), false); BOOST_REQUIRE(!decoder.text.empty()); diff --git a/test/subtitle_trim_test.cc b/test/subtitle_trim_test.cc index b9eccbb6f..752d14d9b 100644 --- a/test/subtitle_trim_test.cc +++ b/test/subtitle_trim_test.cc @@ -32,7 +32,7 @@ using std::make_shared; BOOST_AUTO_TEST_CASE (subtitle_trim_test1) { auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub5.xml"); - auto film = new_test_film2 ("subtitle_trim_test1", {content}); + auto film = new_test_film("subtitle_trim_test1", {content}); content->set_trim_end (dcpomatic::ContentTime::from_seconds(2)); film->write_metadata (); diff --git a/test/template_test.cc b/test/template_test.cc index 6af7751cb..064a070c1 100644 --- a/test/template_test.cc +++ b/test/template_test.cc @@ -27,15 +27,16 @@ #include <boost/test/unit_test.hpp> +using std::string; + + /* Bug #2491 */ BOOST_AUTO_TEST_CASE(template_wrong_channel_counts) { - ConfigRestorer cr; - - Config::override_path = "test/data"; + ConfigRestorer cr("test/data"); - auto film = new_test_film2("template_wrong_channel_counts", {}); - film->use_template("Bug"); + auto film = new_test_film("template_wrong_channel_counts", {}); + film->use_template(string("Bug")); auto mono = content_factory("test/data/C.wav").front(); film->examine_and_add_content(mono); diff --git a/test/test.cc b/test/test.cc index fc5d9dc83..abadb72fc 100644 --- a/test/test.cc +++ b/test/test.cc @@ -47,8 +47,8 @@ #include <dcp/dcp.h> #include <dcp/equality_options.h> #include <dcp/filesystem.h> -#include <dcp/mono_picture_asset.h> -#include <dcp/mono_picture_frame.h> +#include <dcp/mono_j2k_picture_asset.h> +#include <dcp/mono_j2k_picture_frame.h> #include <dcp/openjpeg_image.h> #include <dcp/reel.h> #include <dcp/reel_picture_asset.h> @@ -120,12 +120,8 @@ setup_test_config () Config::instance()->set_master_encoding_threads (boost::thread::hardware_concurrency() / 2); Config::instance()->set_server_encoding_threads (1); Config::instance()->set_server_port_base (61921); - Config::instance()->set_default_dcp_content_type (static_cast<DCPContentType*> (0)); Config::instance()->set_default_audio_delay (0); - Config::instance()->set_default_j2k_bandwidth (100000000); - Config::instance()->set_default_interop (false); Config::instance()->set_default_still_length (10); - Config::instance()->set_default_dcp_audio_channels(8); Config::instance()->set_log_types ( LogEntry::TYPE_GENERAL | LogEntry::TYPE_WARNING | LogEntry::TYPE_ERROR | LogEntry::TYPE_DISK @@ -138,7 +134,8 @@ setup_test_config () decryption->set_key(dcp::file_to_string("test/data/decryption_key")); Config::instance()->set_decryption_chain (decryption); Config::instance()->set_dcp_asset_filename_format(dcp::NameFormat("%t")); - Config::instance()->set_cinemas_file("test/data/empty_cinemas.xml"); + Config::instance()->set_cinemas_file("build/test/cinemas.sqlite3"); + Config::instance()->set_dkdm_recipients_file("build/test/dkdm_recipients.sqlite3"); } @@ -163,11 +160,21 @@ struct TestConfig setup_test_config (); capture_ffmpeg_logs(); - EncodeServerFinder::instance()->stop (); + EncodeServerFinder::drop(); signal_manager = new TestSignalManager (); dcpomatic_log.reset (new FileLog("build/test/log")); + + auto const& suite = boost::unit_test::framework::master_test_suite(); + int types = LogEntry::TYPE_GENERAL | LogEntry::TYPE_WARNING | LogEntry::TYPE_ERROR; + for (int i = 1; i < suite.argc; ++i) { + if (string(suite.argv[i]) == "--log=debug-player") { + types |= LogEntry::TYPE_DEBUG_PLAYER; + } + } + + dcpomatic_log->set_types(types); } ~TestConfig () @@ -192,21 +199,7 @@ test_film_dir (string name) shared_ptr<Film> -new_test_film (string name) -{ - auto p = test_film_dir (name); - if (boost::filesystem::exists (p)) { - boost::filesystem::remove_all (p); - } - - auto film = make_shared<Film>(p); - film->write_metadata (); - return film; -} - - -shared_ptr<Film> -new_test_film2 (string name, vector<shared_ptr<Content>> content, Cleanup* cleanup) +new_test_film(string name, vector<shared_ptr<Content>> content, Cleanup* cleanup) { auto p = test_film_dir (name); if (boost::filesystem::exists (p)) { @@ -217,6 +210,7 @@ new_test_film2 (string name, vector<shared_ptr<Content>> content, Cleanup* clean } auto film = make_shared<Film>(p); + film->use_template({}); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); film->set_container (Ratio::from_id ("185")); film->write_metadata (); @@ -277,13 +271,14 @@ check_wav_file (boost::filesystem::path ref, boost::filesystem::path check) void check_mxf_audio_file (boost::filesystem::path ref, boost::filesystem::path check) { - ASDCP::PCM::MXFReader ref_reader; + Kumu::FileReaderFactory factory; + ASDCP::PCM::MXFReader ref_reader(factory); BOOST_REQUIRE (!ASDCP_FAILURE (ref_reader.OpenRead (ref.string().c_str()))); ASDCP::PCM::AudioDescriptor ref_desc; BOOST_REQUIRE (!ASDCP_FAILURE (ref_reader.FillAudioDescriptor (ref_desc))); - ASDCP::PCM::MXFReader check_reader; + ASDCP::PCM::MXFReader check_reader(factory); BOOST_REQUIRE (!ASDCP_FAILURE (check_reader.OpenRead (check.string().c_str()))); ASDCP::PCM::AudioDescriptor check_desc; @@ -306,13 +301,14 @@ check_mxf_audio_file (boost::filesystem::path ref, boost::filesystem::path check bool mxf_atmos_files_same (boost::filesystem::path ref, boost::filesystem::path check, bool verbose) { - ASDCP::ATMOS::MXFReader ref_reader; + Kumu::FileReaderFactory factory; + ASDCP::ATMOS::MXFReader ref_reader(factory); BOOST_REQUIRE (!ASDCP_FAILURE(ref_reader.OpenRead(ref.string().c_str()))); ASDCP::ATMOS::AtmosDescriptor ref_desc; BOOST_REQUIRE (!ASDCP_FAILURE(ref_reader.FillAtmosDescriptor(ref_desc))); - ASDCP::ATMOS::MXFReader check_reader; + ASDCP::ATMOS::MXFReader check_reader(factory); BOOST_REQUIRE (!ASDCP_FAILURE(check_reader.OpenRead(check.string().c_str()))); ASDCP::ATMOS::AtmosDescriptor check_desc; @@ -574,7 +570,7 @@ check_dcp(boost::filesystem::path ref, boost::filesystem::path check, bool sound } void -check_xml (xmlpp::Element* ref, xmlpp::Element* test, list<string> ignore) +check_xml(xmlpp::Element* ref, xmlpp::Element* test, list<Glib::ustring> ignore) { BOOST_CHECK_EQUAL (ref->get_name (), test->get_name ()); BOOST_CHECK_EQUAL (ref->get_namespace_prefix (), test->get_namespace_prefix ()); @@ -630,7 +626,7 @@ check_xml (xmlpp::Element* ref, xmlpp::Element* test, list<string> ignore) } void -check_xml (boost::filesystem::path ref, boost::filesystem::path test, list<string> ignore) +check_xml(boost::filesystem::path ref, boost::filesystem::path test, list<Glib::ustring> ignore) { auto ref_parser = new xmlpp::DomParser(ref.string()); auto ref_root = ref_parser->get_document()->get_root_node(); @@ -817,22 +813,25 @@ check_one_frame (boost::filesystem::path dcp_dir, int64_t index, boost::filesyst { dcp::DCP dcp (dcp_dir); dcp.read (); - auto asset = dynamic_pointer_cast<dcp::MonoPictureAsset> (dcp.cpls().front()->reels().front()->main_picture()->asset()); + auto asset = dynamic_pointer_cast<dcp::MonoJ2KPictureAsset>(dcp.cpls().front()->reels().front()->main_picture()->asset()); BOOST_REQUIRE (asset); auto frame = asset->start_read()->get_frame(index); - auto ref_frame (new dcp::MonoPictureFrame (ref)); + dcp::MonoJ2KPictureFrame ref_frame(ref); auto image = frame->xyz_image (); - auto ref_image = ref_frame->xyz_image (); + auto ref_image = ref_frame.xyz_image(); BOOST_REQUIRE (image->size() == ref_image->size()); int off = 0; for (int y = 0; y < ref_image->size().height; ++y) { for (int x = 0; x < ref_image->size().width; ++x) { - BOOST_REQUIRE_EQUAL (ref_image->data(0)[off], image->data(0)[off]); - BOOST_REQUIRE_EQUAL (ref_image->data(1)[off], image->data(1)[off]); - BOOST_REQUIRE_EQUAL (ref_image->data(2)[off], image->data(2)[off]); + auto x_error = std::abs(ref_image->data(0)[off] - image->data(0)[off]); + BOOST_REQUIRE_MESSAGE(x_error == 0, "x component at " << x << "," << y << " differs by " << x_error); + auto y_error = std::abs(ref_image->data(1)[off] - image->data(1)[off]); + BOOST_REQUIRE_MESSAGE(y_error == 0, "y component at " << x << "," << y << " differs by " << y_error); + auto z_error = std::abs(ref_image->data(2)[off] - image->data(2)[off]); + BOOST_REQUIRE_MESSAGE(z_error == 0, "z component at " << x << "," << y << " differs by " << z_error); ++off; } } @@ -950,10 +949,10 @@ void progress (float) {} void verify_dcp(boost::filesystem::path dir, vector<dcp::VerificationNote::Code> ignore) { - auto notes = dcp::verify({dir}, {}, &stage, &progress, {}, TestPaths::xsd()); + auto result = dcp::verify({dir}, {}, &stage, &progress, {}, TestPaths::xsd()); bool ok = true; - for (auto i: notes) { - if (find(ignore.begin(), ignore.end(), i.code()) == ignore.end()) { + for (auto i: result.notes) { + if (i.type() != dcp::VerificationNote::Type::OK && find(ignore.begin(), ignore.end(), i.code()) == ignore.end()) { std::cout << "\t" << dcp::note_to_string(i) << "\n"; ok = false; } @@ -1027,8 +1026,16 @@ check_int_close (std::pair<int, int> a, std::pair<int, int> b, int d) } +ConfigRestorer::ConfigRestorer(boost::filesystem::path override_path) +{ + Config::override_path = override_path; + Config::drop(); +} + + ConfigRestorer::~ConfigRestorer() { + Config::override_path = boost::none; setup_test_config(); } @@ -1070,3 +1077,4 @@ Editor::replace(string a, string b) boost::algorithm::replace_all(_content, a, b); BOOST_REQUIRE(_content != old_content); } + diff --git a/test/test.h b/test/test.h index 6687affea..73c77c98d 100644 --- a/test/test.h +++ b/test/test.h @@ -22,6 +22,7 @@ #include "lib/video_frame_type.h" #include <dcp/types.h> #include <dcp/verify.h> +#include <glibmm.h> #include <boost/filesystem.hpp> #include <vector> @@ -57,8 +58,7 @@ private: extern bool wait_for_jobs (); -extern std::shared_ptr<Film> new_test_film (std::string); -extern std::shared_ptr<Film> new_test_film2 (std::string, std::vector<std::shared_ptr<Content>> content = {}, Cleanup* cleanup = nullptr); +extern std::shared_ptr<Film> new_test_film(std::string, std::vector<std::shared_ptr<Content>> content = {}, Cleanup* cleanup = nullptr); extern void check_dcp(boost::filesystem::path, boost::filesystem::path, bool sound_can_differ = false); extern void check_dcp (boost::filesystem::path, std::shared_ptr<const Film>); extern void check_file (boost::filesystem::path ref, boost::filesystem::path check); @@ -66,7 +66,7 @@ extern void check_text_file (boost::filesystem::path ref, boost::filesystem::pat extern void check_wav_file (boost::filesystem::path ref, boost::filesystem::path check); extern void check_mxf_audio_file (boost::filesystem::path ref, boost::filesystem::path check); extern bool mxf_atmos_files_same (boost::filesystem::path ref, boost::filesystem::path check, bool verbose = false); -extern void check_xml (boost::filesystem::path, boost::filesystem::path, std::list<std::string>); +extern void check_xml(boost::filesystem::path, boost::filesystem::path, std::list<Glib::ustring>); extern void check_ffmpeg (boost::filesystem::path, boost::filesystem::path, int audio_tolerance); extern void check_image (boost::filesystem::path, boost::filesystem::path, double threshold = 4); extern boost::filesystem::path test_film_dir (std::string); @@ -96,7 +96,14 @@ private: class ConfigRestorer { public: + ConfigRestorer(boost::filesystem::path override_path); + + ConfigRestorer() {} + ~ConfigRestorer(); + +private: + boost::optional<boost::filesystem::path> _old_path; }; diff --git a/test/text_entry_point_test.cc b/test/text_entry_point_test.cc new file mode 100644 index 000000000..b48111782 --- /dev/null +++ b/test/text_entry_point_test.cc @@ -0,0 +1,70 @@ +/* + Copyright (C) 2024 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic 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. + + DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + + +#include "test.h" +#include "lib/dcp_content.h" +#include "lib/film.h" +#include <dcp/cpl.h> +#include <dcp/dcp.h> +#include <dcp/reel.h> +#include <dcp/reel_smpte_subtitle_asset.h> +#include <dcp/smpte_subtitle_asset.h> +#include <boost/test/unit_test.hpp> + + +using std::make_shared; +using std::string; + + +BOOST_AUTO_TEST_CASE(test_text_entry_point) +{ + auto const path = boost::filesystem::path("build/test/test_text_entry_point"); + boost::filesystem::remove_all(path); + boost::filesystem::create_directories(path); + + /* Make a "bad" DCP with a non-zero text entry point */ + dcp::DCP bad_dcp(path / "dcp"); + auto sub = make_shared<dcp::SMPTESubtitleAsset>(); + sub->write(path / "dcp" / "subs.mxf"); + auto reel_sub = make_shared<dcp::ReelSMPTESubtitleAsset>(sub, dcp::Fraction{24, 1}, 42, 6); + auto reel = make_shared<dcp::Reel>(); + reel->add(reel_sub); + + auto cpl = make_shared<dcp::CPL>("foo", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); + bad_dcp.add(cpl); + cpl->add(reel); + + bad_dcp.write_xml(); + + /* Make a film and add the bad DCP, so that the examiner spots the problem */ + auto dcp_content = make_shared<DCPContent>(path / "dcp"); + auto film = new_test_film("test_text_entry_point/film", { dcp_content }); + film->write_metadata(); + + /* Reload the film to check that the examiner's output is saved and recovered */ + auto film2 = make_shared<Film>(path / "film"); + film2->read_metadata(); + + string why_not; + BOOST_CHECK(!dcp_content->can_reference_text(film2, TextType::OPEN_SUBTITLE, why_not)); + BOOST_CHECK_EQUAL(why_not, "one of its subtitle reels has a non-zero entry point so it must be re-written."); +} + diff --git a/test/threed_test.cc b/test/threed_test.cc index 78d74add4..fda883164 100644 --- a/test/threed_test.cc +++ b/test/threed_test.cc @@ -42,8 +42,8 @@ #include "lib/util.h" #include "lib/video_content.h" #include "test.h" -#include <dcp/mono_picture_asset.h> -#include <dcp/stereo_picture_asset.h> +#include <dcp/mono_j2k_picture_asset.h> +#include <dcp/stereo_j2k_picture_asset.h> #include <boost/test/unit_test.hpp> #include <iostream> @@ -56,11 +56,8 @@ using std::shared_ptr; /** Basic sanity check of THREE_D_LEFT_RIGHT */ BOOST_AUTO_TEST_CASE (threed_test1) { - auto film = new_test_film ("threed_test1"); - film->set_name ("test_film1"); auto c = make_shared<FFmpegContent>("test/data/test.mp4"); - film->examine_and_add_content (c); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("threed_test1", { c }); c->video->set_frame_type (VideoFrameType::THREE_D_LEFT_RIGHT); @@ -76,16 +73,10 @@ BOOST_AUTO_TEST_CASE (threed_test1) */ BOOST_AUTO_TEST_CASE (threed_test2) { - auto film = new_test_film ("threed_test2"); - film->set_name ("test_film2"); auto c = make_shared<FFmpegContent>("test/data/test.mp4"); - film->examine_and_add_content (c); - BOOST_REQUIRE (!wait_for_jobs()); - + auto film = new_test_film("threed_test2", { c }); c->video->set_frame_type (VideoFrameType::THREE_D_ALTERNATE); - film->set_container (Ratio::from_id ("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); film->set_three_d (true); make_and_verify_dcp (film); } @@ -96,7 +87,7 @@ BOOST_AUTO_TEST_CASE (threed_test2) */ BOOST_AUTO_TEST_CASE (threed_test3) { - auto film = new_test_film2 ("threed_test3"); + auto film = new_test_film("threed_test3"); auto L = make_shared<FFmpegContent>("test/data/test.mp4"); film->examine_and_add_content (L); auto R = make_shared<FFmpegContent>("test/data/test.mp4"); @@ -118,7 +109,7 @@ BOOST_AUTO_TEST_CASE (threed_test4) /* Try to stop out-of-memory crashes on my laptop */ Config::instance()->set_master_encoding_threads (boost::thread::hardware_concurrency() / 4); - auto film = new_test_film2 ("threed_test4"); + auto film = new_test_film("threed_test4"); auto L = make_shared<FFmpegContent>(TestPaths::private_data() / "LEFT_TEST_DCP3D4K.mov"); film->examine_and_add_content (L); auto R = make_shared<FFmpegContent>(TestPaths::private_data() / "RIGHT_TEST_DCP3D4K.mov"); @@ -147,7 +138,7 @@ BOOST_AUTO_TEST_CASE (threed_test4) BOOST_AUTO_TEST_CASE (threed_test5) { - auto film = new_test_film2 ("threed_test5"); + auto film = new_test_film("threed_test5"); auto L = make_shared<FFmpegContent>(TestPaths::private_data() / "boon_telly.mkv"); film->examine_and_add_content (L); auto R = make_shared<FFmpegContent>(TestPaths::private_data() / "boon_telly.mkv"); @@ -169,7 +160,7 @@ BOOST_AUTO_TEST_CASE (threed_test5) BOOST_AUTO_TEST_CASE (threed_test6) { - auto film = new_test_film2 ("threed_test6"); + auto film = new_test_film("threed_test6"); auto L = make_shared<FFmpegContent>("test/data/3dL.mp4"); film->examine_and_add_content (L); auto R = make_shared<FFmpegContent>("test/data/3dR.mp4"); @@ -191,7 +182,7 @@ BOOST_AUTO_TEST_CASE (threed_test7) { using boost::filesystem::path; - auto film = new_test_film2 ("threed_test7"); + auto film = new_test_film("threed_test7"); path const content_path = "test/data/flat_red.png"; auto c = content_factory(content_path)[0]; film->examine_and_add_content (c); @@ -234,7 +225,7 @@ BOOST_AUTO_TEST_CASE (threed_test7) */ BOOST_AUTO_TEST_CASE (threed_test_separate_files_slightly_different_lengths) { - auto film = new_test_film2("threed_test3"); + auto film = new_test_film("threed_test3"); auto L = make_shared<FFmpegContent>("test/data/test.mp4"); film->examine_and_add_content (L); auto R = make_shared<FFmpegContent>("test/data/test.mp4"); @@ -255,7 +246,7 @@ BOOST_AUTO_TEST_CASE (threed_test_separate_files_slightly_different_lengths) */ BOOST_AUTO_TEST_CASE (threed_test_separate_files_very_different_lengths) { - auto film = new_test_film2("threed_test3"); + auto film = new_test_film("threed_test3"); auto L = make_shared<FFmpegContent>("test/data/test.mp4"); film->examine_and_add_content (L); auto R = make_shared<FFmpegContent>("test/data/test.mp4"); @@ -273,7 +264,7 @@ BOOST_AUTO_TEST_CASE (threed_test_separate_files_very_different_lengths) BOOST_AUTO_TEST_CASE (threed_test_butler_overfill) { - auto film = new_test_film2("threed_test_butler_overfill"); + auto film = new_test_film("threed_test_butler_overfill"); auto A = make_shared<FFmpegContent>(TestPaths::private_data() / "arrietty_JP-EN.mkv"); film->examine_and_add_content(A); auto B = make_shared<FFmpegContent>(TestPaths::private_data() / "arrietty_JP-EN.mkv"); @@ -318,7 +309,7 @@ BOOST_AUTO_TEST_CASE(threed_passthrough_test, * boost::unit_test::depends_on("th BOOST_REQUIRE(input_dcp); auto content = make_shared<DCPContent>(*input_dcp); - auto film = new_test_film2("threed_passthrough_test", { content }); + auto film = new_test_film("threed_passthrough_test", { content }); film->set_three_d(false); make_and_verify_dcp(film); @@ -330,10 +321,10 @@ BOOST_AUTO_TEST_CASE(threed_passthrough_test, * boost::unit_test::depends_on("th BOOST_REQUIRE_EQUAL(matches.size(), 1U); - auto stereo = dcp::StereoPictureAsset(matches[0]); + auto stereo = dcp::StereoJ2KPictureAsset(matches[0]); auto stereo_reader = stereo.start_read(); - auto mono = dcp::MonoPictureAsset(dcp_file(film, "j2c")); + auto mono = dcp::MonoJ2KPictureAsset(dcp_file(film, "j2c")); auto mono_reader = mono.start_read(); BOOST_REQUIRE_EQUAL(stereo.intrinsic_duration(), mono.intrinsic_duration()); @@ -352,7 +343,7 @@ BOOST_AUTO_TEST_CASE(threed_test_when_padding_needed) auto left = content_factory("test/data/flat_red.png").front(); auto right = content_factory("test/data/flat_red.png").front(); auto sound = content_factory("test/data/sine_440.wav").front(); - auto film = new_test_film2("threed_test_when_padding_needed", { left, right, sound }); + auto film = new_test_film("threed_test_when_padding_needed", { left, right, sound }); left->video->set_frame_type(VideoFrameType::THREE_D_LEFT); left->set_position(film, dcpomatic::DCPTime()); diff --git a/test/time_calculation_test.cc b/test/time_calculation_test.cc index 7ace7f8c2..0e09ae2c3 100644 --- a/test/time_calculation_test.cc +++ b/test/time_calculation_test.cc @@ -132,7 +132,7 @@ static string const xml = "<Content>" BOOST_AUTO_TEST_CASE (ffmpeg_time_calculation_test) { - auto film = new_test_film ("ffmpeg_time_calculation_test"); + auto film = new_test_film("ffmpeg_time_calculation_test"); auto doc = make_shared<cxml::Document>(); doc->read_string (xml); @@ -186,7 +186,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_time_calculation_test) /** Test Player::dcp_to_content_video */ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) { - auto film = new_test_film ("player_time_calculation_test1"); + auto film = new_test_film("player_time_calculation_test1"); auto doc = make_shared<cxml::Document>(); doc->read_string (xml); @@ -392,7 +392,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) /** Test Player::content_video_to_dcp */ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) { - auto film = new_test_film ("player_time_calculation_test2"); + auto film = new_test_film("player_time_calculation_test2"); auto doc = make_shared<cxml::Document>(); doc->read_string (xml); @@ -568,7 +568,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) /** Test Player::dcp_to_content_audio */ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) { - auto film = new_test_film ("player_time_calculation_test3"); + auto film = new_test_film("player_time_calculation_test3"); auto doc = make_shared<cxml::Document>(); doc->read_string (xml); diff --git a/test/torture_test.cc b/test/torture_test.cc index 0c781fdb1..e2325955b 100644 --- a/test/torture_test.cc +++ b/test/torture_test.cc @@ -35,8 +35,8 @@ #include "lib/video_content.h" #include "test.h" #include <dcp/cpl.h> -#include <dcp/mono_picture_asset.h> -#include <dcp/mono_picture_frame.h> +#include <dcp/mono_j2k_picture_asset.h> +#include <dcp/mono_j2k_picture_frame.h> #include <dcp/openjpeg_image.h> #include <dcp/reel.h> #include <dcp/reel_picture_asset.h> @@ -57,7 +57,7 @@ using namespace dcpomatic; /** Test start/end trim and positioning of some audio content */ BOOST_AUTO_TEST_CASE (torture_test1) { - auto film = new_test_film2 ("torture_test1"); + auto film = new_test_film("torture_test1"); film->set_sequence (false); /* Staircase at an offset of 2000 samples, trimmed both start and end, with a gain of exactly 2 (linear) */ @@ -230,7 +230,7 @@ BOOST_AUTO_TEST_CASE (torture_test1) auto reel_picture = reels.front()->main_picture(); BOOST_REQUIRE (reel_picture); - auto picture = dynamic_pointer_cast<dcp::MonoPictureAsset> (reel_picture->asset()); + auto picture = dynamic_pointer_cast<dcp::MonoJ2KPictureAsset>(reel_picture->asset()); BOOST_REQUIRE (picture); BOOST_CHECK_EQUAL (picture->intrinsic_duration(), 144); @@ -248,7 +248,7 @@ BOOST_AUTO_TEST_CASE (torture_test1) for (int c = 0; c < 3; ++c) { for (int y = 0; y < size.height; ++y) { for (int x = 0; x < size.width; ++x) { - BOOST_REQUIRE (image->data(c)[y * size.height + x] <= 3); + BOOST_REQUIRE (image->data(c)[y * size.height + x] <= 5); } } } @@ -307,7 +307,7 @@ BOOST_AUTO_TEST_CASE(multi_reel_interop_ccap_test) auto ccap1 = content_factory("test/data/15s.srt").front(); auto pic2 = content_factory("test/data/flat_red.png").front(); auto ccap2 = content_factory("test/data/15s.srt").front(); - auto film1 = new_test_film2("multi_reel_interop_ccap_test1", { pic1, ccap1, pic2, ccap2 }); + auto film1 = new_test_film("multi_reel_interop_ccap_test1", { pic1, ccap1, pic2, ccap2 }); film1->set_interop(true); film1->set_reel_type(ReelType::BY_VIDEO_CONTENT); ccap1->text[0]->set_type(TextType::CLOSED_CAPTION); @@ -317,7 +317,7 @@ BOOST_AUTO_TEST_CASE(multi_reel_interop_ccap_test) make_and_verify_dcp(film1, { dcp::VerificationNote::Code::INVALID_STANDARD, dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING }); auto reload = make_shared<DCPContent>(film1->dir(film1->dcp_name())); - auto film2 = new_test_film2("multi_reel_interop_ccap_test2", { reload }); + auto film2 = new_test_film("multi_reel_interop_ccap_test2", { reload }); for (auto i: reload->text) { i->set_use(true); } diff --git a/test/upmixer_a_test.cc b/test/upmixer_a_test.cc index af6c8b9e2..29af9805b 100644 --- a/test/upmixer_a_test.cc +++ b/test/upmixer_a_test.cc @@ -68,15 +68,9 @@ write (shared_ptr<AudioBuffers> b, DCPTime) BOOST_AUTO_TEST_CASE (upmixer_a_test) { - auto film = new_test_film ("upmixer_a_test"); - film->set_container (Ratio::from_id("185")); - film->set_dcp_content_type (DCPContentType::from_isdcf_name("TLR")); - film->set_name ("frobozz"); - film->set_audio_processor (AudioProcessor::from_id("stereo-5.1-upmix-a")); auto content = make_shared<FFmpegContent>("test/data/white.wav"); - film->examine_and_add_content (content); - - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("upmixer_a_test", { content }); + film->set_audio_processor (AudioProcessor::from_id("stereo-5.1-upmix-a")); SF_INFO info; info.samplerate = 48000; diff --git a/test/vf_kdm_test.cc b/test/vf_kdm_test.cc index d8efa7ab7..3fd8bc327 100644 --- a/test/vf_kdm_test.cc +++ b/test/vf_kdm_test.cc @@ -51,16 +51,11 @@ BOOST_AUTO_TEST_CASE (vf_kdm_test) /* Make an encrypted DCP from test.mp4 */ - auto A = new_test_film ("vf_kdm_test_ov"); - A->set_container (Ratio::from_id ("185")); - A->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); - A->set_name ("frobozz"); - A->set_interop (true); - auto c = make_shared<FFmpegContent>("test/data/test.mp4"); - A->examine_and_add_content (c); + auto A = new_test_film("vf_kdm_test_ov", { c }); + A->set_interop (true); + A->set_dcp_content_type(DCPContentType::from_isdcf_name("TLR")); A->set_encrypted (true); - BOOST_REQUIRE (!wait_for_jobs()); make_and_verify_dcp (A, {dcp::VerificationNote::Code::INVALID_STANDARD}); dcp::DCP A_dcp ("build/test/vf_kdm_test_ov/" + A->dcp_name()); @@ -76,18 +71,15 @@ BOOST_AUTO_TEST_CASE (vf_kdm_test) /* Import A into a new project, with the required KDM, and make a VF that refers to it */ - auto B = new_test_film ("vf_kdm_test_vf"); - B->set_container (Ratio::from_id("185")); - B->set_dcp_content_type (DCPContentType::from_isdcf_name("TLR")); - B->set_name ("frobozz"); - B->set_interop (true); - auto d = make_shared<DCPContent>("build/test/vf_kdm_test_ov/" + A->dcp_name()); - d->add_kdm (A_kdm); + d->add_kdm(A_kdm); + + auto B = new_test_film("vf_kdm_test_vf", { d }); + B->set_dcp_content_type(DCPContentType::from_isdcf_name("TLR")); + B->set_interop(true); + d->set_reference_video (true); - B->examine_and_add_content (d); B->set_encrypted (true); - BOOST_REQUIRE (!wait_for_jobs()); make_and_verify_dcp (B, {dcp::VerificationNote::Code::INVALID_STANDARD, dcp::VerificationNote::Code::EXTERNAL_ASSET}); dcp::DCP B_dcp ("build/test/vf_kdm_test_vf/" + B->dcp_name()); @@ -100,18 +92,14 @@ BOOST_AUTO_TEST_CASE (vf_kdm_test) This KDM should decrypt assets from the OV too. */ - auto C = new_test_film ("vf_kdm_test_check"); - C->set_container (Ratio::from_id ("185")); - C->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); - C->set_name ("frobozz"); - C->set_interop (true); - auto e = make_shared<DCPContent>("build/test/vf_kdm_test_vf/" + B->dcp_name()); - e->add_kdm (B_kdm); e->add_ov ("build/test/vf_kdm_test_ov/" + A->dcp_name()); - C->examine_and_add_content (e); + e->add_kdm(B_kdm); + auto C = new_test_film("vf_kdm_test_check", { e }); + C->set_interop (true); C->set_audio_channels(6); - BOOST_REQUIRE (!wait_for_jobs()); + C->set_dcp_content_type(DCPContentType::from_isdcf_name("TLR")); + make_and_verify_dcp (C, {dcp::VerificationNote::Code::INVALID_STANDARD}); /* Should be 1s red, 1s green, 1s blue */ diff --git a/test/vf_test.cc b/test/vf_test.cc index ca987b22d..589e12d83 100644 --- a/test/vf_test.cc +++ b/test/vf_test.cc @@ -40,8 +40,8 @@ #include "lib/video_content.h" #include "test.h" #include <dcp/cpl.h> -#include <dcp/mono_picture_asset.h> -#include <dcp/picture_asset_writer.h> +#include <dcp/mono_j2k_picture_asset.h> +#include <dcp/j2k_picture_asset_writer.h> #include <dcp/reel.h> #include <dcp/reel_mono_picture_asset.h> #include <dcp/reel_sound_asset.h> @@ -65,11 +65,8 @@ using namespace dcpomatic; /** Test the logic which decides whether a DCP can be referenced or not */ BOOST_AUTO_TEST_CASE (vf_test1) { - auto film = new_test_film ("vf_test1"); - film->set_interop (false); auto dcp = make_shared<DCPContent>("test/data/reels_test2"); - film->examine_and_add_content (dcp); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("vf_test1", { dcp }); /* Multi-reel DCP can't be referenced if we are using a single reel for the project */ film->set_reel_type (ReelType::SINGLE); @@ -111,31 +108,19 @@ BOOST_AUTO_TEST_CASE (vf_test1) BOOST_AUTO_TEST_CASE (vf_test2) { /* Make the OV */ - auto ov = new_test_film ("vf_test2_ov"); - ov->set_dcp_content_type (DCPContentType::from_isdcf_name("TST")); - ov->set_name ("vf_test2_ov"); auto video = content_factory("test/data/flat_red.png")[0]; - ov->examine_and_add_content (video); - BOOST_REQUIRE (!wait_for_jobs()); - video->video->set_length (24 * 5); auto audio = content_factory("test/data/white.wav")[0]; - ov->examine_and_add_content (audio); - BOOST_REQUIRE (!wait_for_jobs()); + auto ov = new_test_film("vf_test2_ov", { video, audio }); + video->video->set_length (24 * 5); make_and_verify_dcp (ov); /* Make the VF */ - auto vf = new_test_film ("vf_test2_vf"); - vf->set_name ("vf_test2_vf"); - vf->set_dcp_content_type (DCPContentType::from_isdcf_name("TST")); - vf->set_reel_type (ReelType::BY_VIDEO_CONTENT); auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name())); - vf->examine_and_add_content (dcp); - BOOST_REQUIRE (!wait_for_jobs()); + auto sub = content_factory("test/data/subrip4.srt")[0]; + auto vf = new_test_film("vf_test2_vf", { dcp, sub }); + vf->set_reel_type (ReelType::BY_VIDEO_CONTENT); dcp->set_reference_video (true); dcp->set_reference_audio (true); - auto sub = content_factory("test/data/subrip4.srt")[0]; - vf->examine_and_add_content (sub); - BOOST_REQUIRE (!wait_for_jobs()); make_and_verify_dcp ( vf, { @@ -175,29 +160,18 @@ BOOST_AUTO_TEST_CASE (vf_test2) BOOST_AUTO_TEST_CASE (vf_test3) { /* Make the OV */ - auto ov = new_test_film ("vf_test3_ov"); - ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); - ov->set_name ("vf_test3_ov"); auto video = content_factory("test/data/flat_red.png")[0]; - ov->examine_and_add_content (video); - BOOST_REQUIRE (!wait_for_jobs()); - video->video->set_length (24 * 5); auto audio = content_factory("test/data/white.wav")[0]; - ov->examine_and_add_content (audio); - BOOST_REQUIRE (!wait_for_jobs()); + auto ov = new_test_film("vf_test3_ov", { video, audio }); + video->video->set_length (24 * 5); make_and_verify_dcp (ov); /* Make the VF */ - auto vf = new_test_film ("vf_test3_vf"); - vf->set_name ("vf_test3_vf"); - vf->set_dcp_content_type (DCPContentType::from_isdcf_name("TST")); - vf->set_reel_type (ReelType::BY_VIDEO_CONTENT); auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name())); - BOOST_REQUIRE (dcp); + auto vf = new_test_film("vf_test3_vf", { dcp }); + vf->set_reel_type (ReelType::BY_VIDEO_CONTENT); dcp->set_trim_start(vf, ContentTime::from_seconds (1)); dcp->set_trim_end (ContentTime::from_seconds (1)); - vf->examine_and_add_content (dcp); - BOOST_REQUIRE (!wait_for_jobs()); dcp->set_reference_video (true); dcp->set_reference_audio (true); make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false); @@ -219,28 +193,17 @@ BOOST_AUTO_TEST_CASE (vf_test3) BOOST_AUTO_TEST_CASE (vf_test4) { /* Make the OV */ - auto ov = new_test_film ("vf_test4_ov"); - ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); - ov->set_name ("vf_test4_ov"); auto video = content_factory("test/data/flat_red.png")[0]; - ov->examine_and_add_content (video); - BOOST_REQUIRE (!wait_for_jobs()); - video->video->set_length (24 * 5); auto audio = content_factory("test/data/white.wav")[0]; - ov->examine_and_add_content (audio); - BOOST_REQUIRE (!wait_for_jobs()); + auto ov = new_test_film("vf_test4_ov", { video, audio }); + video->video->set_length (24 * 5); make_and_verify_dcp (ov); /* Make the VF */ - auto vf = new_test_film ("vf_test4_vf"); - vf->set_name ("vf_test4_vf"); - vf->set_dcp_content_type (DCPContentType::from_isdcf_name("TST")); + auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name())); + auto vf = new_test_film("vf_test4_vf", { dcp }); vf->set_reel_type (ReelType::BY_VIDEO_CONTENT); vf->set_sequence (false); - auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name())); - BOOST_REQUIRE (dcp); - vf->examine_and_add_content (dcp); - BOOST_REQUIRE (!wait_for_jobs()); dcp->set_position(vf, DCPTime::from_seconds(10)); dcp->set_reference_video (true); dcp->set_reference_audio (true); @@ -248,7 +211,6 @@ BOOST_AUTO_TEST_CASE (vf_test4) vf->examine_and_add_content (more_video); BOOST_REQUIRE (!wait_for_jobs()); more_video->set_position (vf, DCPTime()); - vf->write_metadata (); make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false); dcp::DCP ov_c (ov->dir(ov->dcp_name())); @@ -276,8 +238,7 @@ BOOST_AUTO_TEST_CASE (vf_test4) BOOST_AUTO_TEST_CASE (vf_test5) { /* Make the OV */ - auto ov = new_test_film ("vf_test5_ov"); - ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); + auto ov = new_test_film("vf_test5_ov"); ov->set_reel_type (ReelType::BY_VIDEO_CONTENT); for (int i = 0; i < 3; ++i) { auto video = content_factory("test/data/flat_red.png")[0]; @@ -290,15 +251,10 @@ BOOST_AUTO_TEST_CASE (vf_test5) make_and_verify_dcp (ov); /* Make the VF */ - auto vf = new_test_film ("vf_test5_vf"); - vf->set_name ("vf_test5_vf"); - vf->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); + auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name())); + auto vf = new_test_film("vf_test5_vf", { dcp }); vf->set_reel_type (ReelType::BY_VIDEO_CONTENT); vf->set_sequence (false); - auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name())); - BOOST_REQUIRE (dcp); - vf->examine_and_add_content (dcp); - BOOST_REQUIRE (!wait_for_jobs()); dcp->set_reference_video (true); dcp->set_reference_audio (true); dcp->set_trim_end (ContentTime::from_seconds(15)); @@ -323,24 +279,17 @@ BOOST_AUTO_TEST_CASE (vf_test5) BOOST_AUTO_TEST_CASE (vf_test6) { /* Make the OV */ - auto ov = new_test_film ("vf_test6_ov"); - ov->set_dcp_content_type (DCPContentType::from_isdcf_name("TST")); - ov->set_reel_type (ReelType::BY_VIDEO_CONTENT); auto video = content_factory("test/data/flat_red.png")[0]; - ov->examine_and_add_content (video); - BOOST_REQUIRE (!wait_for_jobs()); + auto ov = new_test_film("vf_test6_ov", { video }); + ov->set_reel_type (ReelType::BY_VIDEO_CONTENT); video->video->set_length (24 * 10); make_and_verify_dcp (ov); /* Make the VF */ - auto vf = new_test_film ("vf_test6_vf"); - vf->set_name ("vf_test6_vf"); - vf->set_dcp_content_type (DCPContentType::from_isdcf_name("TST")); + auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name())); + auto vf = new_test_film("vf_test6_vf", { dcp }); vf->set_reel_type (ReelType::BY_VIDEO_CONTENT); vf->set_sequence (false); - auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name())); - vf->examine_and_add_content (dcp); - BOOST_REQUIRE (!wait_for_jobs()); dcp->set_reference_video (true); dcp->set_reference_audio (true); @@ -364,19 +313,19 @@ BOOST_AUTO_TEST_CASE (vf_test6) BOOST_AUTO_TEST_CASE (vf_test7) { /* First OV */ - auto ov1 = new_test_film2 ("vf_test7_ov1", {content_factory("test/data/flat_red.png")[0]}); + auto ov1 = new_test_film("vf_test7_ov1", {content_factory("test/data/flat_red.png")[0]}); ov1->set_video_frame_rate (24); make_and_verify_dcp (ov1); /* Second OV */ - auto ov2 = new_test_film2 ("vf_test7_ov2", {content_factory("test/data/flat_red.png")[0]}); + auto ov2 = new_test_film("vf_test7_ov2", {content_factory("test/data/flat_red.png")[0]}); ov2->set_video_frame_rate (24); make_and_verify_dcp (ov2); /* VF */ auto ov1_dcp = make_shared<DCPContent>(ov1->dir(ov1->dcp_name())); auto ov2_dcp = make_shared<DCPContent>(ov2->dir(ov2->dcp_name())); - auto vf = new_test_film2 ("vf_test7_vf", {ov1_dcp, ov2_dcp}); + auto vf = new_test_film("vf_test7_vf", {ov1_dcp, ov2_dcp}); vf->set_reel_type (ReelType::BY_VIDEO_CONTENT); ov1_dcp->set_reference_video (true); ov2_dcp->set_reference_video (true); @@ -397,14 +346,14 @@ BOOST_AUTO_TEST_CASE (test_vf_with_trimmed_multi_reel_dcp) c->video->set_length(240); ov_content.push_back(c); } - auto ov = new_test_film2 ("test_vf_with_trimmed_multi_reel_dcp_ov", ov_content); + auto ov = new_test_film("test_vf_with_trimmed_multi_reel_dcp_ov", ov_content); ov->set_reel_type(ReelType::BY_VIDEO_CONTENT); make_and_verify_dcp (ov); /* Make a VF with a specific arrangement */ auto vf_image = content_factory("test/data/flat_red.png")[0]; auto vf_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name())); - auto vf = new_test_film2 ("test_vf_with_trimmed_multi_reel_dcp_vf", { vf_image, vf_dcp }); + auto vf = new_test_film("test_vf_with_trimmed_multi_reel_dcp_vf", { vf_image, vf_dcp }); vf->set_reel_type(ReelType::BY_VIDEO_CONTENT); vf_dcp->set_reference_video(true); vf_dcp->set_reference_audio(true); @@ -419,7 +368,7 @@ BOOST_AUTO_TEST_CASE(test_referencing_ov_with_subs_when_adding_ccaps) { string const name("test_referencing_ov_with_subs_when_adding_ccaps"); auto subs = content_factory("test/data/15s.srt"); - auto ov = new_test_film2(name + "_ov", subs); + auto ov = new_test_film(name + "_ov", subs); make_and_verify_dcp( ov, { @@ -430,7 +379,7 @@ BOOST_AUTO_TEST_CASE(test_referencing_ov_with_subs_when_adding_ccaps) auto ccaps = content_factory("test/data/15s.srt")[0]; auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name(false))); - auto vf = new_test_film2(name + "_vf", { ov_dcp, ccaps }); + auto vf = new_test_film(name + "_vf", { ov_dcp, ccaps }); ccaps->text[0]->set_type(TextType::CLOSED_CAPTION); string why_not; @@ -443,7 +392,7 @@ BOOST_AUTO_TEST_CASE(test_duplicate_font_id_in_vf) { string const name("test_duplicate_font_id_in_vf"); auto subs = content_factory("test/data/15s.srt"); - auto ov = new_test_film2(name + "_ov", subs); + auto ov = new_test_film(name + "_ov", subs); make_and_verify_dcp( ov, { @@ -454,7 +403,7 @@ BOOST_AUTO_TEST_CASE(test_duplicate_font_id_in_vf) auto ccaps = content_factory("test/data/15s.srt")[0]; auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name(false))); - auto vf = new_test_film2(name + "_vf", { ov_dcp, ccaps }); + auto vf = new_test_film(name + "_vf", { ov_dcp, ccaps }); ov_dcp->set_reference_audio(true); ov_dcp->set_reference_video(true); ov_dcp->text[0]->set_use(true); @@ -468,7 +417,7 @@ BOOST_AUTO_TEST_CASE(test_duplicate_font_id_in_vf) auto vf_dcp = make_shared<DCPContent>(vf->dir(vf->dcp_name(false))); - auto test = new_test_film2(name + "_test", { vf_dcp }); + auto test = new_test_film(name + "_test", { vf_dcp }); vf_dcp->add_ov(ov->dir(ov->dcp_name(false))); JobManager::instance()->add(make_shared<ExamineContentJob>(test, vf_dcp)); BOOST_CHECK(!wait_for_jobs()); @@ -492,8 +441,8 @@ BOOST_AUTO_TEST_CASE(test_referencing_ov_with_missing_subtitle_in_some_reels) dcp::DCP ov(path / "ov"); auto make_picture = [path](string filename) { - auto pic = make_shared<dcp::MonoPictureAsset>(dcp::Fraction(24, 1), dcp::Standard::SMPTE); - auto writer = pic->start_write(path / "ov" / filename, dcp::PictureAsset::Behaviour::MAKE_NEW); + auto pic = make_shared<dcp::MonoJ2KPictureAsset>(dcp::Fraction(24, 1), dcp::Standard::SMPTE); + auto writer = pic->start_write(path / "ov" / filename, dcp::Behaviour::MAKE_NEW); auto frame = dcp::ArrayData("test/data/picture.j2c"); for (int i = 0; i < 240; ++i) { writer->write(frame); @@ -565,7 +514,8 @@ BOOST_AUTO_TEST_CASE(test_referencing_ov_with_missing_subtitle_in_some_reels) BOOST_AUTO_TEST_CASE(ov_subs_in_vf_name) { auto subs = content_factory("test/data/short.srt")[0]; - auto ov = new_test_film2("ov_subs_in_vf_name_ov", { subs }); + auto ov = new_test_film("ov_subs_in_vf_name_ov", { subs }); + ov->set_audio_channels(8); subs->only_text()->set_language(dcp::LanguageTag("de")); make_and_verify_dcp( ov, @@ -575,8 +525,9 @@ BOOST_AUTO_TEST_CASE(ov_subs_in_vf_name) }); auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name())); - auto vf = new_test_film2("ov_subs_in_vf_name_vf", { ov_dcp }); + auto vf = new_test_film("ov_subs_in_vf_name_vf", { ov_dcp }); vf->set_name("foo"); + vf->set_audio_channels(8); ov_dcp->set_reference_text(TextType::OPEN_SUBTITLE, true); vf->_isdcf_date = boost::gregorian::date(2023, boost::gregorian::Jan, 18); diff --git a/test/video_level_test.cc b/test/video_level_test.cc index e2419d8e7..69a8af89e 100644 --- a/test/video_level_test.cc +++ b/test/video_level_test.cc @@ -36,7 +36,7 @@ #include "lib/image.h" #include "lib/image_content.h" #include "lib/image_decoder.h" -#include "lib/ffmpeg_encoder.h" +#include "lib/ffmpeg_film_encoder.h" #include "lib/job_manager.h" #include "lib/player.h" #include "lib/player_video.h" @@ -45,8 +45,8 @@ #include "test.h" #include <dcp/cpl.h> #include <dcp/dcp.h> -#include <dcp/mono_picture_asset.h> -#include <dcp/mono_picture_frame.h> +#include <dcp/mono_j2k_picture_asset.h> +#include <dcp/mono_j2k_picture_frame.h> #include <dcp/openjpeg_image.h> #include <dcp/reel.h> #include <dcp/reel_picture_asset.h> @@ -115,7 +115,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_image_video_range_expanded) write_image(grey_image(size, grey_pixel), file); auto content = content_factory(file); - auto film = new_test_film2 ("ffmpeg_image_video_range_expanded", content); + auto film = new_test_film("ffmpeg_image_video_range_expanded", content); content[0]->video->set_range (VideoRange::VIDEO); auto player = make_shared<Player>(film, film->playlist()); @@ -275,7 +275,7 @@ pixel_range (boost::filesystem::path dcp_path) dcp::DCP dcp (dcp_path); dcp.read (); - auto picture = dynamic_pointer_cast<dcp::MonoPictureAsset>(dcp.cpls().front()->reels().front()->main_picture()->asset()); + auto picture = dynamic_pointer_cast<dcp::MonoJ2KPictureAsset>(dcp.cpls().front()->reels().front()->main_picture()->asset()); BOOST_REQUIRE (picture); auto frame = picture->start_read()->get_frame(0)->xyz_image(); @@ -310,7 +310,7 @@ static shared_ptr<Film> movie_V (string name) { - auto film = new_test_film2 (name); + auto film = new_test_film(name); auto content = dynamic_pointer_cast<FFmpegContent>(content_factory("test/data/rgb_grey_testcard.mp4")[0]); BOOST_REQUIRE (content); film->examine_and_add_content (content); @@ -328,7 +328,7 @@ static shared_ptr<Film> movie_VoF (string name) { - auto film = new_test_film2 (name); + auto film = new_test_film(name); auto content = dynamic_pointer_cast<FFmpegContent>(content_factory("test/data/rgb_grey_testcard.mp4")[0]); BOOST_REQUIRE (content); film->examine_and_add_content (content); @@ -347,7 +347,7 @@ static shared_ptr<Film> movie_F (string name) { - auto film = new_test_film2 (name); + auto film = new_test_film(name); auto content = dynamic_pointer_cast<FFmpegContent>(content_factory("test/data/rgb_grey_testcard.mov")[0]); BOOST_REQUIRE (content); film->examine_and_add_content (content); @@ -365,7 +365,7 @@ static shared_ptr<Film> movie_FoV (string name) { - auto film = new_test_film2 (name); + auto film = new_test_film(name); auto content = dynamic_pointer_cast<FFmpegContent>(content_factory("test/data/rgb_grey_testcard.mov")[0]); BOOST_REQUIRE (content); film->examine_and_add_content (content); @@ -384,7 +384,7 @@ static shared_ptr<Film> image_F (string name) { - auto film = new_test_film2 (name); + auto film = new_test_film(name); auto content = dynamic_pointer_cast<ImageContent>(content_factory("test/data/rgb_grey_testcard.png")[0]); BOOST_REQUIRE (content); film->examine_and_add_content (content); @@ -402,7 +402,7 @@ static shared_ptr<Film> image_FoV (string name) { - auto film = new_test_film2 (name); + auto film = new_test_film(name); auto content = dynamic_pointer_cast<ImageContent>(content_factory("test/data/rgb_grey_testcard.png")[0]); BOOST_REQUIRE (content); film->examine_and_add_content (content); @@ -425,7 +425,7 @@ shared_ptr<Film> dcp_F (string name) { boost::filesystem::path const dcp = "test/data/RgbGreyTestcar_TST-1_F_MOS_2K_20201115_SMPTE_OV"; - auto film = new_test_film2 (name); + auto film = new_test_film(name); auto content = make_shared<DCPContent>(dcp); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs()); @@ -459,7 +459,7 @@ V_movie_range (shared_ptr<Film> film) { auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE); job->set_encoder ( - make_shared<FFmpegEncoder>(film, job, film->file("export.mov"), ExportFormat::PRORES_HQ, true, false, false, 23) + make_shared<FFmpegFilmEncoder>(film, job, film->file("export.mov"), ExportFormat::PRORES_HQ, true, false, false, 23) ); JobManager::instance()->add (job); BOOST_REQUIRE (!wait_for_jobs()); @@ -480,7 +480,7 @@ BOOST_AUTO_TEST_CASE (movie_V_to_dcp) { auto range = dcp_range (movie_V("movie_V_to_dcp")); /* Video range has been correctly expanded to full for the DCP */ - check_int_close (range, {0, 4083}, 2); + check_int_close(range, {0, 4081}, 2); } @@ -498,7 +498,7 @@ BOOST_AUTO_TEST_CASE (movie_F_to_dcp) { auto range = dcp_range (movie_F("movie_F_to_dcp")); /* The nearly-full-range of the input has been preserved */ - check_int_close (range, {0, 4083}, 2); + check_int_close(range, {0, 4080}, 2); } @@ -506,14 +506,14 @@ BOOST_AUTO_TEST_CASE (video_FoV_to_dcp) { auto range = dcp_range (movie_FoV("video_FoV_to_dcp")); /* The nearly-full-range of the input has become even more full, and clipped */ - check_int_close (range, {0, 4095}, 2); + check_int_close(range, {0, 4093}, 2); } BOOST_AUTO_TEST_CASE (image_F_to_dcp) { auto range = dcp_range (image_F("image_F_to_dcp")); - check_int_close (range, {0, 4083}, 3); + check_int_close(range, {0, 4080}, 3); } diff --git a/test/video_mxf_content_test.cc b/test/video_mxf_content_test.cc index f3766e4af..df83db41c 100644 --- a/test/video_mxf_content_test.cc +++ b/test/video_mxf_content_test.cc @@ -33,7 +33,7 @@ #include "lib/video_mxf_content.h" #include "test.h" #include <dcp/equality_options.h> -#include <dcp/mono_picture_asset.h> +#include <dcp/mono_j2k_picture_asset.h> #include <boost/test/unit_test.hpp> @@ -50,18 +50,10 @@ static void note (dcp::NoteType, std::string) /** Basic test of using video MXF content */ BOOST_AUTO_TEST_CASE (video_mxf_content_test) { - auto film = new_test_film ("video_mxf_content_test"); - film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); - film->set_container (Ratio::from_id ("185")); - film->set_name ("video_mxf_content_test"); - auto const ref_mxf = find_file("test/data/scaling_test_185_185", "j2c"); + auto content = content_factory(ref_mxf); - auto content = content_factory(ref_mxf)[0]; - auto check = dynamic_pointer_cast<VideoMXFContent> (content); - BOOST_REQUIRE (check); - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); + auto film = new_test_film("video_mxf_content_test", content); make_and_verify_dcp ( film, { @@ -70,9 +62,9 @@ BOOST_AUTO_TEST_CASE (video_mxf_content_test) dcp::VerificationNote::Code::INVALID_JPEG2000_GUARD_BITS_FOR_2K }); - auto ref = make_shared<dcp::MonoPictureAsset>(ref_mxf); - boost::filesystem::directory_iterator i ("build/test/video_mxf_content_test/video"); - auto comp = make_shared<dcp::MonoPictureAsset>(*i); + auto ref = make_shared<dcp::MonoJ2KPictureAsset>(ref_mxf); + auto comp_mxf = find_file(film->file(film->dcp_name()), "j2c_"); + auto comp = make_shared<dcp::MonoJ2KPictureAsset>(comp_mxf); dcp::EqualityOptions op; BOOST_CHECK (ref->equals (comp, op, note)); } diff --git a/test/writer_test.cc b/test/writer_test.cc index 86b60818f..b4ef93c1d 100644 --- a/test/writer_test.cc +++ b/test/writer_test.cc @@ -23,7 +23,7 @@ #include "lib/content.h" #include "lib/content_factory.h" #include "lib/cross.h" -#include "lib/dcp_encoder.h" +#include "lib/dcp_film_encoder.h" #include "lib/film.h" #include "lib/job.h" #include "lib/video_content.h" @@ -44,9 +44,9 @@ using std::vector; BOOST_AUTO_TEST_CASE (test_write_odd_amount_of_silence) { auto content = content_factory("test/data/flat_red.png"); - auto film = new_test_film2 ("test_write_odd_amount_of_silence", content); + auto film = new_test_film("test_write_odd_amount_of_silence", content); content[0]->video->set_length(24); - auto writer = make_shared<Writer>(film, shared_ptr<Job>()); + auto writer = make_shared<Writer>(film, shared_ptr<Job>(), "foo"); auto audio = make_shared<AudioBuffers>(6, 48000); audio->make_silent (); @@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE (interrupt_writer) { Cleanup cl; - auto film = new_test_film2 ("test_interrupt_writer", {}, &cl); + auto film = new_test_film("test_interrupt_writer", {}, &cl); auto content = content_factory("test/data/check_image0.png")[0]; film->examine_and_add_content (content); @@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE (interrupt_writer) auto video_ptr = make_shared<dcp::ArrayData>(video.data(), video.size()); auto audio = make_shared<AudioBuffers>(6, 48000 / 24); - auto writer = make_shared<Writer>(film, shared_ptr<Job>()); + auto writer = make_shared<Writer>(film, shared_ptr<Job>(), film->dir(film->dcp_name())); writer->start (); for (int i = 0; i < frames; ++i) { @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE (interrupt_writer) /* Start digest calculations then abort them; there should be no crash or error */ boost::thread thread([film, writer]() { - writer->finish(film->dir(film->dcp_name())); + writer->finish(); }); dcpomatic_sleep_seconds (1); @@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(writer_progress_test) auto picture1 = content_factory("test/data/flat_red.png")[0]; auto picture2 = content_factory("test/data/flat_red.png")[0]; - auto film = new_test_film2("writer_progress_test", { picture1, picture2 }); + auto film = new_test_film("writer_progress_test", { picture1, picture2 }); film->set_reel_type(ReelType::BY_VIDEO_CONTENT); picture1->video->set_length(240); picture2->video->set_length(240); @@ -149,7 +149,7 @@ BOOST_AUTO_TEST_CASE(writer_progress_test) last_sub_name = job->sub_name(); }); - DCPEncoder encoder(film, job); + DCPFilmEncoder encoder(film, job); encoder.go(); } diff --git a/test/wscript b/test/wscript index cd23badc0..2802a4678 100644 --- a/test/wscript +++ b/test/wscript @@ -37,7 +37,7 @@ def build(bld): obj.name = 'unit-tests' obj.uselib = 'BOOST_TEST BOOST_THREAD BOOST_FILESYSTEM BOOST_DATETIME SNDFILE SAMPLERATE DCP FONTCONFIG CAIROMM PANGOMM XMLPP ' obj.uselib += 'AVFORMAT AVFILTER AVCODEC AVUTIL SWSCALE SWRESAMPLE POSTPROC CXML SUB GLIB CURL SSH XMLSEC BOOST_REGEX ICU NETTLE PNG JPEG ' - obj.uselib += 'LEQM_NRT ZIP ' + obj.uselib += 'LEQM_NRT ZIP SQLITE3 ' if bld.env.TARGET_WINDOWS_64 or bld.env.TARGET_WINDOWS_32: obj.uselib += 'WINSOCK2 DBGHELP SHLWAPI MSWSOCK BOOST_LOCALE ' if bld.env.TARGET_LINUX: @@ -60,6 +60,7 @@ def build(bld): burnt_subtitle_test.cc butler_test.cc bv20_test.cc + cinema_list_test.cc cinema_sound_processor_test.cc client_server_test.cc closed_caption_test.cc @@ -78,6 +79,7 @@ def build(bld): dcp_playback_test.cc dcp_subtitle_test.cc digest_test.cc + dkdm_recipient_list_test.cc empty_caption_test.cc empty_test.cc encryption_test.cc @@ -111,9 +113,10 @@ def build(bld): import_dcp_test.cc interrupt_encoder_test.cc isdcf_name_test.cc - j2k_bandwidth_test.cc + j2k_encode_threading_test.cc j2k_encoder_test.cc job_manager_test.cc + j2k_video_bit_rate_test.cc kdm_cli_test.cc kdm_naming_test.cc kdm_util_test.cc @@ -162,6 +165,7 @@ def build(bld): template_test.cc test.cc text_decoder_test.cc + text_entry_point_test.cc threed_test.cc time_calculation_test.cc torture_test.cc |
