From 23a1a0395b31c4dc36d65531d02b7df240a25dce Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 20 Jun 2016 22:47:17 +0100 Subject: Accept V4+ styles as well as V4 ones in SSA. --- test/ssa_reader_test.cc | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'test') diff --git a/test/ssa_reader_test.cc b/test/ssa_reader_test.cc index 0fa326b..d0ed8fa 100644 --- a/test/ssa_reader_test.cc +++ b/test/ssa_reader_test.cc @@ -303,3 +303,51 @@ BOOST_AUTO_TEST_CASE (ssa_reader_test4) BLOCK ("2nd line: this is bold", "Verdana", 50, true, false, false); SUB_END (); } + +/** Test reading of a .ass file */ +BOOST_AUTO_TEST_CASE (ssa_reader_test5) +{ + boost::filesystem::path p = private_test / "dcpsubtest-en.ass"; + FILE* f = fopen (p.string().c_str(), "r"); + sub::SSAReader reader (f); + fclose (f); + list subs = sub::collect > (reader.subtitles ()); + + list::iterator i = subs.begin (); + list::iterator j; + list::iterator k; + + BOOST_REQUIRE (i != subs.end ()); + + SUB_START (sub::Time::from_hms (0, 0, 1, 0), sub::Time::from_hms (0, 0, 3, 0)); + /* The first line should be one line (26 points, 1.2 times + spaced, as a proportion of the total screen height 729 + points) up. + */ + LINE ((26.0 * 1.2 / 792), sub::BOTTOM_OF_SCREEN); + BLOCK ("1st subtitle, 1st line", "arial", 26, true, false, false); + LINE (0, sub::BOTTOM_OF_SCREEN); + BLOCK ("2nd subtitle, 2nd line", "arial", 26, true, false, false); + SUB_END (); + + SUB_START (sub::Time::from_hms (0, 0, 3, 100), sub::Time::from_hms (0, 0, 5, 100)); + LINE ((26.0 * 1.2 / 792), sub::BOTTOM_OF_SCREEN); + BLOCK ("2nd subtitle, 1st line", "arial", 26, true, false, false); + LINE (0, sub::BOTTOM_OF_SCREEN); + BLOCK ("2nd subtitle, 2nd line", "arial", 26, true, false, false); + SUB_END (); + + SUB_START (sub::Time::from_hms (0, 0, 5, 200), sub::Time::from_hms (0, 0, 7, 200)); + LINE ((26.0 * 1.2 / 792), sub::BOTTOM_OF_SCREEN); + BLOCK ("3rd subtitle, 1st line", "arial", 26, true, false, false); + LINE (0, sub::BOTTOM_OF_SCREEN); + BLOCK ("3rd subtitle, 2nd line", "arial", 26, true, false, false); + SUB_END (); + + SUB_START (sub::Time::from_hms (0, 0, 7, 300), sub::Time::from_hms (0, 0, 9, 300)); + LINE ((26.0 * 1.2 / 792), sub::BOTTOM_OF_SCREEN); + BLOCK ("4th subtitle, 1st line", "arial", 26, true, false, false); + LINE (0, sub::BOTTOM_OF_SCREEN); + BLOCK ("4th subtitle, 2nd line", "arial", 26, true, false, false); + SUB_END (); +} -- cgit v1.2.3