From 85eebdf558ca89ce53bb59a0127f1c804e82981b Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 28 Jun 2024 17:46:42 +0200 Subject: wip --- test/data/create_open_caption_test.xml | 30 ++++++++++++++ test/open_caption_test.cc | 73 ++++++++++++++++++++++++++++++++++ test/wscript | 1 + 3 files changed, 104 insertions(+) create mode 100644 test/data/create_open_caption_test.xml create mode 100644 test/open_caption_test.cc (limited to 'test') diff --git a/test/data/create_open_caption_test.xml b/test/data/create_open_caption_test.xml new file mode 100644 index 00000000..37685d62 --- /dev/null +++ b/test/data/create_open_caption_test.xml @@ -0,0 +1,30 @@ + + + urn:uuid:d40b0977-d657-477b-897d-89a3fd858eaa + Foo + 2024-06-26T19:36:18+02:00 + libdcp + libdcp + Foo + feature + + urn:uuid:283534ca-79de-4bbd-9387-3bcec3b515d6 + urn:uuid:283534ca-79de-4bbd-9387-3bcec3b515d62024-06-26T19:36:18+02:00 + + + + + urn:uuid:f2a0d248-da4d-4570-a507-2a8fc053ee91 + + + urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6 + 24 1 + 480 + 0 + 480 + dPD3HYwXr6yr0+++d3x4pm/AIRM= + + + + + diff --git a/test/open_caption_test.cc b/test/open_caption_test.cc new file mode 100644 index 00000000..f0dce3f7 --- /dev/null +++ b/test/open_caption_test.cc @@ -0,0 +1,73 @@ +/* + Copyright (C) 2024 Carl Hetherington + + This file is part of libdcp. + + libdcp is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + libdcp is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with libdcp. If not, see . + + 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 "cpl.h" +#include "reel.h" +#include "reel_smpte_caption_asset.h" +#include "smpte_subtitle_asset.h" +#include "test.h" +#include + + +using std::make_shared; + + +BOOST_AUTO_TEST_CASE(create_open_caption_test) +{ + auto subs = make_shared("test/data/subs.mxf"); + auto reel_asset = make_shared(subs, dcp::Fraction{24, 1}, 480, 0, dcp::TextType::OPEN); + + auto reel = make_shared(); + reel->add(reel_asset); + + auto cpl = make_shared("Foo", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); + cpl->add(reel); + + auto dcp_dir = boost::filesystem::path("build/test/create_open_caption_test"); + boost::system::error_code ec; + boost::filesystem::remove_all(dcp_dir, ec); + boost::filesystem::create_directories(dcp_dir); + + cpl->write_xml("build/test/create_open_caption_test/cpl.xml", {}); + check_xml(dcp::file_to_string("test/data/create_open_caption_test.xml"), dcp::file_to_string("build/test/create_open_caption_test/cpl.xml"), {"Id", "IssueDate", "LabelText"}); + + /* XXX */ + + auto dcp = make_simple(dcp_dir, 1, 24 * 60 * 5, dcp::Standard::SMPTE, {}); + boost::filesystem::copy_file(*subs->file(), dcp_dir / "subs.mxf"); + subs->set_file(dcp_dir / "subs.mxf"); + dcp->cpls()[0]->reels()[0]->add(reel_asset); + dcp->write_xml(); +} + diff --git a/test/wscript b/test/wscript index 64b3ed59..ab552eb7 100644 --- a/test/wscript +++ b/test/wscript @@ -96,6 +96,7 @@ def build(bld): mca_test.cc mono_mpeg2_picture_read_test.cc mono_mpeg2_picture_write_test.cc + open_caption_test.cc kdm_test.cc key_test.cc language_tag_test.cc -- cgit v1.2.3