summaryrefslogtreecommitdiff
path: root/test/player_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-07-26 15:07:09 +0100
committerCarl Hetherington <cth@carlh.net>2018-07-26 15:07:09 +0100
commit53e1b97984f7e8c7bf1b16a9f3a333578545ec10 (patch)
tree4ec161be97788d98d1e67d1d339b79923e1f4ee4 /test/player_test.cc
parent8484d278ec6905502bd1178cc58d8cb7b3c12df0 (diff)
Add support for ignoring everything except text in the player.
Diffstat (limited to 'test/player_test.cc')
-rw-r--r--test/player_test.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/player_test.cc b/test/player_test.cc
index 7cc846aff..605f3bddd 100644
--- a/test/player_test.cc
+++ b/test/player_test.cc
@@ -282,3 +282,42 @@ BOOST_AUTO_TEST_CASE (player_trim_test)
film->make_dcp ();
BOOST_REQUIRE (!wait_for_jobs ());
}
+
+struct Sub {
+ PlayerText text;
+ TextType type;
+ DCPTimePeriod period;
+};
+
+static void
+store (list<Sub>* out, PlayerText text, TextType type, DCPTimePeriod period)
+{
+ Sub s;
+ s.text = text;
+ s.type = type;
+ s.period = period;
+ out->push_back (s);
+}
+
+/** Test ignoring both video and audio */
+BOOST_AUTO_TEST_CASE (player_ignore_video_and_audio_test)
+{
+ shared_ptr<Film> film = new_test_film2 ("player_ignore_video_and_audio_test");
+ shared_ptr<Content> ff = content_factory(film, private_data / "boon_telly.mkv").front();
+ film->examine_and_add_content (ff);
+ shared_ptr<Content> text = content_factory(film, "test/data/subrip.srt").front();
+ film->examine_and_add_content (text);
+ BOOST_REQUIRE (!wait_for_jobs());
+ text->only_text()->set_type (TEXT_CLOSED_CAPTION);
+ text->only_text()->set_use (true);
+
+ shared_ptr<Player> player (new Player(film, film->playlist()));
+ player->set_ignore_video ();
+ player->set_ignore_audio ();
+
+ list<Sub> out;
+ player->Text.connect (bind (&store, &out, _1, _2, _3));
+ while (!player->pass ()) {}
+
+ BOOST_CHECK_EQUAL (out.size(), 6);
+}