diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-10-23 23:00:56 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-10-23 23:00:56 +0100 |
| commit | bb1eb89a4e4318a63f509a213216da5fdc1937b9 (patch) | |
| tree | ed57a380d0121644fff1b2ccbb4067f15a123a75 /test/dcp_subtitle_test.cc | |
| parent | e286c2a7a70b5859b0f88f8914062fc406b6ea25 (diff) | |
Add new test for imported XML subtitles.
Diffstat (limited to 'test/dcp_subtitle_test.cc')
| -rw-r--r-- | test/dcp_subtitle_test.cc | 34 |
1 files changed, 34 insertions, 0 deletions
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> 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<DCPSubtitleContent> 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<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder (content)); + list<ContentTextSubtitle> 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<dcp::SubtitleString> s = sub.front().subs; + list<dcp::SubtitleString>::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 ()); +} |
