summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
m---------test/data0
-rw-r--r--test/reels_test.cc1
-rw-r--r--test/subtitle_font_id_change_test.cc33
-rw-r--r--test/subtitle_font_id_test.cc92
-rw-r--r--test/wscript1
5 files changed, 127 insertions, 0 deletions
diff --git a/test/data b/test/data
-Subproject 375fe9911e941ccbb6c5d8c4a96be62af079214
+Subproject 6d4d01a10bc14f3a4a0db5c3e0a4be72176543b
diff --git a/test/reels_test.cc b/test/reels_test.cc
index 10fdc6c1b..5bee4a819 100644
--- a/test/reels_test.cc
+++ b/test/reels_test.cc
@@ -240,6 +240,7 @@ BOOST_AUTO_TEST_CASE (reels_test4)
BOOST_AUTO_TEST_CASE (reels_test5)
{
auto dcp = make_shared<DCPContent>("test/data/reels_test4");
+ dcp->check_font_ids();
auto film = new_test_film2 ("reels_test5", {dcp});
film->set_sequence (false);
diff --git a/test/subtitle_font_id_change_test.cc b/test/subtitle_font_id_change_test.cc
index 32cf57400..f32541980 100644
--- a/test/subtitle_font_id_change_test.cc
+++ b/test/subtitle_font_id_change_test.cc
@@ -84,6 +84,7 @@ BOOST_AUTO_TEST_CASE(subtitle_font_id_change_test1)
CheckContentJob check(film);
check.run();
+ BOOST_REQUIRE (!wait_for_jobs());
make_and_verify_dcp(film, { dcp::VerificationNote::Code::INVALID_STANDARD });
}
@@ -105,9 +106,14 @@ BOOST_AUTO_TEST_CASE(subtitle_font_id_change_test2)
BOOST_REQUIRE_EQUAL(content[0]->text.size(), 1U);
content[0]->set_paths({"test/data/short.srt"});
+ /* Make sure the content doesn't look like it's changed, otherwise it will be re-examined
+ * which obscures the point of this test.
+ */
+ content[0]->_last_write_times[0] = boost::filesystem::last_write_time("test/data/short.srt");
CheckContentJob check(film);
check.run();
+ BOOST_REQUIRE (!wait_for_jobs());
auto font = content[0]->text.front()->get_font("");
BOOST_REQUIRE(font->file());
@@ -136,6 +142,7 @@ BOOST_AUTO_TEST_CASE(subtitle_font_id_change_test3)
CheckContentJob check(film);
check.run();
+ BOOST_REQUIRE (!wait_for_jobs());
auto font = content[0]->text.front()->get_font("Arial Black");
BOOST_REQUIRE(font->file());
@@ -147,3 +154,29 @@ BOOST_AUTO_TEST_CASE(subtitle_font_id_change_test3)
make_and_verify_dcp(film, { dcp::VerificationNote::Code::INVALID_STANDARD });
}
+
+
+BOOST_AUTO_TEST_CASE(subtitle_font_id_change_test4)
+{
+ auto film = new_test_film2("subtitle_font_id_change_test4");
+ boost::filesystem::remove(film->file("metadata.xml"));
+ boost::filesystem::copy_file("test/data/subtitle_font_id_change_test4.xml", film->file("metadata.xml"));
+
+ {
+ Editor editor(film->file("metadata.xml"));
+ editor.replace("dcpomatic-test-private", TestPaths::private_data().string());
+ }
+
+ film->read_metadata();
+
+ auto content = film->content();
+ BOOST_REQUIRE_EQUAL(content.size(), 1U);
+ BOOST_REQUIRE_EQUAL(content[0]->text.size(), 1U);
+
+ CheckContentJob check(film);
+ check.run();
+ BOOST_REQUIRE(!wait_for_jobs());
+
+ make_and_verify_dcp(film, { dcp::VerificationNote::Code::INVALID_STANDARD });
+}
+
diff --git a/test/subtitle_font_id_test.cc b/test/subtitle_font_id_test.cc
new file mode 100644
index 000000000..41bc3a923
--- /dev/null
+++ b/test/subtitle_font_id_test.cc
@@ -0,0 +1,92 @@
+/*
+ Copyright (C) 2022 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic 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.
+
+ DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include "lib/content_factory.h"
+#include "lib/dcp_content.h"
+#include "lib/film.h"
+#include "lib/font.h"
+#include "lib/text_content.h"
+#include "test.h"
+#include <boost/test/unit_test.hpp>
+
+
+using std::make_shared;
+
+
+BOOST_AUTO_TEST_CASE(full_dcp_subtitle_font_id_test)
+{
+ auto dcp = make_shared<DCPContent>(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV");
+ auto film = new_test_film2("full_dcp_subtitle_font_id_test", { dcp });
+
+ auto content = film->content();
+ BOOST_REQUIRE_EQUAL(content.size(), 1U);
+ auto text = content[0]->only_text();
+ BOOST_REQUIRE(text);
+
+ BOOST_REQUIRE_EQUAL(text->fonts().size(), 1U);
+ auto font = text->fonts().front();
+ BOOST_CHECK_EQUAL(font->id(), "0_theFontId");
+ BOOST_REQUIRE(font->data());
+ BOOST_CHECK_EQUAL(font->data()->size(), 367112);
+}
+
+
+BOOST_AUTO_TEST_CASE(dcp_subtitle_font_id_test)
+{
+ auto subs = content_factory(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV" / "8b48f6ae-c74b-4b80-b994-a8236bbbad74_sub.mxf").front();
+ auto film = new_test_film2("dcp_subtitle_font_id_test", { subs });
+
+ auto content = film->content();
+ BOOST_REQUIRE_EQUAL(content.size(), 1U);
+ auto text = content[0]->only_text();
+ BOOST_REQUIRE(text);
+
+ BOOST_REQUIRE_EQUAL(text->fonts().size(), 1U);
+ auto font = text->fonts().front();
+ BOOST_CHECK_EQUAL(font->id(), "theFontId");
+ BOOST_REQUIRE(font->data());
+ BOOST_CHECK_EQUAL(font->data()->size(), 367112);
+}
+
+
+BOOST_AUTO_TEST_CASE(make_dcp_with_subs_from_interop_dcp)
+{
+ auto dcp = make_shared<DCPContent>("test/data/Iopsubs_FTR-1_F_XX-XX_MOS_2K_20220710_IOP_OV");
+ auto film = new_test_film2("make_dcp_with_subs_from_interop_dcp", { dcp });
+ dcp->text.front()->set_use(true);
+ make_and_verify_dcp(
+ film,
+ {
+ dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME
+ }
+ );
+}
+
+
+BOOST_AUTO_TEST_CASE(make_dcp_with_subs_from_smpte_dcp)
+{
+ auto dcp = make_shared<DCPContent>(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV");
+ auto film = new_test_film2("make_dcp_with_subs_from_smpte_dcp", { dcp });
+ dcp->text.front()->set_use(true);
+ make_and_verify_dcp(film);
+}
+
diff --git a/test/wscript b/test/wscript
index b7dc1669f..0bcecad0c 100644
--- a/test/wscript
+++ b/test/wscript
@@ -135,6 +135,7 @@ def build(bld):
ssa_subtitle_test.cc
stream_test.cc
subtitle_charset_test.cc
+ subtitle_font_id_test.cc
subtitle_font_id_change_test.cc
subtitle_language_test.cc
subtitle_metadata_test.cc