diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-06-21 23:02:22 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-06-21 23:02:22 +0100 |
| commit | 769624d0f6910905420f3a19bed0d945776a3102 (patch) | |
| tree | a79e9f96401ceee051958810b56bcf226ab16cd3 /test | |
| parent | 084a2f045c216a2c26f2cc9fde7989dca110b537 (diff) | |
New tests.
Diffstat (limited to 'test')
| m--------- | test/data | 0 | ||||
| -rw-r--r-- | test/subtitle_charset_test.cc | 52 | ||||
| -rw-r--r-- | test/wscript | 1 |
3 files changed, 53 insertions, 0 deletions
diff --git a/test/data b/test/data -Subproject 0e8a96a94556234c2af035d353e775b775cbc33 +Subproject 70fc36f1155b9463ceac955ea9e376a0e649965 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 <cth@carlh.net> + + 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 <http://www.gnu.org/licenses/>. + +*/ + +#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 <boost/test/unit_test.hpp> + +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> film = new_test_film2 ("subtitle_charset_test1"); + shared_ptr<Content> 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> film = new_test_film2 ("subtitle_charset_test2"); + shared_ptr<Content> content = content_factory (film, "test/data/osx.srt").front (); + film->examine_and_add_content (content); + BOOST_REQUIRE (!wait_for_jobs ()); + shared_ptr<TextSubtitleContent> ts = dynamic_pointer_cast<TextSubtitleContent> (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 |
