#include "lib/dcp_content.h"
#include "lib/film.h"
#include "lib/font.h"
+#include "lib/player.h"
#include "lib/text_content.h"
#include "lib/util.h"
#include <dcp/cpl.h>
auto text = content[0]->only_text();
BOOST_REQUIRE(text);
- /* There's the font from the DCP and also a dummy one with an empty ID */
- BOOST_REQUIRE_EQUAL(text->fonts().size(), 2U);
+ BOOST_REQUIRE_EQUAL(text->fonts().size(), 1U);
auto font = text->fonts().front();
BOOST_CHECK_EQUAL(font->id(), "0_theFontId");
BOOST_REQUIRE(font->data());
auto text = content[0]->only_text();
BOOST_REQUIRE(text);
- /* There's the font from the DCP and also a dummy one with an empty ID */
- BOOST_REQUIRE_EQUAL(text->fonts().size(), 2U);
+ BOOST_REQUIRE_EQUAL(text->fonts().size(), 1U);
auto font = text->fonts().front();
- BOOST_CHECK_EQUAL(font->id(), "theFontId");
+ BOOST_CHECK_EQUAL(font->id(), "0_theFontId");
BOOST_REQUIRE(font->data());
BOOST_CHECK_EQUAL(font->data()->size(), 367112);
}
auto subs = content_factory(TestPaths::private_data() / "clapperboard_with_subs.mkv");
auto film = new_test_film2("make_dcp_with_subs_from_mkv", subs);
subs[0]->text.front()->set_use(true);
- subs[0]->text.front()->set_language(dcp::LanguageTag("en-US"));
+ subs[0]->text.front()->set_language(dcp::LanguageTag("en"));
make_and_verify_dcp(film, { dcp::VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_2K });
}
auto subs = content_factory("test/data/no_font.xml");
auto film = new_test_film2("make_dcp_with_subs_without_font_tag", { subs });
subs[0]->text.front()->set_use(true);
+ subs[0]->text.front()->set_language(dcp::LanguageTag("de"));
make_and_verify_dcp(
film,
{
auto source_subs = content_factory("test/data/short.srt");
auto source = new_test_film2("make_dcp_with_subs_in_dcp_without_font_tag_source", { source_subs });
source->set_interop(true);
+ source_subs[0]->only_text()->set_language(dcp::LanguageTag("de"));
make_and_verify_dcp(
source,
{
make_and_verify_dcp(check_film);
}
+
+BOOST_AUTO_TEST_CASE(load_dcp_with_empty_font_id_test)
+{
+ auto dcp = std::make_shared<DCPContent>(TestPaths::private_data() / "kr_vf");
+ auto film = new_test_film2("load_dcp_with_empty_font_id_test", { dcp });
+}
+
+
+BOOST_AUTO_TEST_CASE(use_first_loadfont_as_default)
+{
+ auto dcp = std::make_shared<DCPContent>("test/data/use_default_font");
+ auto film = new_test_film2("use_first_loadfont_as_default", { dcp });
+ dcp->only_text()->set_use(true);
+ dcp->only_text()->set_language(dcp::LanguageTag("de"));
+ make_and_verify_dcp(
+ film,
+ { dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME }
+ );
+
+ dcp::DCP test(film->dir(film->dcp_name()));
+ test.read();
+ BOOST_REQUIRE(!test.cpls().empty());
+ auto cpl = test.cpls()[0];
+ BOOST_REQUIRE(!cpl->reels().empty());
+ auto reel = cpl->reels()[0];
+ BOOST_REQUIRE(reel->main_subtitle()->asset());
+ auto subtitle = std::dynamic_pointer_cast<dcp::SMPTESubtitleAsset>(reel->main_subtitle()->asset());
+ BOOST_REQUIRE_EQUAL(subtitle->font_data().size(), 1U);
+ BOOST_CHECK(subtitle->font_data().begin()->second == dcp::ArrayData("test/data/Inconsolata-VF.ttf"));
+}
+
+
+BOOST_AUTO_TEST_CASE(no_error_with_ccap_that_mentions_no_font)
+{
+ auto dcp = make_shared<DCPContent>("test/data/ccap_only");
+ auto film = new_test_film2("no_error_with_ccap_that_mentions_no_font", { dcp });
+ auto player = Player(film, film->playlist());
+ while (!player.pass()) {}
+}
+