summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-04-14 09:56:21 +0200
committerCarl Hetherington <cth@carlh.net>2021-04-16 22:49:35 +0200
commitb2ccdee3cff6ee0304c21a3e419c3210ef2061d1 (patch)
tree9f262509b4b4ca68330a43d0ed576682272b7e06 /test
parent3f6667d8597d40832f444d6909327b817f23785c (diff)
Improve handling of image subtitle IDs in XML (DoM bug #1965)backport
When reading/writing the XML for image subtitles, we assumed that the content of the <Image> tag is just the ID of the PNG in the MXF, without any prefix. DoM bug #1965 mentions a DCP where this is not the case, and SMPTE 429-5-2009 has an example where there is urn:uuid: in the XML. This change makes DoM write this urn:uuid: prefix, and accept it if it's present (but not complain if it's not). If the urn:uuid: _is_ required in the field, it's a bit surprising that nobody has complained up to this point. Maybe nobody noticed, or nobody reported it. Cherry-picked from 098007a1ee6a46b6ff11398f94faff5c85951da4 in master.
Diffstat (limited to 'test')
-rw-r--r--test/data/subs.mxfbin62859 -> 62928 bytes
-rw-r--r--test/smpte_subtitle_test.cc40
2 files changed, 23 insertions, 17 deletions
diff --git a/test/data/subs.mxf b/test/data/subs.mxf
index ec208dce..9e93251f 100644
--- a/test/data/subs.mxf
+++ b/test/data/subs.mxf
Binary files differ
diff --git a/test/smpte_subtitle_test.cc b/test/smpte_subtitle_test.cc
index b8232e9f..c75b205b 100644
--- a/test/smpte_subtitle_test.cc
+++ b/test/smpte_subtitle_test.cc
@@ -162,18 +162,6 @@ BOOST_AUTO_TEST_CASE (read_smpte_subtitle_test2)
}
-/** And another one featuring image subtitles */
-BOOST_AUTO_TEST_CASE (read_smpte_subtitle_test3)
-{
- dcp::SMPTESubtitleAsset subs ("test/data/subs.mxf");
-
- BOOST_REQUIRE_EQUAL (subs.subtitles().size(), 1);
- auto si = dynamic_pointer_cast<const dcp::SubtitleImage>(subs.subtitles().front());
- BOOST_REQUIRE (si);
- BOOST_CHECK (si->png_image() == dcp::Data("test/data/sub.png"));
-}
-
-
/* Write some subtitle content as SMPTE XML and check that it is right */
BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test)
{
@@ -473,11 +461,14 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test3)
c.set_reel_number (1);
c.set_language ("en");
c.set_content_title_text ("Test");
+ c.set_start_time (dcp::Time());
+
+ boost::filesystem::path const sub_image = "test/data/sub.png";
c.add (
shared_ptr<dcp::SubtitleImage>(
new dcp::SubtitleImage(
- dcp::Data ("test/data/sub.png"),
+ dcp::Data (sub_image),
dcp::Time (0, 4, 9, 22, 24),
dcp::Time (0, 4, 11, 22, 24),
0,
@@ -492,9 +483,24 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test3)
c._id = "a6c58cff-3e1e-4b38-acec-a42224475ef6";
- boost::filesystem::create_directories ("build/test/write_smpte_subtitle_test3");
- c.write ("build/test/write_smpte_subtitle_test3/subs.mxf");
-
- /* XXX: check this result when we can read them back in again */
+ boost::filesystem::path path = "build/test/write_smpte_subtitle_test3";
+ boost::filesystem::create_directories (path);
+ c.write (path / "subs.mxf");
+
+ dcp::SMPTESubtitleAsset read_back (path / "subs.mxf");
+ auto subs = read_back.subtitles ();
+ BOOST_REQUIRE_EQUAL (subs.size(), 1U);
+ auto image = dynamic_pointer_cast<const dcp::SubtitleImage>(subs.front());
+ BOOST_REQUIRE (image);
+
+ BOOST_CHECK (image->png_image() == dcp::Data(sub_image));
+ BOOST_CHECK (image->in() == dcp::Time(0, 4, 9, 22, 24));
+ BOOST_CHECK (image->out() == dcp::Time(0, 4, 11, 22, 24));
+ BOOST_CHECK_CLOSE (image->h_position(), 0.0, 1);
+ BOOST_CHECK (image->h_align() == dcp::HALIGN_CENTER);
+ BOOST_CHECK_CLOSE (image->v_position(), 0.8, 1);
+ BOOST_CHECK (image->v_align() == dcp::VALIGN_TOP);
+ BOOST_CHECK (image->fade_up_time() == dcp::Time(0, 0, 0, 0, 24));
+ BOOST_CHECK (image->fade_down_time() == dcp::Time(0, 0, 0, 0, 24));
}