diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-08-21 15:42:04 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-08-21 15:42:04 +0100 |
| commit | bab8eafbb60f2d16e68a337b2cb2fd9eccaec654 (patch) | |
| tree | f118052e14686dcb8fb6398eccbaf7bb070d4248 /test | |
| parent | 8409171ec7d749a2426cca57cf6edd6714dc497d (diff) | |
Partial; better tests for subs.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ref/subs.xml | 10 | ||||
| -rw-r--r-- | test/tests.cc | 42 |
2 files changed, 37 insertions, 15 deletions
diff --git a/test/ref/subs.xml b/test/ref/subs.xml index 6afeefb3..399c2a57 100644 --- a/test/ref/subs.xml +++ b/test/ref/subs.xml @@ -9,10 +9,12 @@ <Subtitle SpotNumber="1" TimeIn="00:00:05:198" TimeOut="00:00:07:115" FadeUpTime="1" FadeDownTime="1"> <Text VAlign="bottom" VPosition="15.0">My jacket was Idi Amin's</Text> </Subtitle> - <Subtitle SpotNumber="2" TimeIn="00:00:07:177" TimeOut="00:00:11:031" FadeUpTime="1" FadeDownTime="1"> - <Text VAlign="bottom" VPosition="21.0">My corset was H.M. The Queen's</Text> - <Text VAlign="bottom" VPosition="15.0">My large wonderbra</Text> - </Subtitle> + <Font Italic="yes"> + <Subtitle SpotNumber="2" TimeIn="00:00:07:177" TimeOut="00:00:11:031" FadeUpTime="1" FadeDownTime="1"> + <Text VAlign="bottom" VPosition="21.0">My corset was H.M. The Queen's</Text> + <Text VAlign="bottom" VPosition="15.0">My large wonderbra</Text> + </Subtitle> + </Font> <Subtitle SpotNumber="3" TimeIn="00:00:11:094" TimeOut="00:00:13:063" FadeUpTime="1" FadeDownTime="1"> <Text VAlign="bottom" VPosition="15.0">Once belonged to the Shah</Text> </Subtitle> diff --git a/test/tests.cc b/test/tests.cc index 649a96ff..3d56c3e7 100644 --- a/test/tests.cc +++ b/test/tests.cc @@ -115,9 +115,10 @@ BOOST_AUTO_TEST_CASE (subtitles) libdcp::SubtitleAsset subs ("test/ref", "subs.xml"); BOOST_CHECK_EQUAL (subs.language(), "French"); - BOOST_CHECK_EQUAL (subs.font_nodes().size(), 1); - BOOST_CHECK_EQUAL (subs.font_nodes().front()->subtitle_nodes.size(), 4); +// BOOST_CHECK_EQUAL (subs.font_nodes().size(), 1); +// BOOST_CHECK_EQUAL (subs.font_nodes().front()->subtitle_nodes.size(), 4); +#if 0 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)); @@ -148,15 +149,34 @@ BOOST_AUTO_TEST_CASE (subtitles) 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); +#endif + + list<shared_ptr<libdcp::Subtitle> > s = subs.subtitles_at (libdcp::Time (0, 0, 6, 1)); + BOOST_CHECK_EQUAL (s.size(), 1); + BOOST_CHECK_EQUAL (s.front()->text(), "My jacket was Idi Amin's"); + BOOST_CHECK_EQUAL (s.front()->v_position(), 15); + BOOST_CHECK_EQUAL (s.front()->in(), libdcp::Time (0, 0, 5, 198)); + BOOST_CHECK_EQUAL (s.front()->out(), libdcp::Time (0, 0, 7, 115)); + BOOST_CHECK_EQUAL (s.front()->font(), "Arial"); + BOOST_CHECK_EQUAL (s.front()->size_in_pixels(1080), 53); + + s = subs.subtitles_at (libdcp::Time (0, 0, 11, 95)); + BOOST_CHECK_EQUAL (s.size(), 1); + BOOST_CHECK_EQUAL (s.front ()->text(), "Once belonged to the Shah"); + BOOST_CHECK_EQUAL (s.front ()->v_position(), 15); + BOOST_CHECK_EQUAL (s.front ()->in(), libdcp::Time (0, 0, 11, 94)); + BOOST_CHECK_EQUAL (s.front ()->out(), libdcp::Time (0, 0, 13, 63)); + BOOST_CHECK_EQUAL (s.front ()->font(), "Arial"); + BOOST_CHECK_EQUAL (s.front ()->size_in_pixels(1080), 53); + + s = subs.subtitles_at (libdcp::Time (0, 0, 14, 42)); + BOOST_CHECK_EQUAL (s.size(), 1); + BOOST_CHECK_EQUAL (s.front ()->text(), "And these are Roy Hattersley's jeans"); + BOOST_CHECK_EQUAL (s.front ()->v_position(), 15); + BOOST_CHECK_EQUAL (s.front ()->in(), libdcp::Time (0, 0, 13, 104)); + BOOST_CHECK_EQUAL (s.front ()->out(), libdcp::Time (0, 0, 15, 177)); + BOOST_CHECK_EQUAL (s.front ()->font(), "Arial"); + BOOST_CHECK_EQUAL (s.front ()->size_in_pixels(1080), 53); } BOOST_AUTO_TEST_CASE (dcp_time) |
