}
SubRipError::SubRipError (string saw, string expecting, boost::filesystem::path f)
- : FileError (String::compose (_("Error in SubRip file: saw %1 while expecting %2"), saw, expecting), f)
+ : FileError (String::compose (_("Error in SubRip file: saw %1 while expecting %2"), saw.empty() ? "[nothing]" : saw, expecting), f)
{
-
+
}
switch (state) {
case COUNTER:
{
+ if (line.empty ()) {
+ /* a blank line at the start is ok */
+ break;
+ }
+
int x = 0;
try {
x = lexical_cast<int> (line);
} catch (...) {
}
-
+
if (x == next_count) {
state = METADATA;
++next_count;
write_image (image.image, "build/test/subrip_render_test.png");
check_file ("build/test/subrip_render_test.png", "test/data/subrip_render_test.png");
}
+
+/** Test of reading a typical .srt */
+BOOST_AUTO_TEST_CASE (subrip_read_test)
+{
+ shared_ptr<Film> film = new_test_film ("subrip_read_test");
+ boost::filesystem::path p = private_data / "sintel_en.srt";
+ shared_ptr<SubRipContent> s (new SubRipContent (film, p));
+ s->examine (shared_ptr<Job> ());
+}
using std::list;
using boost::shared_ptr;
-boost::filesystem::path private_data = boost::filesystem::path ("test") / boost::filesystem::path ("private");
+boost::filesystem::path private_data = boost::filesystem::path ("..") / boost::filesystem::path ("dcpomatic-test-private");
class TestUISignaller : public UISignaller
{