diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-02-01 15:59:20 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-02-03 01:32:02 +0100 |
| commit | a5e1a485a825a0967142fae98488fc79e345cb4a (patch) | |
| tree | 2090ae41469158ed73cbc5d52cf3c7be8aa2c9ed /test/dcp_subtitle_test.cc | |
| parent | 0ae77cead48b7d6e94b3913e40254826dfe43277 (diff) | |
Fix subtitles being written with negative times when trimmed (#2965).
Diffstat (limited to 'test/dcp_subtitle_test.cc')
| -rw-r--r-- | test/dcp_subtitle_test.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/dcp_subtitle_test.cc b/test/dcp_subtitle_test.cc index 32a1ff98a..df151e108 100644 --- a/test/dcp_subtitle_test.cc +++ b/test/dcp_subtitle_test.cc @@ -324,3 +324,31 @@ BOOST_AUTO_TEST_CASE(entity_from_dcp_source) BOOST_CHECK(max_X > 100); } + +BOOST_AUTO_TEST_CASE(dcp_subtitle_trim_test) +{ + auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub7.xml"); + auto film = new_test_film("dcp_subtitle_trim_start_test", { content }); + content->set_trim_start(film, dcpomatic::ContentTime::from_seconds(10.5)); + content->set_trim_end(dcpomatic::ContentTime::from_seconds(2.5)); + content->text[0]->set_language(dcp::LanguageTag("en")); + + make_and_verify_dcp( + film, + { + dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME, + dcp::VerificationNote::Code::MISSING_CPL_METADATA, + dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION, + }); + + dcp::SMPTETextAsset asset(find_file(film->dir(film->dcp_name()), "sub_")); + auto texts = asset.texts(); + BOOST_REQUIRE_EQUAL(texts.size(), 9U); + BOOST_CHECK(texts[0]->in() == dcp::Time(0, 0, 0, 0, 24)); + BOOST_CHECK(texts[0]->out() == dcp::Time(0, 0, 0, 12, 24)); + BOOST_CHECK(texts[8]->in() == dcp::Time(0, 0, 15, 12, 24)); + BOOST_CHECK(texts[8]->out() == dcp::Time(0, 0, 16, 0, 24)); +} + + + |
