From 6a804ace532c13b2095972cd48d422e2c9fa0b70 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 30 Apr 2015 15:36:05 +0100 Subject: Add a very simple test for writing subtitles. --- test/write_subtitle_test.cc | 69 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 test/write_subtitle_test.cc (limited to 'test/write_subtitle_test.cc') diff --git a/test/write_subtitle_test.cc b/test/write_subtitle_test.cc new file mode 100644 index 00000000..3feb4b79 --- /dev/null +++ b/test/write_subtitle_test.cc @@ -0,0 +1,69 @@ +/* + Copyright (C) 2015 Carl Hetherington + + This program 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. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include "interop_subtitle_content.h" +#include "subtitle_string.h" +#include "test.h" +#include + +using std::list; +using std::string; +using boost::shared_ptr; + +/* Write some subtitle content as Interop XML and check that it is right */ +BOOST_AUTO_TEST_CASE (write_subtitle_test) +{ + dcp::SubtitleString s ( + string ("Arial"), + false, + dcp::Colour (255, 255, 255), + 48, + dcp::Time (0, 4, 9, 22, 24), + dcp::Time (0, 4, 11, 22, 24), + 0.8, + dcp::TOP, + "Hello world", + dcp::NONE, + dcp::Colour (0, 0, 0), + dcp::Time (0, 0, 0, 0, 24), + dcp::Time (0, 0, 0, 0, 24) + ); + + dcp::InteropSubtitleContent c ("Test", "EN"); + c.add (s); + + c._id = "a6c58cff-3e1e-4b38-acec-a42224475ef6"; + + check_xml ( + c.xml_as_string (), + "\n" + " a6c58cff-3e1e-4b38-acec-a42224475ef6\n" + " Test\n" + " 1\n" + " EN\n" + " \n" + " \n" + " Hello world\n" + " \n" + " \n" + "", + list () + ); +} + -- cgit v1.2.3