diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/data/subtitles_with_vZani.xml | 61 | ||||
| -rw-r--r-- | test/data/subtitles_with_vZani_parsed.xml | 59 | ||||
| -rw-r--r-- | test/decryption_test.cc | 2 | ||||
| -rw-r--r-- | test/interop_subtitle_test.cc | 31 | ||||
| -rw-r--r-- | test/load_variable_z_test.cc | 10 | ||||
| -rw-r--r-- | test/shared_subtitle_test.cc | 8 | ||||
| -rw-r--r-- | test/smpte_subtitle_test.cc | 25 | ||||
| -rw-r--r-- | test/test.cc | 1 | ||||
| -rw-r--r-- | test/verify_test.cc | 6 |
9 files changed, 195 insertions, 8 deletions
diff --git a/test/data/subtitles_with_vZani.xml b/test/data/subtitles_with_vZani.xml new file mode 100644 index 00000000..32f08c6a --- /dev/null +++ b/test/data/subtitles_with_vZani.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<SubtitleReel xmlns="http://www.smpte-ra.org/schemas/428-7/2014/DCST" xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <Id>urn:uuid:6382e2f3-8d75-441a-8324-4d0713549056</Id> + <ContentTitleText>Stereoscopic Subtitles: timeline01</ContentTitleText> + <AnnotationText>3D subs made with Davinci</AnnotationText> + <IssueDate>2025-01-28T20:47:47.904-00:00</IssueDate> + <ReelNumber>1</ReelNumber> + <Language>en</Language> + <EditRate>24 1</EditRate> + <TimeCodeRate>24</TimeCodeRate> + <StartTime>00:00:00:00</StartTime> + <DisplayType>MainSubtitle</DisplayType> + <LoadFont ID="MyFont">urn:uuid:d621dedd-089d-4d1f-8c24-fb976e1439df</LoadFont> + <SubtitleList> + <Font ID="MyFont" Color="FFFFFFFF" Weight="normal" Size="45"> + <Subtitle SpotNumber="1" TimeIn="00:00:10:00" TimeOut="00:00:15:00"> + <Text Valign="bottom" Vposition="20.00" Zposition="0.0">subtitle - position 0 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="2" TimeIn="00:00:15:00" TimeOut="00:00:20:00"> + <Text Valign="bottom" Vposition="20.00" Zposition="-0.5">subtitle - position -0.5 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="3" TimeIn="00:00:20:00" TimeOut="00:00:25:00"> + <Text Valign="bottom" Vposition="20.00" Zposition="-1">subtitle - position -1 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="4" TimeIn="00:00:25:00" TimeOut="00:00:30:00"> + <Text Valign="bottom" Vposition="20.00" Zposition="-1.5">subtitle - position -1.5 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="5" TimeIn="00:00:30:00" TimeOut="00:00:35:00"> + <Text Valign="bottom" Vposition="20.00" Zposition="-2.0">subtitle - position -2 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="6" TimeIn="00:00:35:00" TimeOut="00:00:40:00"> + <Text Valign="bottom" Vposition="20.00" Zposition="0.0">subtitle - position 0 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="7" TimeIn="00:00:40:00" TimeOut="00:00:45:00"> + <Text Valign="bottom" Vposition="20.00" Zposition="0.5">subtitle - position 0.5 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="8" TimeIn="00:00:45:00" TimeOut="00:00:50:00"> + <Text Valign="bottom" Vposition="20.00" Zposition="1.0">subtitle - position 1 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="9" TimeIn="00:00:50:00" TimeOut="00:00:55:00"> + <Text Valign="bottom" Vposition="20.00" Zposition="1.5">subtitle - position 1.5 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="10" TimeIn="00:00:55:00" TimeOut="00:01:00:00"> + <Text Valign="bottom" Vposition="20.00" Zposition="2.0">subtitle - position 2 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="11" TimeIn="00:01:05:00" TimeOut="00:01:20:00"> + <LoadVariableZ ID="Zvector1">-2.0:120 0.0:120 2.0:120</LoadVariableZ> + <Text Valign="bottom" Vposition="10.00" Zposition="-2.0" VariableZ="Zvector1">animation -2 to 0 to 2</Text> + </Subtitle> + <Subtitle SpotNumber="12" TimeIn="00:01:24:00" TimeOut="00:01:39:00"> + <LoadVariableZ ID="Zvector2">0.0:120 2.0:120 -2.0:120</LoadVariableZ> + <Text Valign="bottom" Vposition="10.00" Zposition="0.0" VariableZ="Zvector2">animation 0 to 2 to - 2</Text> + </Subtitle> + <Subtitle SpotNumber="13" TimeIn="00:01:42:13" TimeOut="00:01:57:13"> + <LoadVariableZ ID="Zvector3">2.0:180 0.0:180</LoadVariableZ> + <Text Valign="bottom" Vposition="10.00" Zposition="2.0" VariableZ="Zvector3">animation 2 to 0</Text> + </Subtitle> + </Font> + </SubtitleList> +</SubtitleReel>
\ No newline at end of file diff --git a/test/data/subtitles_with_vZani_parsed.xml b/test/data/subtitles_with_vZani_parsed.xml new file mode 100644 index 00000000..7c9c797d --- /dev/null +++ b/test/data/subtitles_with_vZani_parsed.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<SubtitleReel xmlns="http://www.smpte-ra.org/schemas/428-7/2014/DCST"> + <Id>urn:uuid:6382e2f3-8d75-441a-8324-4d0713549056</Id> + <ContentTitleText>Stereoscopic Subtitles: timeline01</ContentTitleText> + <AnnotationText>3D subs made with Davinci</AnnotationText> + <IssueDate>2025-01-28T20:47:47</IssueDate> + <ReelNumber>1</ReelNumber> + <Language>en</Language> + <EditRate>24 1</EditRate> + <TimeCodeRate>24</TimeCodeRate> + <StartTime>00:00:00:00</StartTime> + <LoadFont ID="MyFont">urn:uuid:d621dedd-089d-4d1f-8c24-fb976e1439df</LoadFont> + <SubtitleList> + <Font AspectAdjust="1.0" Color="FFFFFFFF" Effect="none" EffectColor="FF000000" ID="MyFont" Italic="no" Script="normal" Size="45" Underline="no" Weight="normal"> + <Subtitle SpotNumber="1" TimeIn="00:00:10:00" TimeOut="00:00:15:00" FadeUpTime="00:00:00:02" FadeDownTime="00:00:00:02"> + <Text Valign="bottom" Vposition="20">subtitle - position 0 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="2" TimeIn="00:00:15:00" TimeOut="00:00:20:00" FadeUpTime="00:00:00:02" FadeDownTime="00:00:00:02"> + <Text Valign="bottom" Vposition="20" Zposition="-0.5">subtitle - position -0.5 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="3" TimeIn="00:00:20:00" TimeOut="00:00:25:00" FadeUpTime="00:00:00:02" FadeDownTime="00:00:00:02"> + <Text Valign="bottom" Vposition="20" Zposition="-1">subtitle - position -1 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="4" TimeIn="00:00:25:00" TimeOut="00:00:30:00" FadeUpTime="00:00:00:02" FadeDownTime="00:00:00:02"> + <Text Valign="bottom" Vposition="20" Zposition="-1.5">subtitle - position -1.5 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="5" TimeIn="00:00:30:00" TimeOut="00:00:35:00" FadeUpTime="00:00:00:02" FadeDownTime="00:00:00:02"> + <Text Valign="bottom" Vposition="20" Zposition="-2">subtitle - position -2 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="6" TimeIn="00:00:35:00" TimeOut="00:00:40:00" FadeUpTime="00:00:00:02" FadeDownTime="00:00:00:02"> + <Text Valign="bottom" Vposition="20">subtitle - position 0 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="7" TimeIn="00:00:40:00" TimeOut="00:00:45:00" FadeUpTime="00:00:00:02" FadeDownTime="00:00:00:02"> + <Text Valign="bottom" Vposition="20" Zposition="0.5">subtitle - position 0.5 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="8" TimeIn="00:00:45:00" TimeOut="00:00:50:00" FadeUpTime="00:00:00:02" FadeDownTime="00:00:00:02"> + <Text Valign="bottom" Vposition="20" Zposition="1">subtitle - position 1 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="9" TimeIn="00:00:50:00" TimeOut="00:00:55:00" FadeUpTime="00:00:00:02" FadeDownTime="00:00:00:02"> + <Text Valign="bottom" Vposition="20" Zposition="1.5">subtitle - position 1.5 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="10" TimeIn="00:00:55:00" TimeOut="00:01:00:00" FadeUpTime="00:00:00:02" FadeDownTime="00:00:00:02"> + <Text Valign="bottom" Vposition="20" Zposition="2">subtitle - position 2 - subtitle</Text> + </Subtitle> + <Subtitle SpotNumber="11" TimeIn="00:01:05:00" TimeOut="00:01:20:00" FadeUpTime="00:00:00:02" FadeDownTime="00:00:00:02"> + <LoadVariableZ ID="Zvector1">-2.0:120 0.0:120 2.0:120</LoadVariableZ> + <Text Valign="bottom" Vposition="10" Zposition="-2" VariableZ="Zvector1">animation -2 to 0 to 2</Text> + </Subtitle> + <Subtitle SpotNumber="12" TimeIn="00:01:24:00" TimeOut="00:01:39:00" FadeUpTime="00:00:00:02" FadeDownTime="00:00:00:02"> + <LoadVariableZ ID="Zvector2">0.0:120 2.0:120 -2.0:120</LoadVariableZ> + <Text Valign="bottom" Vposition="10" VariableZ="Zvector2">animation 0 to 2 to - 2</Text> + </Subtitle> + <Subtitle SpotNumber="13" TimeIn="00:01:42:13" TimeOut="00:01:57:13" FadeUpTime="00:00:00:02" FadeDownTime="00:00:00:02"> + <LoadVariableZ ID="Zvector3">2.0:180 0.0:180</LoadVariableZ> + <Text Valign="bottom" Vposition="10" Zposition="2" VariableZ="Zvector3">animation 2 to 0</Text> + </Subtitle> + </Font> + </SubtitleList> +</SubtitleReel> diff --git a/test/decryption_test.cc b/test/decryption_test.cc index 3bb62d21..2b34cd25 100644 --- a/test/decryption_test.cc +++ b/test/decryption_test.cc @@ -191,7 +191,7 @@ BOOST_AUTO_TEST_CASE (decryption_test2) dcp::Time(0, 0, 5, 0, 24), 0.5, dcp::HAlign::CENTER, 0.5, dcp::VAlign::CENTER, - 0, + 0, vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "Hello world", dcp::Effect::NONE, diff --git a/test/interop_subtitle_test.cc b/test/interop_subtitle_test.cc index 2d7f4a43..27dcaf23 100644 --- a/test/interop_subtitle_test.cc +++ b/test/interop_subtitle_test.cc @@ -46,6 +46,7 @@ using std::dynamic_pointer_cast; using std::shared_ptr; using std::string; using std::vector; +using boost::optional; /** Load some subtitle content from Interop XML and check that it is read correctly */ @@ -83,6 +84,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) 0.15, dcp::VAlign::BOTTOM, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "My jacket was ", dcp::Effect::BORDER, @@ -108,6 +110,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) 0.15, dcp::VAlign::BOTTOM, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "Idi Amin's", dcp::Effect::BORDER, @@ -136,6 +139,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) 0.21, dcp::VAlign::BOTTOM, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "My corset was H.M. The Queen's", dcp::Effect::BORDER, @@ -161,6 +165,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) 0.15, dcp::VAlign::BOTTOM, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "My large wonderbra", dcp::Effect::BORDER, @@ -189,6 +194,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) 0.15, dcp::VAlign::BOTTOM, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "Once belonged to the Shah", dcp::Effect::BORDER, @@ -217,6 +223,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) 0.15, dcp::VAlign::BOTTOM, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "And these are Roy Hattersley's jeans", dcp::Effect::BORDER, @@ -251,6 +258,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) 0.89, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "At afternoon tea with John Peel", dcp::Effect::BORDER, @@ -276,6 +284,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) 0.95, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "I enquired if his accent was real", dcp::Effect::BORDER, @@ -304,6 +313,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) 0.89, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "He said \"out of the house", dcp::Effect::BORDER, @@ -329,6 +339,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) 0.95, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "I'm incredibly scouse", dcp::Effect::BORDER, @@ -357,6 +368,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) 0.89, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "At home it depends how I feel.\"", dcp::Effect::BORDER, @@ -382,6 +394,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) 0.95, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "I spent a long weekend in Brighton", dcp::Effect::BORDER, @@ -410,6 +423,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) 0.89, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::RTL, "With the legendary Miss Enid Blyton", dcp::Effect::BORDER, @@ -435,6 +449,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) 0.95, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::TTB, "She said \"you be Noddy", dcp::Effect::BORDER, @@ -463,6 +478,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) 0.89, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::BTT, "That curious creature the Sphinx", dcp::Effect::BORDER, @@ -488,6 +504,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) 0.95, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "Is smarter than anyone thinks", dcp::Effect::BORDER, @@ -516,6 +533,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) 0.89, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "It sits there and smirks", dcp::Effect::BORDER, @@ -541,6 +559,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) 0.95, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "And you don't think it works", dcp::Effect::BORDER, @@ -569,6 +588,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) 0.89, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "Then when you're not looking, it winks.", dcp::Effect::BORDER, @@ -594,6 +614,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) 0.95, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "When it snows you will find Sister Sledge", dcp::Effect::BORDER, @@ -622,6 +643,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) 0.89, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "Out mooning, at night, on the ledge", dcp::Effect::BORDER, @@ -647,6 +669,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) 0.95, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "One storey down", dcp::Effect::BORDER, @@ -675,6 +698,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) 0.89, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "HELLO", dcp::Effect::BORDER, @@ -700,6 +724,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) 0.95, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "WORLD", dcp::Effect::BORDER, @@ -747,6 +772,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test) 0.8, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "Hello world", dcp::Effect::NONE, @@ -774,6 +800,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test) 0.4, dcp::VAlign::BOTTOM, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "What's going ", dcp::Effect::BORDER, @@ -801,6 +828,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test) 0.4, dcp::VAlign::BOTTOM, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "on", dcp::Effect::BORDER, @@ -862,6 +890,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test2) 0.8, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "Hello world", dcp::Effect::NONE, @@ -889,6 +918,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test2) 0.4, dcp::VAlign::BOTTOM, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "What's going on", dcp::Effect::BORDER, @@ -944,6 +974,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test3) 0.8, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Time (0, 0, 0, 0, 24), dcp::Time (0, 0, 0, 0, 24) ) diff --git a/test/load_variable_z_test.cc b/test/load_variable_z_test.cc index 8448480f..07c45a57 100644 --- a/test/load_variable_z_test.cc +++ b/test/load_variable_z_test.cc @@ -33,6 +33,7 @@ #include "load_variable_z.h" +#include "smpte_text_asset.h" #include "warnings.h" #include "compose.hpp" LIBDCP_DISABLE_WARNINGS @@ -89,3 +90,12 @@ BOOST_AUTO_TEST_CASE(variable_z_test) made.set_positions({{-0.6, 2}, {4.2, 9}, {5, 1}}); BOOST_CHECK_EQUAL(xml(made), "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<LoadVariableZ ID=\"baz\">-0.6:2 4.2:9 5.0</LoadVariableZ>\n"); } + + +BOOST_AUTO_TEST_CASE(variable_z_pass_through) +{ + dcp::SMPTETextAsset asset("test/data/subtitles_with_vZani.xml"); + BOOST_CHECK_EQUAL(asset.xml_as_string(), dcp::file_to_string("test/data/subtitles_with_vZani_parsed.xml")); +} + + diff --git a/test/shared_subtitle_test.cc b/test/shared_subtitle_test.cc index 82595cd0..1a7ba853 100644 --- a/test/shared_subtitle_test.cc +++ b/test/shared_subtitle_test.cc @@ -108,7 +108,7 @@ BOOST_AUTO_TEST_CASE (pull_fonts_test1) 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); - auto text1 = make_shared<dcp::order::Text>(sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, 0, dcp::Direction::LTR, std::vector<dcp::Ruby>()); + auto text1 = make_shared<dcp::order::Text>(sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, 0, optional<string>(), dcp::Direction::LTR, std::vector<dcp::Ruby>()); sub1->children.push_back (text1); text1->font._values["font"] = "Inconsolata"; text1->font._values["size"] = "42"; @@ -127,11 +127,11 @@ BOOST_AUTO_TEST_CASE (pull_fonts_test2) 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); - auto text1 = make_shared<dcp::order::Text>(sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, 0, dcp::Direction::LTR, std::vector<dcp::Ruby>()); + auto text1 = make_shared<dcp::order::Text>(sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, 0, optional<string>(), dcp::Direction::LTR, std::vector<dcp::Ruby>()); sub1->children.push_back (text1); text1->font._values["font"] = "Inconsolata"; text1->font._values["size"] = "42"; - auto text2 = make_shared<dcp::order::Text>(sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, 0, dcp::Direction::LTR, std::vector<dcp::Ruby>()); + auto text2 = make_shared<dcp::order::Text>(sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, 0, optional<string>(), dcp::Direction::LTR, std::vector<dcp::Ruby>()); sub1->children.push_back (text2); text2->font._values["font"] = "Inconsolata"; text2->font._values["size"] = "48"; @@ -152,7 +152,7 @@ BOOST_AUTO_TEST_CASE (pull_fonts_test3) 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); - auto text1 = make_shared<dcp::order::Text>(sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, 0, dcp::Direction::LTR, std::vector<dcp::Ruby>()); + auto text1 = make_shared<dcp::order::Text>(sub1, dcp::HAlign::CENTER, 0, dcp::VAlign::TOP, 0, 0, optional<string>(), dcp::Direction::LTR, std::vector<dcp::Ruby>()); sub1->children.push_back (text1); dcp::order::Font font; font._values["font"] = "Inconsolata"; diff --git a/test/smpte_subtitle_test.cc b/test/smpte_subtitle_test.cc index e1dabc44..5aa6bea6 100644 --- a/test/smpte_subtitle_test.cc +++ b/test/smpte_subtitle_test.cc @@ -66,6 +66,7 @@ BOOST_AUTO_TEST_CASE (smpte_subtitle_id_test) 0.5, dcp::VAlign::CENTER, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "Hello", dcp::Effect::NONE, @@ -196,6 +197,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test) 0.8, dcp::VAlign::TOP, 0.3, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "Hello world", dcp::Effect::NONE, @@ -223,6 +225,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test) 0.4, dcp::VAlign::BOTTOM, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::RTL, "What's going ", dcp::Effect::BORDER, @@ -250,6 +253,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test) 0.4, dcp::VAlign::BOTTOM, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::RTL, "on", dcp::Effect::BORDER, @@ -318,6 +322,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2) 0.8, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "Testing is ", dcp::Effect::NONE, @@ -345,6 +350,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2) 0.8, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "really", dcp::Effect::NONE, @@ -372,6 +378,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2) 0.8, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, " fun", dcp::Effect::NONE, @@ -399,6 +406,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2) 0.9, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "This is the ", dcp::Effect::NONE, @@ -426,6 +434,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2) 0.9, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "second", dcp::Effect::NONE, @@ -453,6 +462,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2) 0.9, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, " line", dcp::Effect::NONE, @@ -511,6 +521,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test3) 0.8, dcp::VAlign::TOP, -88, + vector<dcp::Text::VariableZPosition>(), dcp::Time (0, 0, 0, 0, 24), dcp::Time (0, 0, 0, 0, 24) ) @@ -568,6 +579,7 @@ BOOST_AUTO_TEST_CASE (write_subtitles_in_vertical_order_with_top_alignment) 0.8, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "Top line", dcp::Effect::NONE, @@ -595,6 +607,7 @@ BOOST_AUTO_TEST_CASE (write_subtitles_in_vertical_order_with_top_alignment) 0.9, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "Bottom line", dcp::Effect::NONE, @@ -658,6 +671,7 @@ BOOST_AUTO_TEST_CASE (write_subtitles_in_vertical_order_with_bottom_alignment) 0.8, dcp::VAlign::BOTTOM, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "Top line", dcp::Effect::NONE, @@ -685,6 +699,7 @@ BOOST_AUTO_TEST_CASE (write_subtitles_in_vertical_order_with_bottom_alignment) 0.7, dcp::VAlign::BOTTOM, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "Bottom line", dcp::Effect::NONE, @@ -782,3 +797,13 @@ BOOST_AUTO_TEST_CASE(smpte_subtitle_intrinsic_duration_read_correctly) BOOST_CHECK_EQUAL(check.intrinsic_duration(), duration); } + + +BOOST_AUTO_TEST_CASE(pass_through_smpte_subtitle_with_variable_z) +{ + auto source = "test/data/subtitles_with_vZani.xml"; + dcp::SMPTETextAsset test("test/data/subtitles_with_vZani.xml"); + /* _parsed is a version of the source with some changes made by libdcp that are OK */ + check_xml(dcp::file_to_string("test/data/subtitles_with_vZani_parsed.xml"), test.xml_as_string(), { "IssueDate" }, true); +} + diff --git a/test/test.cc b/test/test.cc index 0de9c73c..42619683 100644 --- a/test/test.cc +++ b/test/test.cc @@ -410,6 +410,7 @@ simple_text() 0.8, dcp::VAlign::TOP, 0, + vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "Hello world", dcp::Effect::NONE, diff --git a/test/verify_test.cc b/test/verify_test.cc index 3352b472..6c09cbe0 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -2092,7 +2092,7 @@ add_test_subtitle (shared_ptr<dcp::TextAsset> asset, int start_frame, int end_fr dcp::HAlign::CENTER, v_position, v_align, - 0, + 0, vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, text, dcp::Effect::NONE, @@ -5896,7 +5896,7 @@ BOOST_AUTO_TEST_CASE(overlapping_subtitles) dcp::Time(0, 0, 8, 0, 24), 0, dcp::HAlign::CENTER, 0, dcp::VAlign::CENTER, - 0, + 0, vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "", dcp::Effect::NONE, dcp::Colour{}, dcp::Time{}, dcp::Time{}, 0, vector<dcp::Ruby>{} @@ -5909,7 +5909,7 @@ BOOST_AUTO_TEST_CASE(overlapping_subtitles) dcp::Time(0, 0, 4, 0, 24), 0, dcp::HAlign::CENTER, 0, dcp::VAlign::CENTER, - 0, + 0, vector<dcp::Text::VariableZPosition>(), dcp::Direction::LTR, "Hello", dcp::Effect::NONE, dcp::Colour{}, dcp::Time{}, dcp::Time{}, 0, vector<dcp::Ruby>{} |
