X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=test%2Fhints_test.cc;h=a989d3aeb5b0e6c74c23340f1341af6e5c07c1aa;hb=3160c7051b0edb06acc9333016bbf8ade4a467e1;hp=daf12d1bcd388eb181fbae5c71fe9e9a306843e4;hpb=380ca8671269dcd1fb31c519b7a41f428792846f;p=dcpomatic.git diff --git a/test/hints_test.cc b/test/hints_test.cc index daf12d1bc..a989d3aeb 100644 --- a/test/hints_test.cc +++ b/test/hints_test.cc @@ -21,6 +21,7 @@ #include "lib/audio_content.h" #include "lib/config.h" +#include "lib/constants.h" #include "lib/content.h" #include "lib/content_factory.h" #include "lib/cross.h" @@ -28,7 +29,6 @@ #include "lib/font.h" #include "lib/hints.h" #include "lib/text_content.h" -#include "lib/util.h" #include "test.h" #include @@ -73,7 +73,7 @@ void check (TextType type, string name, optional expected_hint = optional()) { auto film = new_test_film2 (name); - auto content = content_factory("test/data/" + name + ".srt").front(); + auto content = content_factory("test/data/" + name + ".srt")[0]; content->text.front()->set_type (type); content->text.front()->set_language (dcp::LanguageTag("en-US")); film->examine_and_add_content (content); @@ -84,7 +84,11 @@ check (TextType type, string name, optional expected_hint = optionaltext.front()->set_type (TextType::OPEN_SUBTITLE); - content->text.front()->set_language (dcp::LanguageTag("en-US")); - for (int i = 1; i < 512; ++i) { - auto font = make_shared(String::compose("font_%1", i)); - font->set_file ("test/data/LiberationSans-Regular.ttf"); - content->text.front()->add_font(font); + + for (int i = 0; i < 4; ++i) { + dcp::File fake_font("build/test/hint_subtitle_mxf_too_big.ttf", "w"); + for (int i = 0; i < 512; ++i) { + std::vector rubbish(65536); + fake_font.write(rubbish.data(), 1, rubbish.size()); + } + fake_font.close(); + + auto content = content_factory(String::compose("test/data/%1%2.xml", name, i))[0]; + content->text[0]->set_type(TextType::OPEN_SUBTITLE); + content->text[0]->set_language(dcp::LanguageTag("en-US")); + film->examine_and_add_content(content); + BOOST_REQUIRE (!wait_for_jobs()); + auto const font = content->text[0]->get_font(String::compose("font_%1", i)); + font->set_file("build/test/hint_subtitle_mxf_too_big.ttf"); } - film->examine_and_add_content (content); - BOOST_REQUIRE (!wait_for_jobs()); + auto hints = get_hints (film); BOOST_REQUIRE_EQUAL (hints.size(), 1U); @@ -212,7 +230,7 @@ BOOST_AUTO_TEST_CASE (hint_closed_caption_xml_too_big) } ccap.close(); - auto content = content_factory("build/test/" + name + ".srt").front(); + auto content = content_factory("build/test/" + name + ".srt")[0]; content->text.front()->set_type (TextType::CLOSED_CAPTION); content->text.front()->set_language (dcp::LanguageTag("en-US")); film->examine_and_add_content (content); @@ -231,7 +249,7 @@ BOOST_AUTO_TEST_CASE (hint_closed_caption_xml_too_big) BOOST_AUTO_TEST_CASE (hints_destroyed_while_running) { auto film = new_test_film2 ("hints_destroyed_while_running"); - auto content = content_factory(TestPaths::private_data() / "boon_telly.mkv").front(); + auto content = content_factory(TestPaths::private_data() / "boon_telly.mkv")[0]; film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs()); @@ -245,7 +263,7 @@ BOOST_AUTO_TEST_CASE (hints_destroyed_while_running) BOOST_AUTO_TEST_CASE (hints_audio_with_no_language) { - auto content = content_factory("test/data/sine_440.wav").front(); + auto content = content_factory("test/data/sine_440.wav")[0]; auto film = new_test_film2 ("hints_audio_with_no_language", { content }); content->audio->set_gain (-6); @@ -272,7 +290,7 @@ BOOST_AUTO_TEST_CASE (hints_certificate_validity) hints[0], "The certificate chain that DCP-o-matic uses for signing DCPs and KDMs has a validity period " "that is too long. This will cause problems playing back DCPs on some systems. " - "You are advised to re-create the signing certificate chain by clicking the " + "It is advisable to re-create the signing certificate chain by clicking the " "\"Re-make certificates and key...\" button in the Keys page of Preferences." ); }