summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-04-12 15:17:24 +0200
committerCarl Hetherington <cth@carlh.net>2025-04-12 22:34:36 +0200
commit87cd4af7a2171000bb190c274633f28cf35e2223 (patch)
treeb45cfaf36e83755d850eaaab3f9e18ebb1f2e486 /test
parent05adc13a5eef7c0fe165d062c0e40ad558a083d0 (diff)
Report zero- or negative-length subtitles as an error.v1.10.19
This is distinct from the Bv2.1 warning about subtitles being shorter than 15 frames. Also fix an assertion failure when negative-length subtitles are seen.
Diffstat (limited to 'test')
-rw-r--r--test/combine_test.cc2
-rw-r--r--test/verify_test.cc28
2 files changed, 27 insertions, 3 deletions
diff --git a/test/combine_test.cc b/test/combine_test.cc
index dc72d2d4..b26520f3 100644
--- a/test/combine_test.cc
+++ b/test/combine_test.cc
@@ -92,7 +92,7 @@ check_no_errors (boost::filesystem::path path)
std::copy_if (notes.begin(), notes.end(), std::back_inserter(filtered_notes), [](dcp::VerificationNote const& i) {
return i.type() != dcp::VerificationNote::Type::OK &&
i.code() != dcp::VerificationNote::Code::INVALID_STANDARD &&
- i.code() != dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION;
+ i.code() != dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION_BV21;
});
dump_notes (filtered_notes);
BOOST_CHECK (filtered_notes.empty());
diff --git a/test/verify_test.cc b/test/verify_test.cc
index 6c09cbe0..af3d135e 100644
--- a/test/verify_test.cc
+++ b/test/verify_test.cc
@@ -2783,9 +2783,33 @@ BOOST_AUTO_TEST_CASE (verify_valid_subtitle_spacing)
}
-BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_duration)
+BOOST_AUTO_TEST_CASE(verify_invalid_subtitle_duration)
{
auto const dir = path("build/test/verify_invalid_subtitle_duration");
+ auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset>(dcp::TextType::OPEN_SUBTITLE, dir, {{ 4 * 24, 4 * 24 - 1 }});
+ check_verify_result (
+ {dir},
+ {},
+ {
+ ok(dcp::VerificationNote::Code::NONE_ENCRYPTED, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_CPL_HASHES, cpl),
+ ok(dcp::VerificationNote::Code::VALID_CPL_ANNOTATION_TEXT, string{"hello"}, cpl),
+ ok(dcp::VerificationNote::Code::MATCHING_PKL_ANNOTATION_TEXT_WITH_CPL, cpl),
+ ok(dcp::VerificationNote::Code::VALID_CONTENT_KIND, string{"trailer"}, cpl),
+ ok(dcp::VerificationNote::Code::VALID_CONTENT_VERSION_LABEL_TEXT, cpl->content_version()->label_text, cpl),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION
+ ).set_cpl_id(cpl->id()),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_CPL_METADATA, cpl->file().get()
+ ).set_cpl_id(cpl->id())
+ });
+}
+
+
+BOOST_AUTO_TEST_CASE(verify_invalid_subtitle_duration_bv21)
+{
+ auto const dir = path("build/test/verify_invalid_subtitle_duration_bv21");
auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset>(dcp::TextType::OPEN_SUBTITLE, dir, {{ 4 * 24, 4 * 24 + 1 }});
check_verify_result (
{dir},
@@ -2798,7 +2822,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_duration)
ok(dcp::VerificationNote::Code::VALID_CONTENT_KIND, string{"trailer"}, cpl),
ok(dcp::VerificationNote::Code::VALID_CONTENT_VERSION_LABEL_TEXT, cpl->content_version()->label_text, cpl),
dcp::VerificationNote(
- dcp::VerificationNote::Type::WARNING, dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION
+ dcp::VerificationNote::Type::WARNING, dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION_BV21
).set_cpl_id(cpl->id()),
dcp::VerificationNote(
dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_CPL_METADATA, cpl->file().get()