From bb1eb89a4e4318a63f509a213216da5fdc1937b9 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 23 Oct 2016 23:00:56 +0100 Subject: [PATCH] Add new test for imported XML subtitles. --- test/data | 2 +- test/dcp_subtitle_test.cc | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/test/data b/test/data index 6966026bc..b0c5a330f 160000 --- a/test/data +++ b/test/data @@ -1 +1 @@ -Subproject commit 6966026bc74f121a681b24b04d69c97a196b1355 +Subproject commit b0c5a330fcb42082ff4f22c245721f3f88f9d74f diff --git a/test/dcp_subtitle_test.cc b/test/dcp_subtitle_test.cc index 34059a680..643742a7f 100644 --- a/test/dcp_subtitle_test.cc +++ b/test/dcp_subtitle_test.cc @@ -122,3 +122,37 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test2) BOOST_REQUIRE_EQUAL (sub.front().subs.size(), 1); BOOST_CHECK_EQUAL (sub.front().subs.front().text(), "<b>Hello world!</b>"); } + +/** Test a failure case */ +BOOST_AUTO_TEST_CASE (dcp_subtitle_test3) +{ + shared_ptr 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); + shared_ptr content (new DCPSubtitleContent (film, "test/data/dcp_sub3.xml")); + film->examine_and_add_content (content); + wait_for_jobs (); + + film->make_dcp (); + wait_for_jobs (); + + shared_ptr decoder (new DCPSubtitleDecoder (content)); + list sub = decoder->subtitle->get_text ( + ContentTimePeriod (ContentTime::from_seconds(0), ContentTime::from_seconds(2)), true, true + ); + BOOST_REQUIRE_EQUAL (sub.size(), 1); + BOOST_REQUIRE_EQUAL (sub.front().subs.size(), 3); + list s = sub.front().subs; + list::const_iterator i = s.begin (); + BOOST_CHECK_EQUAL (i->text(), "This"); + ++i; + BOOST_REQUIRE (i != s.end ()); + BOOST_CHECK_EQUAL (i->text(), " is "); + ++i; + BOOST_REQUIRE (i != s.end ()); + BOOST_CHECK_EQUAL (i->text(), "wrong."); + ++i; + BOOST_REQUIRE (i == s.end ()); +} -- 2.30.2