diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-03-23 00:50:11 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-03-31 22:48:53 +0200 |
| commit | e0a70cd5cfb11fc2de167f3146acdd437a6faa82 (patch) | |
| tree | 022ceef78d7daa12bccf519ebab0db5e23a3feb6 /test | |
| parent | 8640da877450479a85c73b2a921897d83b478c84 (diff) | |
Put subtitle language back into content from the film (#1930).
This also adds the main/additional language flag.
Of all the considerations about how to specify subtitle language,
the most important seems to be that the language specification happens
for the content where the language is; i.e. in the content text tab.
Diffstat (limited to 'test')
| -rw-r--r-- | test/isdcf_name_test.cc | 2 | ||||
| -rw-r--r-- | test/subtitle_language_test.cc | 19 | ||||
| -rw-r--r-- | test/subtitle_metadata_test.cc | 33 |
3 files changed, 17 insertions, 37 deletions
diff --git a/test/isdcf_name_test.cc b/test/isdcf_name_test.cc index dad2ba7d9..59d8ec1b0 100644 --- a/test/isdcf_name_test.cc +++ b/test/isdcf_name_test.cc @@ -74,10 +74,10 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test) film->_isdcf_date = boost::gregorian::date (2014, boost::gregorian::Jul, 4); film->set_audio_channels (1); film->set_resolution (Resolution::FOUR_K); - film->set_subtitle_language (dcp::LanguageTag("fr-FR")); shared_ptr<Content> text = content_factory("test/data/subrip.srt").front(); BOOST_REQUIRE_EQUAL (text->text.size(), 1U); text->text.front()->set_burn (true); + text->text.front()->set_language (dcp::LanguageTag("fr-FR")); film->examine_and_add_content (text); BOOST_REQUIRE (!wait_for_jobs()); m.content_version = 2; diff --git a/test/subtitle_language_test.cc b/test/subtitle_language_test.cc index f0f2ad162..af5dee001 100644 --- a/test/subtitle_language_test.cc +++ b/test/subtitle_language_test.cc @@ -18,13 +18,16 @@ */ + /** @file test/subtitle_language_test.cc * @brief Test that subtitle language information is correctly written to DCPs. */ +#include "lib/content.h" #include "lib/content_factory.h" #include "lib/film.h" +#include "lib/text_content.h" #include "test.h" #include <dcp/language_tag.h> #include <boost/test/unit_test.hpp> @@ -39,12 +42,10 @@ using std::shared_ptr; BOOST_AUTO_TEST_CASE (subtitle_language_interop_test) { string const name = "subtitle_language_interop_test"; - auto film = new_test_film2 (name, { content_factory("test/data/frames.srt").front() }); + auto fr = content_factory("test/data/frames.srt").front(); + auto film = new_test_film2 (name, { fr }); - vector<dcp::LanguageTag> langs = { - dcp::LanguageTag("fr-FR"), dcp::LanguageTag("de-DE") - }; - film->set_subtitle_languages(langs); + fr->only_text()->set_language (dcp::LanguageTag("fr-FR")); film->set_interop (true); make_and_verify_dcp ( @@ -62,12 +63,10 @@ BOOST_AUTO_TEST_CASE (subtitle_language_interop_test) BOOST_AUTO_TEST_CASE (subtitle_language_smpte_test) { string const name = "subtitle_language_smpte_test"; - auto film = new_test_film2 (name, { content_factory("test/data/frames.srt").front() }); + auto fr = content_factory("test/data/frames.srt").front(); + auto film = new_test_film2 (name, { fr }); - vector<dcp::LanguageTag> langs = { - dcp::LanguageTag("fr-FR"), dcp::LanguageTag("de-DE") - }; - film->set_subtitle_languages (langs); + fr->only_text()->set_language (dcp::LanguageTag("fr-FR")); film->set_interop (false); make_and_verify_dcp ( diff --git a/test/subtitle_metadata_test.cc b/test/subtitle_metadata_test.cc index 6eaa77100..91372d2a5 100644 --- a/test/subtitle_metadata_test.cc +++ b/test/subtitle_metadata_test.cc @@ -30,46 +30,27 @@ #include <boost/test/unit_test.hpp> -using std::vector; +using std::make_shared; using std::shared_ptr; +using std::vector; BOOST_AUTO_TEST_CASE (subtitle_metadata_test1) { using namespace boost::filesystem; - path p = test_film_dir ("subtitle_metadata_test1"); + auto p = test_film_dir ("subtitle_metadata_test1"); if (exists (p)) { remove_all (p); } create_directory (p); copy_file ("test/data/subtitle_metadata1.xml", p / "metadata.xml"); - shared_ptr<Film> film(new Film(p)); - film->read_metadata(); - - vector<dcp::LanguageTag> langs = film->subtitle_languages (); - BOOST_REQUIRE (!langs.empty()); - BOOST_CHECK_EQUAL (langs.front().to_string(), "de-DE"); -} - - -BOOST_AUTO_TEST_CASE (subtitle_metadata_test2) -{ - using namespace boost::filesystem; - - path p = test_film_dir ("subtitle_metadata_test2"); - if (exists (p)) { - remove_all (p); - } - create_directory (p); - - copy_file ("test/data/subtitle_metadata2.xml", p / "metadata.xml"); - shared_ptr<Film> film(new Film(p)); + auto film = make_shared<Film>(p); film->read_metadata(); - vector<dcp::LanguageTag> langs = film->subtitle_languages (); - BOOST_REQUIRE (!langs.empty()); - BOOST_CHECK_EQUAL (langs.front().to_string(), "FR"); + auto langs = film->subtitle_languages (); + BOOST_REQUIRE (langs.first); + BOOST_CHECK_EQUAL (langs.first->to_string(), "de-DE"); } |
