From 769624d0f6910905420f3a19bed0d945776a3102 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 21 Jun 2018 23:02:22 +0100 Subject: [PATCH] New tests. --- test/data | 2 +- test/subtitle_charset_test.cc | 52 +++++++++++++++++++++++++++++++++++ test/wscript | 1 + 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 test/subtitle_charset_test.cc diff --git a/test/data b/test/data index 0e8a96a94..70fc36f11 160000 --- a/test/data +++ b/test/data @@ -1 +1 @@ -Subproject commit 0e8a96a94556234c2af035d353e775b775cbc339 +Subproject commit 70fc36f1155b9463ceac955ea9e376a0e6499652 diff --git a/test/subtitle_charset_test.cc b/test/subtitle_charset_test.cc new file mode 100644 index 000000000..822a78386 --- /dev/null +++ b/test/subtitle_charset_test.cc @@ -0,0 +1,52 @@ +/* + Copyright (C) 2018 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see . + +*/ + +#include "test.h" +#include "lib/content.h" +#include "lib/film.h" +#include "lib/content_factory.h" +#include "lib/text_subtitle.h" +#include "lib/text_subtitle_content.h" +#include + +using boost::shared_ptr; +using boost::dynamic_pointer_cast; + +/** Test parsing of UTF16 CR/LF input */ +BOOST_AUTO_TEST_CASE (subtitle_charset_test1) +{ + shared_ptr film = new_test_film2 ("subtitle_charset_test1"); + shared_ptr content = content_factory (film, private_data / "PADDINGTON soustitresVFdef.srt").front (); + film->examine_and_add_content (content); + BOOST_REQUIRE (!wait_for_jobs ()); +} + +/** Test parsing of OSX input */ +BOOST_AUTO_TEST_CASE (subtitle_charset_test2) +{ + shared_ptr film = new_test_film2 ("subtitle_charset_test2"); + shared_ptr content = content_factory (film, "test/data/osx.srt").front (); + film->examine_and_add_content (content); + BOOST_REQUIRE (!wait_for_jobs ()); + shared_ptr ts = dynamic_pointer_cast (content); + BOOST_REQUIRE (ts); + /* Make sure we got the subtitle data from the file */ + BOOST_REQUIRE_EQUAL (content->full_length().get(), 6052032); +} diff --git a/test/wscript b/test/wscript index c50826ae9..9931e97d7 100644 --- a/test/wscript +++ b/test/wscript @@ -98,6 +98,7 @@ def build(bld): srt_subtitle_test.cc ssa_subtitle_test.cc stream_test.cc + subtitle_charset_test.cc subtitle_reel_number_test.cc subtitle_trim_test.cc test.cc -- 2.30.2