summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-07-21 15:16:18 +0100
committerCarl Hetherington <cth@carlh.net>2018-07-21 15:16:18 +0100
commitcbd4450197a083bf58bda510e626f73ba583cb66 (patch)
tree2be308772512539570beab36beab02bde72d6d4b /test
parent1013175d5f6adfa0e6a7442e4c9aebb893787748 (diff)
Basics of multiple captions per content so that DCPContent can
hold subs and closed captions.
Diffstat (limited to 'test')
-rw-r--r--test/closed_caption_test.cc2
-rw-r--r--test/dcp_subtitle_test.cc14
-rw-r--r--test/ffmpeg_encoder_test.cc24
-rw-r--r--test/player_test.cc4
-rw-r--r--test/remake_with_subtitle_test.cc6
-rw-r--r--test/srt_subtitle_test.cc26
-rw-r--r--test/ssa_subtitle_test.cc4
-rw-r--r--test/subtitle_reel_number_test.cc4
-rw-r--r--test/vf_test.cc16
9 files changed, 52 insertions, 48 deletions
diff --git a/test/closed_caption_test.cc b/test/closed_caption_test.cc
index a837c1a07..75768eca8 100644
--- a/test/closed_caption_test.cc
+++ b/test/closed_caption_test.cc
@@ -37,7 +37,7 @@ BOOST_AUTO_TEST_CASE (closed_caption_test1)
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
- content->caption->set_type (CAPTION_CLOSED);
+ content->only_caption()->set_type (CAPTION_CLOSED);
film->make_dcp ();
BOOST_REQUIRE (!wait_for_jobs ());
diff --git a/test/dcp_subtitle_test.cc b/test/dcp_subtitle_test.cc
index 48f88f8dc..3d4b57e3c 100644
--- a/test/dcp_subtitle_test.cc
+++ b/test/dcp_subtitle_test.cc
@@ -71,8 +71,8 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test)
BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(2).get());
- content->caption->set_use (true);
- content->caption->set_burn (false);
+ content->only_caption()->set_use (true);
+ content->only_caption()->set_burn (false);
film->make_dcp ();
BOOST_REQUIRE (!wait_for_jobs ());
@@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_within_dcp_test)
BOOST_REQUIRE (!wait_for_jobs ());
shared_ptr<DCPDecoder> decoder (new DCPDecoder (content, film->log(), false));
- decoder->caption->PlainStart.connect (bind (store, _1));
+ decoder->only_caption()->PlainStart.connect (bind (store, _1));
stored = optional<ContentTextCaption> ();
while (!decoder->pass() && !stored) {}
@@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test2)
BOOST_REQUIRE (!wait_for_jobs ());
shared_ptr<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder (content, film->log()));
- decoder->caption->PlainStart.connect (bind (store, _1));
+ decoder->only_caption()->PlainStart.connect (bind (store, _1));
stored = optional<ContentTextCaption> ();
while (!decoder->pass ()) {
@@ -142,7 +142,7 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test3)
shared_ptr<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder (content, film->log()));
stored = optional<ContentTextCaption> ();
while (!decoder->pass ()) {
- decoder->caption->PlainStart.connect (bind (store, _1));
+ decoder->only_caption()->PlainStart.connect (bind (store, _1));
if (stored && stored->from() == ContentTime::from_seconds(0.08)) {
list<dcp::SubtitleString> s = stored->subs;
list<dcp::SubtitleString>::const_iterator i = s.begin ();
@@ -171,8 +171,8 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test4)
film->examine_and_add_content (content2);
BOOST_REQUIRE (!wait_for_jobs ());
- content->caption->add_font (shared_ptr<Font> (new Font ("font1")));
- content2->caption->add_font (shared_ptr<Font> (new Font ("font2")));
+ content->only_caption()->add_font (shared_ptr<Font> (new Font ("font1")));
+ content2->only_caption()->add_font (shared_ptr<Font> (new Font ("font2")));
film->make_dcp ();
BOOST_REQUIRE (!wait_for_jobs ());
diff --git a/test/ffmpeg_encoder_test.cc b/test/ffmpeg_encoder_test.cc
index d9dd0f383..837541f9d 100644
--- a/test/ffmpeg_encoder_test.cc
+++ b/test/ffmpeg_encoder_test.cc
@@ -124,9 +124,9 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test6)
shared_ptr<TextCaptionFileContent> s (new TextCaptionFileContent (film, "test/data/subrip2.srt"));
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
- s->caption->set_colour (dcp::Colour (255, 255, 0));
- s->caption->set_effect (dcp::SHADOW);
- s->caption->set_effect_colour (dcp::Colour (0, 255, 255));
+ s->only_caption()->set_colour (dcp::Colour (255, 255, 0));
+ s->only_caption()->set_effect (dcp::SHADOW);
+ s->only_caption()->set_effect_colour (dcp::Colour (0, 255, 255));
film->write_metadata();
shared_ptr<Job> job (new TranscodeJob (film));
@@ -149,9 +149,9 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test7)
shared_ptr<TextCaptionFileContent> s (new TextCaptionFileContent (film, "test/data/subrip.srt"));
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
- s->caption->set_colour (dcp::Colour (255, 255, 0));
- s->caption->set_effect (dcp::SHADOW);
- s->caption->set_effect_colour (dcp::Colour (0, 255, 255));
+ s->only_caption()->set_colour (dcp::Colour (255, 255, 0));
+ s->only_caption()->set_effect (dcp::SHADOW);
+ s->only_caption()->set_effect_colour (dcp::Colour (0, 255, 255));
shared_ptr<Job> job (new TranscodeJob (film));
FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test7.mov", FFmpegEncoder::FORMAT_PRORES, false);
@@ -175,9 +175,9 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test2)
shared_ptr<TextCaptionFileContent> s (new TextCaptionFileContent (film, "test/data/subrip2.srt"));
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
- s->caption->set_colour (dcp::Colour (255, 255, 0));
- s->caption->set_effect (dcp::SHADOW);
- s->caption->set_effect_colour (dcp::Colour (0, 255, 255));
+ s->only_caption()->set_colour (dcp::Colour (255, 255, 0));
+ s->only_caption()->set_effect (dcp::SHADOW);
+ s->only_caption()->set_effect_colour (dcp::Colour (0, 255, 255));
film->write_metadata();
shared_ptr<Job> job (new TranscodeJob (film));
@@ -200,9 +200,9 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test3)
shared_ptr<TextCaptionFileContent> s (new TextCaptionFileContent (film, "test/data/subrip.srt"));
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
- s->caption->set_colour (dcp::Colour (255, 255, 0));
- s->caption->set_effect (dcp::SHADOW);
- s->caption->set_effect_colour (dcp::Colour (0, 255, 255));
+ s->only_caption()->set_colour (dcp::Colour (255, 255, 0));
+ s->only_caption()->set_effect (dcp::SHADOW);
+ s->only_caption()->set_effect_colour (dcp::Colour (0, 255, 255));
film->write_metadata();
shared_ptr<Job> job (new TranscodeJob (film));
diff --git a/test/player_test.cc b/test/player_test.cc
index 510083236..bc4af970e 100644
--- a/test/player_test.cc
+++ b/test/player_test.cc
@@ -211,7 +211,7 @@ BOOST_AUTO_TEST_CASE (player_seek_test)
shared_ptr<DCPContent> dcp (new DCPContent (film, private_data / "awkward_subs"));
film->examine_and_add_content (dcp, true);
BOOST_REQUIRE (!wait_for_jobs ());
- dcp->caption->set_use (true);
+ dcp->only_caption()->set_use (true);
shared_ptr<Player> player (new Player (film, film->playlist()));
player->set_fast ();
@@ -242,7 +242,7 @@ BOOST_AUTO_TEST_CASE (player_seek_test2)
shared_ptr<DCPContent> dcp (new DCPContent (film, private_data / "awkward_subs2"));
film->examine_and_add_content (dcp, true);
BOOST_REQUIRE (!wait_for_jobs ());
- dcp->caption->set_use (true);
+ dcp->only_caption()->set_use (true);
shared_ptr<Player> player (new Player (film, film->playlist()));
player->set_fast ();
diff --git a/test/remake_with_subtitle_test.cc b/test/remake_with_subtitle_test.cc
index 5c371e855..bef1bc36a 100644
--- a/test/remake_with_subtitle_test.cc
+++ b/test/remake_with_subtitle_test.cc
@@ -37,14 +37,14 @@ BOOST_AUTO_TEST_CASE (remake_with_subtitle_test)
shared_ptr<FFmpegContent> content = dynamic_pointer_cast<FFmpegContent>(content_factory(film, private_data / "prophet_short_clip.mkv").front());
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
- content->caption->set_burn (true);
- content->caption->set_use (true);
+ content->only_caption()->set_burn (true);
+ content->only_caption()->set_use (true);
film->make_dcp ();
BOOST_REQUIRE (!wait_for_jobs ());
boost::filesystem::remove_all (film->dir (film->dcp_name(), false));
- content->caption->set_use (false);
+ content->only_caption()->set_use (false);
film->make_dcp ();
BOOST_REQUIRE (!wait_for_jobs ());
diff --git a/test/srt_subtitle_test.cc b/test/srt_subtitle_test.cc
index 28ef9606f..6975403ba 100644
--- a/test/srt_subtitle_test.cc
+++ b/test/srt_subtitle_test.cc
@@ -51,8 +51,8 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test)
film->examine_and_add_content (content);
wait_for_jobs ();
- content->caption->set_use (true);
- content->caption->set_burn (false);
+ content->only_caption()->set_use (true);
+ content->only_caption()->set_burn (false);
film->make_dcp ();
wait_for_jobs ();
@@ -73,10 +73,10 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test2)
film->examine_and_add_content (content);
wait_for_jobs ();
- content->caption->set_use (true);
- content->caption->set_burn (false);
+ content->only_caption()->set_use (true);
+ content->only_caption()->set_burn (false);
/* Use test/data/subrip2.srt as if it were a font file */
- content->caption->fonts().front()->set_file (FontFiles::NORMAL, "test/data/subrip2.srt");
+ content->only_caption()->fonts().front()->set_file (FontFiles::NORMAL, "test/data/subrip2.srt");
film->make_dcp ();
wait_for_jobs ();
@@ -108,8 +108,8 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test3)
film->examine_and_add_content (content);
wait_for_jobs ();
- content->caption->set_use (true);
- content->caption->set_burn (false);
+ content->only_caption()->set_use (true);
+ content->only_caption()->set_burn (false);
film->make_dcp ();
wait_for_jobs ();
@@ -126,8 +126,8 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test4)
film->set_name ("frobozz");
film->set_interop (false);
shared_ptr<TextCaptionFileContent> content (new TextCaptionFileContent (film, "test/data/subrip2.srt"));
- content->caption->set_use (true);
- content->caption->set_burn (false);
+ content->only_caption()->set_use (true);
+ content->only_caption()->set_burn (false);
film->examine_and_add_content (content);
wait_for_jobs ();
film->make_dcp ();
@@ -147,8 +147,8 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test5)
film->set_interop (true);
film->set_sequence (false);
shared_ptr<TextCaptionFileContent> content (new TextCaptionFileContent (film, "test/data/subrip2.srt"));
- content->caption->set_use (true);
- content->caption->set_burn (false);
+ content->only_caption()->set_use (true);
+ content->only_caption()->set_burn (false);
film->examine_and_add_content (content);
film->examine_and_add_content (content);
wait_for_jobs ();
@@ -165,8 +165,8 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test6)
shared_ptr<Film> film = new_test_film2 ("srt_subtitle_test6");
film->set_interop (false);
shared_ptr<TextCaptionFileContent> content (new TextCaptionFileContent (film, "test/data/frames.srt"));
- content->caption->set_use (true);
- content->caption->set_burn (false);
+ content->only_caption()->set_use (true);
+ content->only_caption()->set_burn (false);
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
film->make_dcp ();
diff --git a/test/ssa_subtitle_test.cc b/test/ssa_subtitle_test.cc
index 6d4eecd92..57813b944 100644
--- a/test/ssa_subtitle_test.cc
+++ b/test/ssa_subtitle_test.cc
@@ -51,8 +51,8 @@ BOOST_AUTO_TEST_CASE (ssa_subtitle_test1)
film->examine_and_add_content (content);
wait_for_jobs ();
- content->caption->set_use (true);
- content->caption->set_burn (false);
+ content->only_caption()->set_use (true);
+ content->only_caption()->set_burn (false);
film->make_dcp ();
wait_for_jobs ();
diff --git a/test/subtitle_reel_number_test.cc b/test/subtitle_reel_number_test.cc
index a82094a73..7cb184477 100644
--- a/test/subtitle_reel_number_test.cc
+++ b/test/subtitle_reel_number_test.cc
@@ -46,8 +46,8 @@ BOOST_AUTO_TEST_CASE (subtitle_reel_number_test)
shared_ptr<TextCaptionFileContent> content (new TextCaptionFileContent (film, "test/data/subrip5.srt"));
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
- content->caption->set_use (true);
- content->caption->set_burn (false);
+ content->only_caption()->set_use (true);
+ content->only_caption()->set_burn (false);
film->set_reel_type (REELTYPE_BY_LENGTH);
film->set_interop (true);
film->set_reel_length (1024 * 1024 * 512);
diff --git a/test/vf_test.cc b/test/vf_test.cc
index 3b3077242..5cded6e25 100644
--- a/test/vf_test.cc
+++ b/test/vf_test.cc
@@ -57,14 +57,16 @@ BOOST_AUTO_TEST_CASE (vf_test1)
string why_not;
BOOST_CHECK (!dcp->can_reference_video(why_not));
BOOST_CHECK (!dcp->can_reference_audio(why_not));
- BOOST_CHECK (!dcp->can_reference_subtitle(why_not));
+ BOOST_CHECK (!dcp->can_reference_caption(CAPTION_OPEN, why_not));
+ BOOST_CHECK (!dcp->can_reference_caption(CAPTION_CLOSED, why_not));
/* Multi-reel DCP can be referenced if we are using by-video-content */
film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
BOOST_CHECK (dcp->can_reference_video(why_not));
BOOST_CHECK (dcp->can_reference_audio(why_not));
- /* (but reels_test2 has no subtitles to reference) */
- BOOST_CHECK (!dcp->can_reference_subtitle(why_not));
+ /* (but reels_test2 has no captions to reference) */
+ BOOST_CHECK (!dcp->can_reference_caption(CAPTION_OPEN, why_not));
+ BOOST_CHECK (!dcp->can_reference_caption(CAPTION_CLOSED, why_not));
shared_ptr<FFmpegContent> other (new FFmpegContent (film, "test/data/test.mp4"));
film->examine_and_add_content (other);
@@ -74,14 +76,16 @@ BOOST_AUTO_TEST_CASE (vf_test1)
other->set_position (DCPTime (0));
BOOST_CHECK (!dcp->can_reference_video(why_not));
BOOST_CHECK (!dcp->can_reference_audio(why_not));
- BOOST_CHECK (!dcp->can_reference_subtitle(why_not));
+ BOOST_CHECK (!dcp->can_reference_caption(CAPTION_OPEN, why_not));
+ BOOST_CHECK (!dcp->can_reference_caption(CAPTION_CLOSED, why_not));
/* This should not be considered an overlap */
other->set_position (dcp->end ());
BOOST_CHECK (dcp->can_reference_video(why_not));
BOOST_CHECK (dcp->can_reference_audio(why_not));
- /* (reels_test2 has no subtitles to reference) */
- BOOST_CHECK (!dcp->can_reference_subtitle(why_not));
+ /* (reels_test2 has no captions to reference) */
+ BOOST_CHECK (!dcp->can_reference_caption(CAPTION_OPEN, why_not));
+ BOOST_CHECK (!dcp->can_reference_caption(CAPTION_CLOSED, why_not));
}
/** Make a OV with video and audio and a VF referencing the OV and adding subs */