From 85bd14f4e7dcbfb2005969575788dbfb303bf846 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 8 Jul 2018 00:19:42 +0100 Subject: Basic interop bitmap writing. --- test/data/sub.png | Bin 0 -> 44935 bytes test/data/write_interop_subtitle_test3.xml | 2 ++ test/write_subtitle_test.cc | 41 ++++++++++++++++++++++++++++- 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 test/data/sub.png create mode 100644 test/data/write_interop_subtitle_test3.xml (limited to 'test') diff --git a/test/data/sub.png b/test/data/sub.png new file mode 100644 index 00000000..89b53cf2 Binary files /dev/null and b/test/data/sub.png differ diff --git a/test/data/write_interop_subtitle_test3.xml b/test/data/write_interop_subtitle_test3.xml new file mode 100644 index 00000000..e92685b8 --- /dev/null +++ b/test/data/write_interop_subtitle_test3.xml @@ -0,0 +1,2 @@ + +a6c58cff-3e1e-4b38-acec-a42224475ef6Test1ENsub_0.png diff --git a/test/write_subtitle_test.cc b/test/write_subtitle_test.cc index c8f8fc57..dec815c0 100644 --- a/test/write_subtitle_test.cc +++ b/test/write_subtitle_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2015-2016 Carl Hetherington + Copyright (C) 2015-2018 Carl Hetherington This file is part of libdcp. @@ -20,8 +20,10 @@ #include "interop_subtitle_asset.h" #include "smpte_subtitle_asset.h" #include "subtitle_string.h" +#include "subtitle_image.h" #include "subtitle_asset_internal.h" #include "test.h" +#include "util.h" #include using std::list; @@ -307,6 +309,43 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test2) ); } +/* Write some subtitle content as Interop XML using bitmaps and check that it is right */ +BOOST_AUTO_TEST_CASE (write_interop_subtitle_test3) +{ + dcp::InteropSubtitleAsset c; + c.set_reel_number ("1"); + c.set_language ("EN"); + c.set_movie_title ("Test"); + + c.add ( + shared_ptr ( + 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) + ) + ) + ); + + c._id = "a6c58cff-3e1e-4b38-acec-a42224475ef6"; + + boost::filesystem::create_directories ("build/test/write_interop_subtitle_test3"); + c.write ("build/test/write_interop_subtitle_test3/subs.xml"); + + check_xml ( + dcp::file_to_string("test/data/write_interop_subtitle_test3.xml"), + dcp::file_to_string("build/test/write_interop_subtitle_test3/subs.xml"), + list() + ); + check_file ("build/test/write_interop_subtitle_test3/sub_0.png", "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) { -- cgit v1.2.3