New tests.
authorCarl Hetherington <cth@carlh.net>
Thu, 21 Jun 2018 22:02:22 +0000 (23:02 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 21 Jun 2018 22:02:22 +0000 (23:02 +0100)
test/data
test/subtitle_charset_test.cc [new file with mode: 0644]
test/wscript

index 0e8a96a94556234c2af035d353e775b775cbc339..70fc36f1155b9463ceac955ea9e376a0e6499652 160000 (submodule)
--- 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 (file)
index 0000000..822a783
--- /dev/null
@@ -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);
+}
index c50826ae90cca8ba0b82acf2fd919bcd6e65c58c..9931e97d717816181862caf329504d7cd9845cd3 100644 (file)
@@ -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