diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-08-21 01:13:24 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-08-21 01:13:24 +0100 |
| commit | 8409171ec7d749a2426cca57cf6edd6714dc497d (patch) | |
| tree | e20fd664c31b0a52e7fc60bdfd60f38639accd06 /test | |
| parent | 4d91615b49a3246654baaf7a08f10f303b79b85a (diff) | |
De-hackify subtitle handling a bit.
Diffstat (limited to 'test')
| -rw-r--r-- | test/tests.cc | 62 |
1 files changed, 34 insertions, 28 deletions
diff --git a/test/tests.cc b/test/tests.cc index 97ad86ca..649a96ff 100644 --- a/test/tests.cc +++ b/test/tests.cc @@ -115,42 +115,48 @@ BOOST_AUTO_TEST_CASE (subtitles) libdcp::SubtitleAsset subs ("test/ref", "subs.xml"); BOOST_CHECK_EQUAL (subs.language(), "French"); - BOOST_CHECK_EQUAL (subs.fonts().size(), 1); - BOOST_CHECK_EQUAL (subs.fonts().front()->subtitles().size(), 4); + BOOST_CHECK_EQUAL (subs.font_nodes().size(), 1); + BOOST_CHECK_EQUAL (subs.font_nodes().front()->subtitle_nodes.size(), 4); - list<shared_ptr<libdcp::Subtitle> >::const_iterator i = subs.fonts().front()->subtitles().begin (); + list<shared_ptr<libdcp::SubtitleNode> >::const_iterator i = subs.font_nodes().front()->subtitle_nodes.begin (); - BOOST_CHECK_EQUAL ((*i)->in(), libdcp::Time (0, 0, 5, 198)); - BOOST_CHECK_EQUAL ((*i)->out(), libdcp::Time (0, 0, 7, 115)); - BOOST_CHECK_EQUAL ((*i)->texts().size(), 1); - BOOST_CHECK_EQUAL ((*i)->texts().front()->v_position(), 15); - BOOST_CHECK_EQUAL ((*i)->texts().front()->text(), "My jacket was Idi Amin's"); + BOOST_CHECK_EQUAL ((*i)->in, libdcp::Time (0, 0, 5, 198)); + BOOST_CHECK_EQUAL ((*i)->out, libdcp::Time (0, 0, 7, 115)); + BOOST_CHECK_EQUAL ((*i)->text_nodes.size(), 1); + BOOST_CHECK_EQUAL ((*i)->text_nodes.front()->v_position, 15); + BOOST_CHECK_EQUAL ((*i)->text_nodes.front()->text, "My jacket was Idi Amin's"); ++i; - BOOST_CHECK_EQUAL ((*i)->in(), libdcp::Time (0, 0, 7, 177)); - BOOST_CHECK_EQUAL ((*i)->out(), libdcp::Time (0, 0, 11, 31)); - BOOST_CHECK_EQUAL ((*i)->texts().size(), 2); - BOOST_CHECK_EQUAL ((*i)->texts().front()->v_position(), 21); - BOOST_CHECK_EQUAL ((*i)->texts().front()->text(), "My corset was H.M. The Queen's"); - BOOST_CHECK_EQUAL ((*i)->texts().back()->v_position(), 15); - BOOST_CHECK_EQUAL ((*i)->texts().back()->text(), "My large wonderbra"); + BOOST_CHECK_EQUAL ((*i)->in, libdcp::Time (0, 0, 7, 177)); + BOOST_CHECK_EQUAL ((*i)->out, libdcp::Time (0, 0, 11, 31)); + BOOST_CHECK_EQUAL ((*i)->text_nodes.size(), 2); + BOOST_CHECK_EQUAL ((*i)->text_nodes.front()->v_position, 21); + BOOST_CHECK_EQUAL ((*i)->text_nodes.front()->text, "My corset was H.M. The Queen's"); + BOOST_CHECK_EQUAL ((*i)->text_nodes.back()->v_position, 15); + BOOST_CHECK_EQUAL ((*i)->text_nodes.back()->text, "My large wonderbra"); ++i; - BOOST_CHECK_EQUAL ((*i)->in(), libdcp::Time (0, 0, 11, 94)); - BOOST_CHECK_EQUAL ((*i)->out(), libdcp::Time (0, 0, 13, 63)); - BOOST_CHECK_EQUAL ((*i)->texts().size(), 1); - BOOST_CHECK_EQUAL ((*i)->texts().front()->v_position(), 15); - BOOST_CHECK_EQUAL ((*i)->texts().front()->text(), "Once belonged to the Shah"); + BOOST_CHECK_EQUAL ((*i)->in, libdcp::Time (0, 0, 11, 94)); + BOOST_CHECK_EQUAL ((*i)->out, libdcp::Time (0, 0, 13, 63)); + BOOST_CHECK_EQUAL ((*i)->text_nodes.size(), 1); + BOOST_CHECK_EQUAL ((*i)->text_nodes.front()->v_position, 15); + BOOST_CHECK_EQUAL ((*i)->text_nodes.front()->text, "Once belonged to the Shah"); ++i; - BOOST_CHECK_EQUAL ((*i)->in(), libdcp::Time (0, 0, 13, 104)); - BOOST_CHECK_EQUAL ((*i)->out(), libdcp::Time (0, 0, 15, 177)); - BOOST_CHECK_EQUAL ((*i)->texts().size(), 1); - BOOST_CHECK_EQUAL ((*i)->texts().front()->v_position(), 15); - BOOST_CHECK_EQUAL ((*i)->texts().front()->text(), "And these are Roy Hattersley's jeans"); - - BOOST_CHECK_EQUAL (subs.subtitles_at (libdcp::Time (0, 0, 14, 042)).size(), 1); - BOOST_CHECK_EQUAL (subs.subtitles_at (libdcp::Time (0, 0, 14, 042)).front()->text(), "And these are Roy Hattersley's jeans"); + BOOST_CHECK_EQUAL ((*i)->in, libdcp::Time (0, 0, 13, 104)); + BOOST_CHECK_EQUAL ((*i)->out, libdcp::Time (0, 0, 15, 177)); + BOOST_CHECK_EQUAL ((*i)->text_nodes.size(), 1); + BOOST_CHECK_EQUAL ((*i)->text_nodes.front()->v_position, 15); + BOOST_CHECK_EQUAL ((*i)->text_nodes.front()->text, "And these are Roy Hattersley's jeans"); + + BOOST_CHECK_EQUAL (subs.subtitles_at (libdcp::Time (0, 0, 14, 42)).size(), 1); + shared_ptr<libdcp::Subtitle> s = subs.subtitles_at (libdcp::Time (0, 0, 14, 42)).front (); + BOOST_CHECK_EQUAL (s->text(), "And these are Roy Hattersley's jeans"); + BOOST_CHECK_EQUAL (s->v_position(), 15); + BOOST_CHECK_EQUAL (s->in(), libdcp::Time (0, 0, 13, 104)); + BOOST_CHECK_EQUAL (s->out(), libdcp::Time (0, 0, 15, 177)); + BOOST_CHECK_EQUAL (s->font(), "Arial"); + BOOST_CHECK_EQUAL (s->size_in_pixels(1080), 53); } BOOST_AUTO_TEST_CASE (dcp_time) |
