SubtitleString -> shared_ptr<Subtitle>
[libdcp.git] / test / write_subtitle_test.cc
1 /*
2     Copyright (C) 2015-2016 Carl Hetherington <cth@carlh.net>
3
4     This file is part of libdcp.
5
6     libdcp is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     libdcp is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with libdcp.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "interop_subtitle_asset.h"
21 #include "smpte_subtitle_asset.h"
22 #include "subtitle_string.h"
23 #include "subtitle_asset_internal.h"
24 #include "test.h"
25 #include <boost/test/unit_test.hpp>
26
27 using std::list;
28 using std::string;
29 using boost::shared_ptr;
30
31 /** Test dcp::order::Font::take_intersection */
32 BOOST_AUTO_TEST_CASE (take_intersection_test)
33 {
34         dcp::order::Font A;
35         A._values["foo"] = "bar";
36         A._values["fred"] = "jim";
37
38         dcp::order::Font B;
39         B._values["foo"] = "bar";
40         B._values["sheila"] = "baz";
41
42         A.take_intersection (B);
43         BOOST_REQUIRE_EQUAL (A._values.size(), 1);
44         BOOST_CHECK_EQUAL (A._values["foo"], "bar");
45
46         A._values.clear ();
47         B._values.clear ();
48
49         A._values["foo"] = "bar";
50         A._values["fred"] = "jim";
51
52         B._values["foo"] = "hello";
53         B._values["sheila"] = "baz";
54
55         A.take_intersection (B);
56         BOOST_CHECK_EQUAL (A._values.size(), 0);
57 }
58
59 /** Test dcp::order::Font::take_difference */
60 BOOST_AUTO_TEST_CASE (take_difference_test)
61 {
62         dcp::order::Font A;
63         A._values["foo"] = "bar";
64         A._values["fred"] = "jim";
65
66         dcp::order::Font B;
67         B._values["foo"] = "bar";
68         B._values["sheila"] = "baz";
69
70         A.take_difference (B);
71         BOOST_REQUIRE_EQUAL (A._values.size(), 1);
72         BOOST_CHECK_EQUAL (A._values["fred"], "jim");
73 }
74
75 /** Test dcp::order::Subtitle::pull_fonts */
76 BOOST_AUTO_TEST_CASE (pull_fonts_test1)
77 {
78         shared_ptr<dcp::order::Part> root (new dcp::order::Part (shared_ptr<dcp::order::Part> ()));
79         shared_ptr<dcp::order::Subtitle> sub1 (new dcp::order::Subtitle (root, dcp::Time(), dcp::Time(), dcp::Time(), dcp::Time()));
80         root->children.push_back (sub1);
81         shared_ptr<dcp::order::Text> text1 (new dcp::order::Text (sub1, dcp::HALIGN_CENTER, 0, dcp::VALIGN_TOP, 0, dcp::DIRECTION_LTR));
82         sub1->children.push_back (text1);
83         text1->font._values["font"] = "Inconsolata";
84         text1->font._values["size"] = "42";
85
86         dcp::SubtitleAsset::pull_fonts (root);
87
88         BOOST_REQUIRE_EQUAL (sub1->font._values.size(), 2);
89         BOOST_CHECK_EQUAL (sub1->font._values["font"], "Inconsolata");
90         BOOST_CHECK_EQUAL (sub1->font._values["size"], "42");
91         BOOST_CHECK_EQUAL (text1->font._values.size(), 0);
92 }
93
94 /** Test dcp::order::Subtitle::pull_fonts */
95 BOOST_AUTO_TEST_CASE (pull_fonts_test2)
96 {
97         shared_ptr<dcp::order::Part> root (new dcp::order::Part (shared_ptr<dcp::order::Part> ()));
98         shared_ptr<dcp::order::Subtitle> sub1 (new dcp::order::Subtitle (root, dcp::Time(), dcp::Time(), dcp::Time(), dcp::Time()));
99         root->children.push_back (sub1);
100         shared_ptr<dcp::order::Text> text1 (new dcp::order::Text (sub1, dcp::HALIGN_CENTER, 0, dcp::VALIGN_TOP, 0, dcp::DIRECTION_LTR));
101         sub1->children.push_back (text1);
102         text1->font._values["font"] = "Inconsolata";
103         text1->font._values["size"] = "42";
104         shared_ptr<dcp::order::Text> text2 (new dcp::order::Text (sub1, dcp::HALIGN_CENTER, 0, dcp::VALIGN_TOP, 0, dcp::DIRECTION_LTR));
105         sub1->children.push_back (text2);
106         text2->font._values["font"] = "Inconsolata";
107         text2->font._values["size"] = "48";
108
109         dcp::SubtitleAsset::pull_fonts (root);
110
111         BOOST_REQUIRE_EQUAL (sub1->font._values.size(), 1);
112         BOOST_CHECK_EQUAL (sub1->font._values["font"], "Inconsolata");
113         BOOST_REQUIRE_EQUAL (text1->font._values.size(), 1);
114         BOOST_CHECK_EQUAL (text1->font._values["size"], "42");
115         BOOST_REQUIRE_EQUAL (text2->font._values.size(), 1);
116         BOOST_CHECK_EQUAL (text2->font._values["size"], "48");
117 }
118
119 /** Test dcp::order::Subtitle::pull_fonts */
120 BOOST_AUTO_TEST_CASE (pull_fonts_test3)
121 {
122         shared_ptr<dcp::order::Part> root (new dcp::order::Part (shared_ptr<dcp::order::Part> ()));
123         shared_ptr<dcp::order::Subtitle> sub1 (new dcp::order::Subtitle (root, dcp::Time(), dcp::Time(), dcp::Time(), dcp::Time()));
124         root->children.push_back (sub1);
125         shared_ptr<dcp::order::Text> text1 (new dcp::order::Text (sub1, dcp::HALIGN_CENTER, 0, dcp::VALIGN_TOP, 0, dcp::DIRECTION_LTR));
126         sub1->children.push_back (text1);
127         dcp::order::Font font;
128         font._values["font"] = "Inconsolata";
129         font._values["size"] = "42";
130         shared_ptr<dcp::order::String> string1 (new dcp::order::String (text1, font, "Hello world"));
131         text1->children.push_back (string1);
132
133         dcp::SubtitleAsset::pull_fonts (root);
134
135         BOOST_REQUIRE_EQUAL (sub1->font._values.size(), 2);
136         BOOST_CHECK_EQUAL (sub1->font._values["font"], "Inconsolata");
137         BOOST_CHECK_EQUAL (sub1->font._values["size"], "42");
138 }
139
140 /** Write some subtitle content as Interop XML and check that it is right */
141 BOOST_AUTO_TEST_CASE (write_interop_subtitle_test)
142 {
143         dcp::InteropSubtitleAsset c;
144         c.set_reel_number ("1");
145         c.set_language ("EN");
146         c.set_movie_title ("Test");
147
148         c.add (
149                 shared_ptr<dcp::Subtitle> (
150                         new dcp::SubtitleString (
151                                 string ("Frutiger"),
152                                 false,
153                                 false,
154                                 false,
155                                 dcp::Colour (255, 255, 255),
156                                 48,
157                                 1.0,
158                                 dcp::Time (0, 4,  9, 22, 24),
159                                 dcp::Time (0, 4, 11, 22, 24),
160                                 0,
161                                 dcp::HALIGN_CENTER,
162                                 0.8,
163                                 dcp::VALIGN_TOP,
164                                 dcp::DIRECTION_LTR,
165                                 "Hello world",
166                                 dcp::NONE,
167                                 dcp::Colour (0, 0, 0),
168                                 dcp::Time (0, 0, 0, 0, 24),
169                                 dcp::Time (0, 0, 0, 0, 24)
170                                 )
171                         )
172                 );
173
174         c.add (
175                 shared_ptr<dcp::Subtitle> (
176                         new dcp::SubtitleString (
177                                 boost::optional<string> (),
178                                 true,
179                                 true,
180                                 true,
181                                 dcp::Colour (128, 0, 64),
182                                 91,
183                                 1.0,
184                                 dcp::Time (5, 41,  0, 21, 24),
185                                 dcp::Time (6, 12, 15, 21, 24),
186                                 0,
187                                 dcp::HALIGN_CENTER,
188                                 0.4,
189                                 dcp::VALIGN_BOTTOM,
190                                 dcp::DIRECTION_LTR,
191                                 "What's going on",
192                                 dcp::BORDER,
193                                 dcp::Colour (1, 2, 3),
194                                 dcp::Time (1, 2, 3, 4, 24),
195                                 dcp::Time (5, 6, 7, 8, 24)
196                                 )
197                         )
198                 );
199
200         c._id = "a6c58cff-3e1e-4b38-acec-a42224475ef6";
201
202         check_xml (
203                 "<DCSubtitle Version=\"1.0\">"
204                   "<SubtitleID>a6c58cff-3e1e-4b38-acec-a42224475ef6</SubtitleID>"
205                   "<MovieTitle>Test</MovieTitle>"
206                   "<ReelNumber>1</ReelNumber>"
207                   "<Language>EN</Language>"
208                   "<Font AspectAdjust=\"1.0\" Color=\"FFFFFFFF\" Effect=\"none\" EffectColor=\"FF000000\" Id=\"Frutiger\" Italic=\"no\" Script=\"normal\" Size=\"48\" Underlined=\"no\" Weight=\"normal\">"
209                     "<Subtitle SpotNumber=\"1\" TimeIn=\"00:04:09:229\" TimeOut=\"00:04:11:229\" FadeUpTime=\"0\" FadeDownTime=\"0\">"
210                       "<Text VAlign=\"top\" VPosition=\"80\">Hello world</Text>"
211                     "</Subtitle>"
212                   "</Font>"
213                   "<Font AspectAdjust=\"1.0\" Color=\"FF800040\" Effect=\"border\" EffectColor=\"FF010203\" Italic=\"yes\" Script=\"normal\" Size=\"91\" Underlined=\"yes\" Weight=\"bold\">"
214                     "<Subtitle SpotNumber=\"2\" TimeIn=\"05:41:00:219\" TimeOut=\"06:12:15:219\" FadeUpTime=\"930792\" FadeDownTime=\"4591834\">"
215                       "<Text VAlign=\"bottom\" VPosition=\"40\">What's going on</Text>"
216                     "</Subtitle>"
217                   "</Font>"
218                 "</DCSubtitle>",
219                 c.xml_as_string (),
220                 list<string> ()
221                 );
222 }
223
224 /** Write some subtitle content as Interop XML and check that it is right.
225  *  This test includes some horizontal alignment.
226  */
227 BOOST_AUTO_TEST_CASE (write_interop_subtitle_test2)
228 {
229         dcp::InteropSubtitleAsset c;
230         c.set_reel_number ("1");
231         c.set_language ("EN");
232         c.set_movie_title ("Test");
233
234         c.add (
235                 shared_ptr<dcp::Subtitle> (
236                         new dcp::SubtitleString (
237                                 string ("Frutiger"),
238                                 false,
239                                 false,
240                                 false,
241                                 dcp::Colour (255, 255, 255),
242                                 48,
243                                 1.0,
244                                 dcp::Time (0, 4,  9, 22, 24),
245                                 dcp::Time (0, 4, 11, 22, 24),
246                                 -0.2,
247                                 dcp::HALIGN_CENTER,
248                                 0.8,
249                                 dcp::VALIGN_TOP,
250                                 dcp::DIRECTION_LTR,
251                                 "Hello world",
252                                 dcp::NONE,
253                                 dcp::Colour (0, 0, 0),
254                                 dcp::Time (0, 0, 0, 0, 24),
255                                 dcp::Time (0, 0, 0, 0, 24)
256                                 )
257                         )
258                 );
259
260         c.add (
261                 shared_ptr<dcp::Subtitle> (
262                         new dcp::SubtitleString (
263                                 boost::optional<string> (),
264                                 true,
265                                 true,
266                                 true,
267                                 dcp::Colour (128, 0, 64),
268                                 91,
269                                 1.0,
270                                 dcp::Time (5, 41,  0, 21, 24),
271                                 dcp::Time (6, 12, 15, 21, 24),
272                                 -0.2,
273                                 dcp::HALIGN_CENTER,
274                                 0.4,
275                                 dcp::VALIGN_BOTTOM,
276                                 dcp::DIRECTION_LTR,
277                                 "What's going on",
278                                 dcp::BORDER,
279                                 dcp::Colour (1, 2, 3),
280                                 dcp::Time (1, 2, 3, 4, 24),
281                                 dcp::Time (5, 6, 7, 8, 24)
282                                 )
283                         )
284                 );
285
286         c._id = "a6c58cff-3e1e-4b38-acec-a42224475ef6";
287
288         check_xml (
289                 "<DCSubtitle Version=\"1.0\">"
290                   "<SubtitleID>a6c58cff-3e1e-4b38-acec-a42224475ef6</SubtitleID>"
291                   "<MovieTitle>Test</MovieTitle>"
292                   "<ReelNumber>1</ReelNumber>"
293                   "<Language>EN</Language>"
294                   "<Font AspectAdjust=\"1.0\" Color=\"FFFFFFFF\" Effect=\"none\" EffectColor=\"FF000000\" Id=\"Frutiger\" Italic=\"no\" Script=\"normal\" Size=\"48\" Underlined=\"no\" Weight=\"normal\">"
295                     "<Subtitle SpotNumber=\"1\" TimeIn=\"00:04:09:229\" TimeOut=\"00:04:11:229\" FadeUpTime=\"0\" FadeDownTime=\"0\">"
296                       "<Text HPosition=\"-20\" VAlign=\"top\" VPosition=\"80\">Hello world</Text>"
297                     "</Subtitle>"
298                   "</Font>"
299                   "<Font AspectAdjust=\"1.0\" Color=\"FF800040\" Effect=\"border\" EffectColor=\"FF010203\" Italic=\"yes\" Script=\"normal\" Size=\"91\" Underlined=\"yes\" Weight=\"bold\">"
300                     "<Subtitle SpotNumber=\"2\" TimeIn=\"05:41:00:219\" TimeOut=\"06:12:15:219\" FadeUpTime=\"930792\" FadeDownTime=\"4591834\">"
301                       "<Text HPosition=\"-20\" VAlign=\"bottom\" VPosition=\"40\">What's going on</Text>"
302                     "</Subtitle>"
303                   "</Font>"
304                 "</DCSubtitle>",
305                 c.xml_as_string (),
306                 list<string> ()
307                 );
308 }
309
310 /* Write some subtitle content as SMPTE XML and check that it is right */
311 BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test)
312 {
313         dcp::SMPTESubtitleAsset c;
314         c.set_reel_number (1);
315         c.set_language ("EN");
316         c.set_content_title_text ("Test");
317         c.set_issue_date (dcp::LocalTime ("2016-04-01T03:52:00+00:00"));
318
319         c.add (
320                 shared_ptr<dcp::Subtitle> (
321                         new dcp::SubtitleString (
322                                 string ("Frutiger"),
323                                 false,
324                                 false,
325                                 false,
326                                 dcp::Colour (255, 255, 255),
327                                 48,
328                                 1.0,
329                                 dcp::Time (0, 4,  9, 22, 24),
330                                 dcp::Time (0, 4, 11, 22, 24),
331                                 0,
332                                 dcp::HALIGN_CENTER,
333                                 0.8,
334                                 dcp::VALIGN_TOP,
335                                 dcp::DIRECTION_LTR,
336                                 "Hello world",
337                                 dcp::NONE,
338                                 dcp::Colour (0, 0, 0),
339                                 dcp::Time (0, 0, 0, 0, 24),
340                                 dcp::Time (0, 0, 0, 0, 24)
341                                 )
342                         )
343                 );
344
345         c.add (
346                 shared_ptr<dcp::Subtitle> (
347                         new dcp::SubtitleString (
348                                 boost::optional<string> (),
349                                 true,
350                                 true,
351                                 true,
352                                 dcp::Colour (128, 0, 64),
353                                 91,
354                                 1.0,
355                                 dcp::Time (5, 41,  0, 21, 24),
356                                 dcp::Time (6, 12, 15, 21, 24),
357                                 0,
358                                 dcp::HALIGN_CENTER,
359                                 0.4,
360                                 dcp::VALIGN_BOTTOM,
361                                 dcp::DIRECTION_RTL,
362                                 "What's going on",
363                                 dcp::BORDER,
364                                 dcp::Colour (1, 2, 3),
365                                 dcp::Time (1, 2, 3, 4, 24),
366                                 dcp::Time (5, 6, 7, 8, 24)
367                                 )
368                         )
369                 );
370
371         c._xml_id = "a6c58cff-3e1e-4b38-acec-a42224475ef6";
372
373         check_xml (
374                 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
375                 "<dcst:SubtitleReel xmlns:dcst=\"http://www.smpte-ra.org/schemas/428-7/2010/DCST\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
376                   "<dcst:Id>urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6</dcst:Id>"
377                   "<dcst:ContentTitleText>Test</dcst:ContentTitleText>"
378                   "<dcst:IssueDate>2016-04-01T03:52:00.000+00:00</dcst:IssueDate>"
379                   "<dcst:ReelNumber>1</dcst:ReelNumber>"
380                   "<dcst:Language>EN</dcst:Language>"
381                   "<dcst:EditRate>24 1</dcst:EditRate>"
382                   "<dcst:TimeCodeRate>24</dcst:TimeCodeRate>"
383                   "<dcst:SubtitleList>"
384                     "<dcst:Font AspectAdjust=\"1.0\" Color=\"FFFFFFFF\" Effect=\"none\" EffectColor=\"FF000000\" ID=\"Frutiger\" Italic=\"no\" Script=\"normal\" Size=\"48\" Underline=\"no\" Weight=\"normal\">"
385                       "<dcst:Subtitle SpotNumber=\"1\" TimeIn=\"00:04:09:22\" TimeOut=\"00:04:11:22\" FadeUpTime=\"00:00:00:00\" FadeDownTime=\"00:00:00:00\">"
386                         "<dcst:Text Valign=\"top\" Vposition=\"80\">Hello world</dcst:Text>"
387                       "</dcst:Subtitle>"
388                     "</dcst:Font>"
389                     "<dcst:Font AspectAdjust=\"1.0\" Color=\"FF800040\" Effect=\"border\" EffectColor=\"FF010203\" Italic=\"yes\" Script=\"normal\" Size=\"91\" Underline=\"yes\" Weight=\"bold\">"
390                       "<dcst:Subtitle SpotNumber=\"2\" TimeIn=\"05:41:00:21\" TimeOut=\"06:12:15:21\" FadeUpTime=\"01:02:03:04\" FadeDownTime=\"05:06:07:08\">"
391                         "<dcst:Text Valign=\"bottom\" Vposition=\"40\" Direction=\"rtl\">What's going on</dcst:Text>"
392                       "</dcst:Subtitle>"
393                     "</dcst:Font>"
394                   "</dcst:SubtitleList>"
395                 "</dcst:SubtitleReel>",
396                 c.xml_as_string (),
397                 list<string> ()
398                 );
399 }
400
401 /* Write some subtitle content as SMPTE XML and check that it is right.
402    This includes in-line font changes.
403 */
404 BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2)
405 {
406         dcp::SMPTESubtitleAsset c;
407         c.set_reel_number (1);
408         c.set_language ("EN");
409         c.set_content_title_text ("Test");
410         c.set_issue_date (dcp::LocalTime ("2016-04-01T03:52:00+00:00"));
411
412         c.add (
413                 shared_ptr<dcp::Subtitle> (
414                         new dcp::SubtitleString (
415                                 string ("Arial"),
416                                 false,
417                                 false,
418                                 false,
419                                 dcp::Colour (255, 255, 255),
420                                 48,
421                                 1.0,
422                                 dcp::Time (0, 0, 1, 0, 24),
423                                 dcp::Time (0, 0, 9, 0, 24),
424                                 0,
425                                 dcp::HALIGN_CENTER,
426                                 0.8,
427                                 dcp::VALIGN_TOP,
428                                 dcp::DIRECTION_LTR,
429                                 "Testing is ",
430                                 dcp::NONE,
431                                 dcp::Colour (0, 0, 0),
432                                 dcp::Time (0, 0, 0, 0, 24),
433                                 dcp::Time (0, 0, 0, 0, 24)
434                                 )
435                         )
436                 );
437
438         c.add (
439                 shared_ptr<dcp::Subtitle> (
440                         new dcp::SubtitleString (
441                                 string ("Arial"),
442                                 true,
443                                 false,
444                                 false,
445                                 dcp::Colour (255, 255, 255),
446                                 48,
447                                 1.0,
448                                 dcp::Time (0, 0, 1, 0, 24),
449                                 dcp::Time (0, 0, 9, 0, 24),
450                                 0,
451                                 dcp::HALIGN_CENTER,
452                                 0.8,
453                                 dcp::VALIGN_TOP,
454                                 dcp::DIRECTION_LTR,
455                                 "really",
456                                 dcp::NONE,
457                                 dcp::Colour (0, 0, 0),
458                                 dcp::Time (0, 0, 0, 0, 24),
459                                 dcp::Time (0, 0, 0, 0, 24)
460                                 )
461                         )
462                 );
463
464         c.add (
465                 shared_ptr<dcp::Subtitle> (
466                         new dcp::SubtitleString (
467                                 string ("Arial"),
468                                 false,
469                                 false,
470                                 false,
471                                 dcp::Colour (255, 255, 255),
472                                 48,
473                                 1.0,
474                                 dcp::Time (0, 0, 1, 0, 24),
475                                 dcp::Time (0, 0, 9, 0, 24),
476                                 0,
477                                 dcp::HALIGN_CENTER,
478                                 0.8,
479                                 dcp::VALIGN_TOP,
480                                 dcp::DIRECTION_LTR,
481                                 " fun",
482                                 dcp::NONE,
483                                 dcp::Colour (0, 0, 0),
484                                 dcp::Time (0, 0, 0, 0, 24),
485                                 dcp::Time (0, 0, 0, 0, 24)
486                                 )
487                         )
488                 );
489
490         c.add (
491                 shared_ptr<dcp::Subtitle> (
492                         new dcp::SubtitleString (
493                                 string ("Arial"),
494                                 false,
495                                 false,
496                                 false,
497                                 dcp::Colour (255, 255, 255),
498                                 48,
499                                 1.0,
500                                 dcp::Time (0, 0, 1, 0, 24),
501                                 dcp::Time (0, 0, 9, 0, 24),
502                                 0,
503                                 dcp::HALIGN_CENTER,
504                                 0.9,
505                                 dcp::VALIGN_TOP,
506                                 dcp::DIRECTION_LTR,
507                                 "This is the ",
508                                 dcp::NONE,
509                                 dcp::Colour (0, 0, 0),
510                                 dcp::Time (0, 0, 0, 0, 24),
511                                 dcp::Time (0, 0, 0, 0, 24)
512                                 )
513                         )
514                 );
515
516         c.add (
517                 shared_ptr<dcp::Subtitle> (
518                         new dcp::SubtitleString (
519                                 string ("Arial"),
520                                 true,
521                                 false,
522                                 false,
523                                 dcp::Colour (255, 255, 255),
524                                 48,
525                                 1.0,
526                                 dcp::Time (0, 0, 1, 0, 24),
527                                 dcp::Time (0, 0, 9, 0, 24),
528                                 0,
529                                 dcp::HALIGN_CENTER,
530                                 0.9,
531                                 dcp::VALIGN_TOP,
532                                 dcp::DIRECTION_LTR,
533                                 "second",
534                                 dcp::NONE,
535                                 dcp::Colour (0, 0, 0),
536                                 dcp::Time (0, 0, 0, 0, 24),
537                                 dcp::Time (0, 0, 0, 0, 24)
538                                 )
539                         )
540                 );
541
542         c.add (
543                 shared_ptr<dcp::Subtitle> (
544                         new dcp::SubtitleString (
545                                 string ("Arial"),
546                                 false,
547                                 false,
548                                 false,
549                                 dcp::Colour (255, 255, 255),
550                                 48,
551                                 1.0,
552                                 dcp::Time (0, 0, 1, 0, 24),
553                                 dcp::Time (0, 0, 9, 0, 24),
554                                 0,
555                                 dcp::HALIGN_CENTER,
556                                 0.9,
557                                 dcp::VALIGN_TOP,
558                                 dcp::DIRECTION_LTR,
559                                 " line",
560                                 dcp::NONE,
561                                 dcp::Colour (0, 0, 0),
562                                 dcp::Time (0, 0, 0, 0, 24),
563                                 dcp::Time (0, 0, 0, 0, 24)
564                                 )
565                         )
566                 );
567
568         c._xml_id = "a6c58cff-3e1e-4b38-acec-a42224475ef6";
569
570         check_xml (
571                 c.xml_as_string (),
572                 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
573                 "<dcst:SubtitleReel xmlns:dcst=\"http://www.smpte-ra.org/schemas/428-7/2010/DCST\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
574                   "<dcst:Id>urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6</dcst:Id>"
575                   "<dcst:ContentTitleText>Test</dcst:ContentTitleText>"
576                   "<dcst:IssueDate>2016-04-01T03:52:00.000+00:00</dcst:IssueDate>"
577                   "<dcst:ReelNumber>1</dcst:ReelNumber>"
578                   "<dcst:Language>EN</dcst:Language>"
579                   "<dcst:EditRate>24 1</dcst:EditRate>"
580                   "<dcst:TimeCodeRate>24</dcst:TimeCodeRate>"
581                   "<dcst:SubtitleList>"
582                     "<dcst:Font AspectAdjust=\"1.0\" Color=\"FFFFFFFF\" Effect=\"none\" EffectColor=\"FF000000\" ID=\"Arial\" Script=\"normal\" Size=\"48\" Underline=\"no\" Weight=\"normal\">"
583                       "<dcst:Subtitle SpotNumber=\"1\" TimeIn=\"00:00:01:00\" TimeOut=\"00:00:09:00\" FadeUpTime=\"00:00:00:00\" FadeDownTime=\"00:00:00:00\">"
584                         "<dcst:Text Valign=\"top\" Vposition=\"80\">"
585                           "<dcst:Font Italic=\"no\">Testing is </dcst:Font>"
586                           "<dcst:Font Italic=\"yes\">really</dcst:Font>"
587                           "<dcst:Font Italic=\"no\"> fun</dcst:Font>"
588                         "</dcst:Text>"
589                         "<dcst:Text Valign=\"top\" Vposition=\"90\">"
590                           "<dcst:Font Italic=\"no\">This is the </dcst:Font>"
591                           "<dcst:Font Italic=\"yes\">second</dcst:Font>"
592                           "<dcst:Font Italic=\"no\"> line</dcst:Font>"
593                         "</dcst:Text>"
594                       "</dcst:Subtitle>"
595                     "</dcst:Font>"
596                   "</dcst:SubtitleList>"
597                 "</dcst:SubtitleReel>",
598                 list<string> ()
599                 );
600 }