Whitespace.
[libdcp.git] / test / write_subtitle_test.cc
index e6898b76414996a7c2def33ec9f993d5ca68d2bb..10d39f11b841f503fc89e2b74982351ad13076e3 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2015-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
 
     You should have received a copy of the GNU General Public License
     along with libdcp.  If not, see <http://www.gnu.org/licenses/>.
+
+    In addition, as a special exception, the copyright holders give
+    permission to link the code of portions of this program with the
+    OpenSSL library under certain conditions as described in each
+    individual source file, and distribute linked combinations
+    including the two.
+
+    You must obey the GNU General Public License in all respects
+    for all of the code used other than OpenSSL.  If you modify
+    file(s) with this exception, you may extend this exception to your
+    version of the file(s), but you are not obligated to do so.  If you
+    do not wish to do so, delete this exception statement from your
+    version.  If you delete this exception statement from all source
+    files in the program, then also delete it here.
 */
 
 #include "interop_subtitle_asset.h"
 #include "util.h"
 #include <boost/test/unit_test.hpp>
 
-using std::list;
 using std::string;
-using boost::shared_ptr;
+using std::shared_ptr;
+using std::vector;
+using std::make_shared;
+using boost::optional;
 
 /** Test dcp::order::Font::take_intersection */
 BOOST_AUTO_TEST_CASE (take_intersection_test)
@@ -81,10 +97,10 @@ BOOST_AUTO_TEST_CASE (take_difference_test)
 /** Test dcp::order::Subtitle::pull_fonts */
 BOOST_AUTO_TEST_CASE (pull_fonts_test1)
 {
-       shared_ptr<dcp::order::Part> root (new dcp::order::Part (shared_ptr<dcp::order::Part> ()));
-       shared_ptr<dcp::order::Subtitle> sub1 (new dcp::order::Subtitle (root, dcp::Time(), dcp::Time(), dcp::Time(), dcp::Time()));
+       auto root = make_shared<dcp::order::Part>(shared_ptr<dcp::order::Part>());
+       auto sub1 = make_shared<dcp::order::Subtitle>(root, dcp::Time(), dcp::Time(), dcp::Time(), dcp::Time());
        root->children.push_back (sub1);
-       shared_ptr<dcp::order::Text> text1 (new dcp::order::Text (sub1, dcp::HALIGN_CENTER, 0, dcp::VALIGN_TOP, 0, dcp::DIRECTION_LTR));
+       auto text1 = make_shared<dcp::order::Text>(sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, dcp::Direction::LTR);
        sub1->children.push_back (text1);
        text1->font._values["font"] = "Inconsolata";
        text1->font._values["size"] = "42";
@@ -103,11 +119,11 @@ BOOST_AUTO_TEST_CASE (pull_fonts_test2)
        shared_ptr<dcp::order::Part> root (new dcp::order::Part (shared_ptr<dcp::order::Part> ()));
        shared_ptr<dcp::order::Subtitle> sub1 (new dcp::order::Subtitle (root, dcp::Time(), dcp::Time(), dcp::Time(), dcp::Time()));
        root->children.push_back (sub1);
-       shared_ptr<dcp::order::Text> text1 (new dcp::order::Text (sub1, dcp::HALIGN_CENTER, 0, dcp::VALIGN_TOP, 0, dcp::DIRECTION_LTR));
+       shared_ptr<dcp::order::Text> text1 (new dcp::order::Text (sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, dcp::Direction::LTR));
        sub1->children.push_back (text1);
        text1->font._values["font"] = "Inconsolata";
        text1->font._values["size"] = "42";
-       shared_ptr<dcp::order::Text> text2 (new dcp::order::Text (sub1, dcp::HALIGN_CENTER, 0, dcp::VALIGN_TOP, 0, dcp::DIRECTION_LTR));
+       shared_ptr<dcp::order::Text> text2 (new dcp::order::Text (sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, dcp::Direction::LTR));
        sub1->children.push_back (text2);
        text2->font._values["font"] = "Inconsolata";
        text2->font._values["size"] = "48";
@@ -128,7 +144,7 @@ BOOST_AUTO_TEST_CASE (pull_fonts_test3)
        shared_ptr<dcp::order::Part> root (new dcp::order::Part (shared_ptr<dcp::order::Part> ()));
        shared_ptr<dcp::order::Subtitle> sub1 (new dcp::order::Subtitle (root, dcp::Time(), dcp::Time(), dcp::Time(), dcp::Time()));
        root->children.push_back (sub1);
-       shared_ptr<dcp::order::Text> text1 (new dcp::order::Text (sub1, dcp::HALIGN_CENTER, 0, dcp::VALIGN_TOP, 0, dcp::DIRECTION_LTR));
+       shared_ptr<dcp::order::Text> text1 (new dcp::order::Text (sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, dcp::Direction::LTR));
        sub1->children.push_back (text1);
        dcp::order::Font font;
        font._values["font"] = "Inconsolata";
@@ -164,12 +180,12 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test)
                                dcp::Time (0, 4,  9, 22, 24),
                                dcp::Time (0, 4, 11, 22, 24),
                                0,
-                               dcp::HALIGN_CENTER,
+                               dcp::HAlign::CENTER,
                                0.8,
-                               dcp::VALIGN_TOP,
-                               dcp::DIRECTION_LTR,
+                               dcp::VAlign::TOP,
+                               dcp::Direction::LTR,
                                "Hello world",
-                               dcp::NONE,
+                               dcp::Effect::NONE,
                                dcp::Colour (0, 0, 0),
                                dcp::Time (0, 0, 0, 0, 24),
                                dcp::Time (0, 0, 0, 0, 24)
@@ -190,12 +206,12 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test)
                                dcp::Time (5, 41,  0, 21, 24),
                                dcp::Time (6, 12, 15, 21, 24),
                                0,
-                               dcp::HALIGN_CENTER,
+                               dcp::HAlign::CENTER,
                                0.4,
-                               dcp::VALIGN_BOTTOM,
-                               dcp::DIRECTION_LTR,
+                               dcp::VAlign::BOTTOM,
+                               dcp::Direction::LTR,
                                "What's going on",
-                               dcp::BORDER,
+                               dcp::Effect::BORDER,
                                dcp::Colour (1, 2, 3),
                                dcp::Time (1, 2, 3, 4, 24),
                                dcp::Time (5, 6, 7, 8, 24)
@@ -223,7 +239,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test)
                  "</Font>"
                "</DCSubtitle>",
                c.xml_as_string (),
-               list<string> ()
+               vector<string>()
                );
 }
 
@@ -250,12 +266,12 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test2)
                                dcp::Time (0, 4,  9, 22, 24),
                                dcp::Time (0, 4, 11, 22, 24),
                                -0.2,
-                               dcp::HALIGN_CENTER,
+                               dcp::HAlign::CENTER,
                                0.8,
-                               dcp::VALIGN_TOP,
-                               dcp::DIRECTION_LTR,
+                               dcp::VAlign::TOP,
+                               dcp::Direction::LTR,
                                "Hello world",
-                               dcp::NONE,
+                               dcp::Effect::NONE,
                                dcp::Colour (0, 0, 0),
                                dcp::Time (0, 0, 0, 0, 24),
                                dcp::Time (0, 0, 0, 0, 24)
@@ -276,12 +292,12 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test2)
                                dcp::Time (5, 41,  0, 21, 24),
                                dcp::Time (6, 12, 15, 21, 24),
                                -0.2,
-                               dcp::HALIGN_CENTER,
+                               dcp::HAlign::CENTER,
                                0.4,
-                               dcp::VALIGN_BOTTOM,
-                               dcp::DIRECTION_LTR,
+                               dcp::VAlign::BOTTOM,
+                               dcp::Direction::LTR,
                                "What's going on",
-                               dcp::BORDER,
+                               dcp::Effect::BORDER,
                                dcp::Colour (1, 2, 3),
                                dcp::Time (1, 2, 3, 4, 24),
                                dcp::Time (5, 6, 7, 8, 24)
@@ -309,13 +325,15 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test2)
                  "</Font>"
                "</DCSubtitle>",
                c.xml_as_string (),
-               list<string> ()
+               vector<string>()
                );
 }
 
 /* Write some subtitle content as Interop XML using bitmaps and check that it is right */
 BOOST_AUTO_TEST_CASE (write_interop_subtitle_test3)
 {
+       RNGFixer fix;
+
        shared_ptr<dcp::InteropSubtitleAsset> c (new dcp::InteropSubtitleAsset());
        c->set_reel_number ("1");
        c->set_language ("EN");
@@ -324,13 +342,13 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test3)
        c->add (
                shared_ptr<dcp::Subtitle> (
                        new dcp::SubtitleImage (
-                               dcp::Data ("test/data/sub.png"),
+                               dcp::ArrayData ("test/data/sub.png"),
                                dcp::Time (0, 4,  9, 22, 24),
                                dcp::Time (0, 4, 11, 22, 24),
                                0,
-                               dcp::HALIGN_CENTER,
+                               dcp::HAlign::CENTER,
                                0.8,
-                               dcp::VALIGN_TOP,
+                               dcp::VAlign::TOP,
                                dcp::Time (0, 0, 0, 0, 24),
                                dcp::Time (0, 0, 0, 0, 24)
                                )
@@ -338,42 +356,50 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test3)
                );
 
        c->_id = "a6c58cff-3e1e-4b38-acec-a42224475ef6";
+       boost::filesystem::remove_all ("build/test/write_interop_subtitle_test3");
        boost::filesystem::create_directories ("build/test/write_interop_subtitle_test3");
        c->write ("build/test/write_interop_subtitle_test3/subs.xml");
 
        shared_ptr<dcp::Reel> reel (new dcp::Reel());
        reel->add(shared_ptr<dcp::ReelSubtitleAsset>(new dcp::ReelSubtitleAsset(c, dcp::Fraction(24, 1), 6046, 0)));
 
-       dcp::XMLMetadata xml_meta;
-       xml_meta.issue_date = "2018-09-02T04:45:18+00:00";
-       xml_meta.annotation_text = "Created by libdcp";
+       string const issue_date = "2018-09-02T04:45:18+00:00";
+       string const issuer = "libdcp";
+       string const creator = "libdcp";
+       string const annotation_text = "Created by libdcp";
 
-       shared_ptr<dcp::CPL> cpl (new dcp::CPL ("My film", dcp::FEATURE));
+       auto cpl = make_shared<dcp::CPL>("My film", dcp::ContentKind::FEATURE);
        cpl->add (reel);
-       cpl->set_metadata (xml_meta);
-       cpl->set_content_version_label_text ("foo");
+       cpl->set_issuer (issuer);
+       cpl->set_creator (creator);
+       cpl->set_issue_date (issue_date);
+       cpl->set_annotation_text (annotation_text);
+       auto cv = cpl->content_version();
+       BOOST_REQUIRE (cv);
+       cv->label_text = "foo";
+       cpl->set_content_version (*cv);
 
        dcp::DCP dcp ("build/test/write_interop_subtitle_test3");
        dcp.add (cpl);
-       dcp.write_xml (dcp::INTEROP, xml_meta);
+       dcp.write_xml (dcp::Standard::INTEROP, issuer, creator, issue_date, annotation_text);
 
        check_xml (
                dcp::file_to_string("test/ref/write_interop_subtitle_test3/subs.xml"),
                dcp::file_to_string("build/test/write_interop_subtitle_test3/subs.xml"),
-               list<string>()
+               vector<string>()
                );
-       check_file ("build/test/write_interop_subtitle_test3/ef5c6baa-be2d-4f86-9f15-b1acc792ee8b.png", "test/data/sub.png");
+       check_file ("build/test/write_interop_subtitle_test3/d36f4bb3-c4fa-4a95-9915-6fec3110cd71.png", "test/data/sub.png");
 
        check_xml (
                dcp::file_to_string("test/ref/write_interop_subtitle_test3/ASSETMAP"),
                dcp::file_to_string("build/test/write_interop_subtitle_test3/ASSETMAP"),
-               list<string>()
+               vector<string>()
                );
 
        check_xml (
                dcp::file_to_string("test/ref/write_interop_subtitle_test3/pkl.xml"),
-               dcp::file_to_string("build/test/write_interop_subtitle_test3/pkl_f5aab304-8145-44e3-a265-aa8d8812d8a2.xml"),
-               list<string>()
+               dcp::file_to_string("build/test/write_interop_subtitle_test3/pkl_6a9e31a6-50a4-4ecb-8683-fa667848470a.xml"),
+               vector<string>()
                );
 }
 
@@ -382,59 +408,55 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test)
 {
        dcp::SMPTESubtitleAsset c;
        c.set_reel_number (1);
-       c.set_language ("EN");
+       c.set_language (dcp::LanguageTag("en"));
        c.set_content_title_text ("Test");
        c.set_issue_date (dcp::LocalTime ("2016-04-01T03:52:00+00:00"));
 
        c.add (
-               shared_ptr<dcp::Subtitle> (
-                       new dcp::SubtitleString (
-                               string ("Frutiger"),
-                               false,
-                               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)
-                               )
+               make_shared<dcp::SubtitleString> (
+                       string ("Frutiger"),
+                       false,
+                       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::Effect::NONE,
+                       dcp::Colour (0, 0, 0),
+                       dcp::Time (0, 0, 0, 0, 24),
+                       dcp::Time (0, 0, 0, 0, 24)
                        )
                );
 
        c.add (
-               shared_ptr<dcp::Subtitle> (
-                       new dcp::SubtitleString (
-                               boost::optional<string> (),
-                               true,
-                               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)
-                               )
+               make_shared<dcp::SubtitleString>(
+                       boost::optional<string> (),
+                       true,
+                       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::Effect::BORDER,
+                       dcp::Colour (1, 2, 3),
+                       dcp::Time (1, 2, 3, 4, 24),
+                       dcp::Time (5, 6, 7, 8, 24)
                        )
                );
 
@@ -447,7 +469,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test)
                  "<dcst:ContentTitleText>Test</dcst:ContentTitleText>"
                  "<dcst:IssueDate>2016-04-01T03:52:00.000+00:00</dcst:IssueDate>"
                  "<dcst:ReelNumber>1</dcst:ReelNumber>"
-                 "<dcst:Language>EN</dcst:Language>"
+                 "<dcst:Language>en</dcst:Language>"
                  "<dcst:EditRate>24 1</dcst:EditRate>"
                  "<dcst:TimeCodeRate>24</dcst:TimeCodeRate>"
                  "<dcst:SubtitleList>"
@@ -464,7 +486,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test)
                  "</dcst:SubtitleList>"
                "</dcst:SubtitleReel>",
                c.xml_as_string (),
-               list<string> ()
+               vector<string>()
                );
 }
 
@@ -475,177 +497,165 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2)
 {
        dcp::SMPTESubtitleAsset c;
        c.set_reel_number (1);
-       c.set_language ("EN");
+       c.set_language (dcp::LanguageTag("en"));
        c.set_content_title_text ("Test");
        c.set_issue_date (dcp::LocalTime ("2016-04-01T03:52:00+00:00"));
 
        c.add (
-               shared_ptr<dcp::Subtitle> (
-                       new dcp::SubtitleString (
-                               string ("Arial"),
-                               false,
-                               false,
-                               false,
-                               dcp::Colour (255, 255, 255),
-                               48,
-                               1.0,
-                               dcp::Time (0, 0, 1, 0, 24),
-                               dcp::Time (0, 0, 9, 0, 24),
-                               0,
-                               dcp::HALIGN_CENTER,
-                               0.8,
-                               dcp::VALIGN_TOP,
-                               dcp::DIRECTION_LTR,
-                               "Testing is ",
-                               dcp::NONE,
-                               dcp::Colour (0, 0, 0),
-                               dcp::Time (0, 0, 0, 0, 24),
-                               dcp::Time (0, 0, 0, 0, 24)
-                               )
+               make_shared<dcp::SubtitleString>(
+                       string ("Arial"),
+                       false,
+                       false,
+                       false,
+                       dcp::Colour (255, 255, 255),
+                       48,
+                       1.0,
+                       dcp::Time (0, 0, 1, 0, 24),
+                       dcp::Time (0, 0, 9, 0, 24),
+                       0,
+                       dcp::HAlign::CENTER,
+                       0.8,
+                       dcp::VAlign::TOP,
+                       dcp::Direction::LTR,
+                       "Testing is ",
+                       dcp::Effect::NONE,
+                       dcp::Colour (0, 0, 0),
+                       dcp::Time (0, 0, 0, 0, 24),
+                       dcp::Time (0, 0, 0, 0, 24)
                        )
                );
 
        c.add (
-               shared_ptr<dcp::Subtitle> (
-                       new dcp::SubtitleString (
-                               string ("Arial"),
-                               true,
-                               false,
-                               false,
-                               dcp::Colour (255, 255, 255),
-                               48,
-                               1.0,
-                               dcp::Time (0, 0, 1, 0, 24),
-                               dcp::Time (0, 0, 9, 0, 24),
-                               0,
-                               dcp::HALIGN_CENTER,
-                               0.8,
-                               dcp::VALIGN_TOP,
-                               dcp::DIRECTION_LTR,
-                               "really",
-                               dcp::NONE,
-                               dcp::Colour (0, 0, 0),
-                               dcp::Time (0, 0, 0, 0, 24),
-                               dcp::Time (0, 0, 0, 0, 24)
-                               )
+               make_shared<dcp::SubtitleString>(
+                       string ("Arial"),
+                       true,
+                       false,
+                       false,
+                       dcp::Colour (255, 255, 255),
+                       48,
+                       1.0,
+                       dcp::Time (0, 0, 1, 0, 24),
+                       dcp::Time (0, 0, 9, 0, 24),
+                       0,
+                       dcp::HAlign::CENTER,
+                       0.8,
+                       dcp::VAlign::TOP,
+                       dcp::Direction::LTR,
+                       "really",
+                       dcp::Effect::NONE,
+                       dcp::Colour (0, 0, 0),
+                       dcp::Time (0, 0, 0, 0, 24),
+                       dcp::Time (0, 0, 0, 0, 24)
                        )
                );
 
        c.add (
-               shared_ptr<dcp::Subtitle> (
-                       new dcp::SubtitleString (
-                               string ("Arial"),
-                               false,
-                               false,
-                               false,
-                               dcp::Colour (255, 255, 255),
-                               48,
-                               1.0,
-                               dcp::Time (0, 0, 1, 0, 24),
-                               dcp::Time (0, 0, 9, 0, 24),
-                               0,
-                               dcp::HALIGN_CENTER,
-                               0.8,
-                               dcp::VALIGN_TOP,
-                               dcp::DIRECTION_LTR,
-                               " fun",
-                               dcp::NONE,
-                               dcp::Colour (0, 0, 0),
-                               dcp::Time (0, 0, 0, 0, 24),
-                               dcp::Time (0, 0, 0, 0, 24)
-                               )
+               make_shared<dcp::SubtitleString>(
+                       string ("Arial"),
+                       false,
+                       false,
+                       false,
+                       dcp::Colour (255, 255, 255),
+                       48,
+                       1.0,
+                       dcp::Time (0, 0, 1, 0, 24),
+                       dcp::Time (0, 0, 9, 0, 24),
+                       0,
+                       dcp::HAlign::CENTER,
+                       0.8,
+                       dcp::VAlign::TOP,
+                       dcp::Direction::LTR,
+                       " fun",
+                       dcp::Effect::NONE,
+                       dcp::Colour (0, 0, 0),
+                       dcp::Time (0, 0, 0, 0, 24),
+                       dcp::Time (0, 0, 0, 0, 24)
                        )
                );
 
        c.add (
-               shared_ptr<dcp::Subtitle> (
-                       new dcp::SubtitleString (
-                               string ("Arial"),
-                               false,
-                               false,
-                               false,
-                               dcp::Colour (255, 255, 255),
-                               48,
-                               1.0,
-                               dcp::Time (0, 0, 1, 0, 24),
-                               dcp::Time (0, 0, 9, 0, 24),
-                               0,
-                               dcp::HALIGN_CENTER,
-                               0.9,
-                               dcp::VALIGN_TOP,
-                               dcp::DIRECTION_LTR,
-                               "This is the ",
-                               dcp::NONE,
-                               dcp::Colour (0, 0, 0),
-                               dcp::Time (0, 0, 0, 0, 24),
-                               dcp::Time (0, 0, 0, 0, 24)
-                               )
+               make_shared<dcp::SubtitleString>(
+                       string ("Arial"),
+                       false,
+                       false,
+                       false,
+                       dcp::Colour (255, 255, 255),
+                       48,
+                       1.0,
+                       dcp::Time (0, 0, 1, 0, 24),
+                       dcp::Time (0, 0, 9, 0, 24),
+                       0,
+                       dcp::HAlign::CENTER,
+                       0.9,
+                       dcp::VAlign::TOP,
+                       dcp::Direction::LTR,
+                       "This is the ",
+                       dcp::Effect::NONE,
+                       dcp::Colour (0, 0, 0),
+                       dcp::Time (0, 0, 0, 0, 24),
+                       dcp::Time (0, 0, 0, 0, 24)
                        )
                );
 
        c.add (
-               shared_ptr<dcp::Subtitle> (
-                       new dcp::SubtitleString (
-                               string ("Arial"),
-                               true,
-                               false,
-                               false,
-                               dcp::Colour (255, 255, 255),
-                               48,
-                               1.0,
-                               dcp::Time (0, 0, 1, 0, 24),
-                               dcp::Time (0, 0, 9, 0, 24),
-                               0,
-                               dcp::HALIGN_CENTER,
-                               0.9,
-                               dcp::VALIGN_TOP,
-                               dcp::DIRECTION_LTR,
-                               "second",
-                               dcp::NONE,
-                               dcp::Colour (0, 0, 0),
-                               dcp::Time (0, 0, 0, 0, 24),
-                               dcp::Time (0, 0, 0, 0, 24)
-                               )
+               make_shared<dcp::SubtitleString>(
+                       string ("Arial"),
+                       true,
+                       false,
+                       false,
+                       dcp::Colour (255, 255, 255),
+                       48,
+                       1.0,
+                       dcp::Time (0, 0, 1, 0, 24),
+                       dcp::Time (0, 0, 9, 0, 24),
+                       0,
+                       dcp::HAlign::CENTER,
+                       0.9,
+                       dcp::VAlign::TOP,
+                       dcp::Direction::LTR,
+                       "second",
+                       dcp::Effect::NONE,
+                       dcp::Colour (0, 0, 0),
+                       dcp::Time (0, 0, 0, 0, 24),
+                       dcp::Time (0, 0, 0, 0, 24)
                        )
                );
 
        c.add (
-               shared_ptr<dcp::Subtitle> (
-                       new dcp::SubtitleString (
-                               string ("Arial"),
-                               false,
-                               false,
-                               false,
-                               dcp::Colour (255, 255, 255),
-                               48,
-                               1.0,
-                               dcp::Time (0, 0, 1, 0, 24),
-                               dcp::Time (0, 0, 9, 0, 24),
-                               0,
-                               dcp::HALIGN_CENTER,
-                               0.9,
-                               dcp::VALIGN_TOP,
-                               dcp::DIRECTION_LTR,
-                               " line",
-                               dcp::NONE,
-                               dcp::Colour (0, 0, 0),
-                               dcp::Time (0, 0, 0, 0, 24),
-                               dcp::Time (0, 0, 0, 0, 24)
-                               )
+               make_shared<dcp::SubtitleString>(
+                       string ("Arial"),
+                       false,
+                       false,
+                       false,
+                       dcp::Colour (255, 255, 255),
+                       48,
+                       1.0,
+                       dcp::Time (0, 0, 1, 0, 24),
+                       dcp::Time (0, 0, 9, 0, 24),
+                       0,
+                       dcp::HAlign::CENTER,
+                       0.9,
+                       dcp::VAlign::TOP,
+                       dcp::Direction::LTR,
+                       " line",
+                       dcp::Effect::NONE,
+                       dcp::Colour (0, 0, 0),
+                       dcp::Time (0, 0, 0, 0, 24),
+                       dcp::Time (0, 0, 0, 0, 24)
                        )
                );
 
        c._xml_id = "a6c58cff-3e1e-4b38-acec-a42224475ef6";
 
        check_xml (
-               c.xml_as_string (),
+               c.xml_as_string(),
                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                "<dcst:SubtitleReel xmlns:dcst=\"http://www.smpte-ra.org/schemas/428-7/2010/DCST\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
                  "<dcst:Id>urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6</dcst:Id>"
                  "<dcst:ContentTitleText>Test</dcst:ContentTitleText>"
                  "<dcst:IssueDate>2016-04-01T03:52:00.000+00:00</dcst:IssueDate>"
                  "<dcst:ReelNumber>1</dcst:ReelNumber>"
-                 "<dcst:Language>EN</dcst:Language>"
+                 "<dcst:Language>en</dcst:Language>"
                  "<dcst:EditRate>24 1</dcst:EditRate>"
                  "<dcst:TimeCodeRate>24</dcst:TimeCodeRate>"
                  "<dcst:SubtitleList>"
@@ -665,7 +675,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2)
                    "</dcst:Font>"
                  "</dcst:SubtitleList>"
                "</dcst:SubtitleReel>",
-               list<string> ()
+               vector<string>()
                );
 }
 
@@ -674,24 +684,22 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test3)
 {
        dcp::SMPTESubtitleAsset c;
        c.set_reel_number (1);
-       c.set_language ("EN");
+       c.set_language (dcp::LanguageTag("en"));
        c.set_content_title_text ("Test");
 
        c.add (
-               shared_ptr<dcp::Subtitle> (
-                       new dcp::SubtitleImage (
-                               dcp::Data ("test/data/sub.png"),
-                               dcp::Time (0, 4,  9, 22, 24),
-                               dcp::Time (0, 4, 11, 22, 24),
-                               0,
-                               dcp::HALIGN_CENTER,
-                               0.8,
-                               dcp::VALIGN_TOP,
-                               dcp::Time (0, 0, 0, 0, 24),
-                               dcp::Time (0, 0, 0, 0, 24)
-                               )
+               make_shared<dcp::SubtitleImage>(
+                       dcp::ArrayData ("test/data/sub.png"),
+                       dcp::Time (0, 4,  9, 22, 24),
+                       dcp::Time (0, 4, 11, 22, 24),
+                       0,
+                       dcp::HAlign::CENTER,
+                       0.8,
+                       dcp::VAlign::TOP,
+                       dcp::Time (0, 0, 0, 0, 24),
+                       dcp::Time (0, 0, 0, 0, 24)
                        )
-               );
+             );
 
        c._id = "a6c58cff-3e1e-4b38-acec-a42224475ef6";