Supporters update.
[dcpomatic.git] / test / film_metadata_test.cc
index 5c44c2a91377204e5a19e2da91dc8ddc131507ad..878e6025422208c851e530953c41dc090d7b1925 100644 (file)
@@ -63,6 +63,7 @@ BOOST_AUTO_TEST_CASE (film_metadata_test)
        film->set_distributor (string(""));
        film->set_facility (string(""));
        film->set_release_territory (dcp::LanguageTag::RegionSubtag("US"));
+       film->set_audio_channels(6);
        film->write_metadata ();
 
        list<string> ignore = { "Key", "ContextID", "LastWrittenBy" };
@@ -83,8 +84,8 @@ BOOST_AUTO_TEST_CASE (film_metadata_test)
 /** Check a bug where <Content> tags with multiple <Text>s would fail to load */
 BOOST_AUTO_TEST_CASE (multiple_text_nodes_are_allowed)
 {
-       auto subs = content_factory("test/data/15s.srt").front();
-       auto caps = content_factory("test/data/15s.srt").front();
+       auto subs = content_factory("test/data/15s.srt")[0];
+       auto caps = content_factory("test/data/15s.srt")[0];
        auto film = new_test_film2("multiple_text_nodes_are_allowed1", { subs, caps });
        caps->only_text()->set_type(TextType::CLOSED_CAPTION);
        make_and_verify_dcp (
@@ -210,3 +211,24 @@ BOOST_AUTO_TEST_CASE (metadata_video_range_guessed_for_png)
        BOOST_REQUIRE(film->content()[0]->video);
        BOOST_CHECK(film->content()[0]->video->range() == VideoRange::FULL);
 }
+
+
+/* Bug #2581 */
+BOOST_AUTO_TEST_CASE(effect_node_not_inserted_incorrectly)
+{
+       auto sub = content_factory("test/data/15s.srt");
+       auto film = new_test_film2("effect_node_not_inserted_incorrectly", sub);
+       film->write_metadata();
+
+       namespace fs = boost::filesystem;
+       auto film2 = make_shared<Film>(fs::path("build/test/effect_node_not_inserted_incorrectly"));
+       film2->read_metadata();
+       film2->write_metadata();
+
+       cxml::Document doc("Metadata");
+       doc.read_file("build/test/effect_node_not_inserted_incorrectly/metadata.xml");
+
+       /* There should be no <Effect> node in the text, since we don't want to force the effect to "none" */
+       BOOST_CHECK(!doc.node_child("Playlist")->node_child("Content")->node_child("Text")->optional_node_child("Effect"));
+}
+