summaryrefslogtreecommitdiff
path: root/test/vf_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-10-14 21:48:25 +0200
committerCarl Hetherington <cth@carlh.net>2023-10-15 09:10:18 +0200
commit3c802dd6d1451c2c8a7e188f8379738d72e907eb (patch)
tree454396cf5451535b8708a0c4961c7d5c2b30ea1f /test/vf_test.cc
parent1bfe44b1503fb0f5cffda135076709014337de52 (diff)
Fix DCP content font ID allocation to cope with DCPs that have multiple fonts
with the same name in the same reel (#2600). Previously we had this id_for_font_in_reel() which would give an ID of N_font-ID. This means we got duplicate font IDs. Here we replace that method with FontAllocator, which gives an ID of N_font-ID for the first font and M_font-ID, where M is a number higher than the highest reel index. The idea is to support the required new IDs without breaking exisiting projects. There is some documentation of how it works in doc/design/fonts
Diffstat (limited to 'test/vf_test.cc')
-rw-r--r--test/vf_test.cc47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/vf_test.cc b/test/vf_test.cc
index ecd615d98..249f9c5b0 100644
--- a/test/vf_test.cc
+++ b/test/vf_test.cc
@@ -28,8 +28,11 @@
#include "lib/content_factory.h"
#include "lib/dcp_content.h"
#include "lib/dcp_content_type.h"
+#include "lib/examine_content_job.h"
#include "lib/ffmpeg_content.h"
#include "lib/film.h"
+#include "lib/job_manager.h"
+#include "lib/make_dcp.h"
#include "lib/player.h"
#include "lib/text_content.h"
#include "lib/referenced_reel_asset.h"
@@ -423,3 +426,47 @@ BOOST_AUTO_TEST_CASE(test_referencing_ov_with_subs_when_adding_ccaps)
std::cout << why_not << "\n";
}
+
+BOOST_AUTO_TEST_CASE(test_duplicate_font_id_in_vf)
+{
+ string const name("test_duplicate_font_id_in_vf");
+ auto subs = content_factory("test/data/15s.srt");
+ auto ov = new_test_film2(name + "_ov", subs);
+ make_and_verify_dcp(
+ ov,
+ {
+ dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+ dcp::VerificationNote::Code::MISSING_CPL_METADATA
+ });
+
+ auto ccaps = content_factory("test/data/15s.srt")[0];
+ auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name(false)));
+ auto vf = new_test_film2(name + "_vf", { ov_dcp, ccaps });
+ ov_dcp->set_reference_audio(true);
+ ov_dcp->set_reference_video(true);
+ ov_dcp->text[0]->set_use(true);
+ ccaps->text[0]->set_type(TextType::CLOSED_CAPTION);
+ string why_not;
+ BOOST_CHECK_MESSAGE(ov_dcp->can_reference_text(vf, TextType::OPEN_SUBTITLE, why_not), why_not);
+ ov_dcp->set_reference_text(TextType::OPEN_SUBTITLE, true);
+ vf->write_metadata();
+ make_dcp(vf, TranscodeJob::ChangedBehaviour::IGNORE);
+ BOOST_REQUIRE(!wait_for_jobs());
+
+ auto vf_dcp = make_shared<DCPContent>(vf->dir(vf->dcp_name(false)));
+
+ auto test = new_test_film2(name + "_test", { vf_dcp });
+ vf_dcp->add_ov(ov->dir(ov->dcp_name(false)));
+ JobManager::instance()->add(make_shared<ExamineContentJob>(test, vf_dcp));
+ BOOST_CHECK(!wait_for_jobs());
+
+ make_and_verify_dcp(
+ test,
+ {
+ dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+ dcp::VerificationNote::Code::MISSING_CPL_METADATA,
+ });
+}
+