It's now safe to get _video_container_size without the lock.
[dcpomatic.git] / test / hints_test.cc
index bc858192dc6f33876a82adc61603d81677727c5c..ce7e87b9c90e323947010cbe58dbd92ce3e4ea6d 100644 (file)
@@ -63,6 +63,7 @@ get_hints (shared_ptr<Film> film)
        hints.start ();
        hints.join ();
        while (signal_manager->ui_idle()) {}
+       hints.rethrow();
        return current_hints;
 }
 
@@ -72,7 +73,7 @@ void
 check (TextType type, string name, optional<string> expected_hint = optional<string>())
 {
        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);
@@ -172,17 +173,20 @@ BOOST_AUTO_TEST_CASE (hint_subtitle_mxf_too_big)
 {
        string const name = "hint_subtitle_mxf_too_big";
 
+       dcp::File fake_font("build/test/hint_subtitle_mxf_too_big.ttf", "w");
+       for (int i = 0; i < 4096; ++i) {
+               std::vector<uint8_t> rubbish(65536);
+               fake_font.write(rubbish.data(), 1, rubbish.size());
+       }
+       fake_font.close();
+
        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 (TextType::OPEN_SUBTITLE);
        content->text.front()->set_language (dcp::LanguageTag("en-US"));
-       for (int i = 1; i < 512; ++i) {
-               auto font = make_shared<dcpomatic::Font>(String::compose("font_%1", i));
-               font->set_file ("test/data/LiberationSans-Regular.ttf");
-               content->text.front()->add_font(font);
-       }
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs());
+       content->text.front()->get_font("")->set_file("build/test/hint_subtitle_mxf_too_big.ttf");
        auto hints = get_hints (film);
 
        BOOST_REQUIRE_EQUAL (hints.size(), 1U);
@@ -211,7 +215,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);
@@ -230,7 +234,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());
 
@@ -244,7 +248,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);