summaryrefslogtreecommitdiff
path: root/test/write_subtitle_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-04-12 01:37:00 +0100
committerCarl Hetherington <cth@carlh.net>2016-04-12 01:37:00 +0100
commit4b8c626b7e66ab1d4d69606e10316542c8873842 (patch)
tree94140f93b3911196ab60866fefb5c9f807a7a2ab /test/write_subtitle_test.cc
parent4b8eee1359d817937b84df7e88126fa16040e5c9 (diff)
Add direction support for SMPTE subtitles; fix pragma warnings with non-openmp builds.
Diffstat (limited to 'test/write_subtitle_test.cc')
-rw-r--r--test/write_subtitle_test.cc92
1 files changed, 90 insertions, 2 deletions
diff --git a/test/write_subtitle_test.cc b/test/write_subtitle_test.cc
index 67bfcd4e..ffd01e1f 100644
--- a/test/write_subtitle_test.cc
+++ b/test/write_subtitle_test.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2016 Carl Hetherington <cth@carlh.net>
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
@@ -18,6 +18,7 @@
*/
#include "interop_subtitle_asset.h"
+#include "smpte_subtitle_asset.h"
#include "subtitle_string.h"
#include "test.h"
#include <boost/test/unit_test.hpp>
@@ -27,7 +28,7 @@ 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)
+BOOST_AUTO_TEST_CASE (write_interop_subtitle_test)
{
dcp::InteropSubtitleAsset c;
c.set_reel_number ("1");
@@ -48,6 +49,7 @@ BOOST_AUTO_TEST_CASE (write_subtitle_test)
dcp::HALIGN_CENTER,
0.8,
dcp::VALIGN_TOP,
+ dcp::DIRECTION_LTR,
"Hello world",
dcp::NONE,
dcp::Colour (0, 0, 0),
@@ -70,6 +72,7 @@ BOOST_AUTO_TEST_CASE (write_subtitle_test)
dcp::HALIGN_CENTER,
0.4,
dcp::VALIGN_BOTTOM,
+ dcp::DIRECTION_LTR,
"What's going on",
dcp::BORDER,
dcp::Colour (1, 2, 3),
@@ -101,3 +104,88 @@ BOOST_AUTO_TEST_CASE (write_subtitle_test)
list<string> ()
);
}
+
+/* Write some subtitle content as SMPTE XML and check that it is right */
+BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test)
+{
+ dcp::SMPTESubtitleAsset c;
+ c.set_reel_number (1);
+ c.set_language ("EN");
+ c.set_content_title_text ("Test");
+ c.set_issue_date (dcp::LocalTime ("2016-04-01T03:52:00+00:00"));
+
+ c.add (
+ dcp::SubtitleString (
+ string ("Frutiger"),
+ false,
+ false,
+ dcp::Colour (255, 255, 255),
+ 48,
+ 1.0,
+ dcp::Time (0, 4, 9, 22, 24),
+ dcp::Time (0, 4, 11, 22, 24),
+ 0,
+ dcp::HALIGN_CENTER,
+ 0.8,
+ dcp::VALIGN_TOP,
+ dcp::DIRECTION_LTR,
+ "Hello world",
+ dcp::NONE,
+ dcp::Colour (0, 0, 0),
+ dcp::Time (0, 0, 0, 0, 24),
+ dcp::Time (0, 0, 0, 0, 24)
+ )
+ );
+
+ c.add (
+ dcp::SubtitleString (
+ boost::optional<string> (),
+ true,
+ true,
+ dcp::Colour (128, 0, 64),
+ 91,
+ 1.0,
+ dcp::Time (5, 41, 0, 21, 24),
+ dcp::Time (6, 12, 15, 21, 24),
+ 0,
+ dcp::HALIGN_CENTER,
+ 0.4,
+ dcp::VALIGN_BOTTOM,
+ dcp::DIRECTION_RTL,
+ "What's going on",
+ dcp::BORDER,
+ dcp::Colour (1, 2, 3),
+ dcp::Time (1, 2, 3, 4, 24),
+ dcp::Time (5, 6, 7, 8, 24)
+ )
+ );
+
+ c._id = "a6c58cff-3e1e-4b38-acec-a42224475ef6";
+
+ check_xml (
+ c.xml_as_string (),
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<dcst:SubtitleReel xmlns:dcst=\"http://www.smpte-ra.org/schemas/428-7/2010/DCST\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n"
+ " <dcst:Id>urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6</dcst:Id>\n"
+ " <dcst:ContentTitleText>Test</dcst:ContentTitleText>\n"
+ " <dcst:IssueDate>2016-04-01T03:52:00.000+00:00</dcst:IssueDate>\n"
+ " <dcst:ReelNumber>1</dcst:ReelNumber>\n"
+ " <dcst:Language>EN</dcst:Language>\n"
+ " <dcst:EditRate>24 1</dcst:EditRate>\n"
+ " <dcst:TimeCodeRate>24</dcst:TimeCodeRate>\n"
+ " <dcst:SubtitleList>\n"
+ " <dcst:Font ID=\"Frutiger\" Italic=\"no\" Color=\"FFFFFFFF\" Size=\"48\" Effect=\"none\" EffectColor=\"FF000000\" Script=\"normal\" Underline=\"no\" Weight=\"normal\">\n"
+ " <dcst:Subtitle SpotNumber=\"1\" TimeIn=\"00:04:09:22\" TimeOut=\"00:04:11:22\" FadeUpTime=\"00:00:00:00\" FadeDownTime=\"00:00:00:00\">\n"
+ " <dcst:Text Valign=\"top\" Vposition=\"80\">Hello world</dcst:Text>\n"
+ " </dcst:Subtitle>\n"
+ " </dcst:Font>\n"
+ " <dcst:Font Italic=\"yes\" Color=\"FF800040\" Size=\"91\" Effect=\"border\" EffectColor=\"FF010203\" Script=\"normal\" Underline=\"no\" Weight=\"bold\">\n"
+ " <dcst:Subtitle SpotNumber=\"2\" TimeIn=\"05:41:00:21\" TimeOut=\"06:12:15:21\" FadeUpTime=\"01:02:03:04\" FadeDownTime=\"05:06:07:08\">\n"
+ " <dcst:Text Valign=\"bottom\" Vposition=\"40\" Direction=\"rtl\">What's going on</dcst:Text>\n"
+ " </dcst:Subtitle>\n"
+ " </dcst:Font>\n"
+ " </dcst:SubtitleList>\n"
+ "</dcst:SubtitleReel>\n",
+ list<string> ()
+ );
+}