+
+
+/** Test that writing the XML for a DCP with no CPLs throws */
+BOOST_AUTO_TEST_CASE (dcp_with_no_cpls)
+{
+ dcp::DCP dcp ("build/test/dcp_with_no_cpls");
+ BOOST_REQUIRE_THROW (dcp.write_xml(), dcp::MiscError);
+}
+
+
+/** Test that writing the XML for a DCP with Interop CPLs makes a SMPTE assetmap */
+BOOST_AUTO_TEST_CASE (dcp_with_interop_cpls)
+{
+ boost::filesystem::path path = "build/test/dcp_with_interop_cpls";
+ boost::filesystem::remove_all (path);
+ dcp::DCP dcp (path);
+ auto cpl1 = make_shared<dcp::CPL>("", dcp::ContentKind::FEATURE, dcp::Standard::INTEROP);
+ cpl1->add(make_shared<dcp::Reel>());
+ dcp.add(cpl1);
+ auto cpl2 = make_shared<dcp::CPL>("", dcp::ContentKind::FEATURE, dcp::Standard::INTEROP);
+ cpl2->add(make_shared<dcp::Reel>());
+ dcp.add(cpl2);
+ dcp.write_xml ();
+ BOOST_REQUIRE (boost::filesystem::exists(path / "ASSETMAP"));
+ BOOST_REQUIRE (!boost::filesystem::exists(path / "ASSETMAP.xml"));
+}
+
+
+/** Test that writing the XML for a DCP with SMPTE CPLs makes a SMPTE assetmap */
+BOOST_AUTO_TEST_CASE (dcp_with_smpte_cpls)
+{
+ boost::filesystem::path path = "build/test/dcp_with_smpte_cpls";
+ boost::filesystem::remove_all (path);
+ dcp::DCP dcp (path);
+ auto cpl1 = make_shared<dcp::CPL>("", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE);
+ cpl1->add(make_shared<dcp::Reel>());
+ dcp.add(cpl1);
+ auto cpl2 = make_shared<dcp::CPL>("", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE);
+ cpl2->add(make_shared<dcp::Reel>());
+ dcp.add(cpl2);
+ dcp.write_xml ();
+ BOOST_REQUIRE (!boost::filesystem::exists(path / "ASSETMAP"));
+ BOOST_REQUIRE (boost::filesystem::exists(path / "ASSETMAP.xml"));
+}
+
+
+/** Test that writing the XML for a DCP with mixed-standard CPLs throws */
+BOOST_AUTO_TEST_CASE (dcp_with_mixed_cpls)
+{
+ dcp::DCP dcp ("build/test/dcp_with_mixed_cpls");
+ dcp.add(make_shared<dcp::CPL>("", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE));
+ dcp.add(make_shared<dcp::CPL>("", dcp::ContentKind::FEATURE, dcp::Standard::INTEROP));
+ dcp.add(make_shared<dcp::CPL>("", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE));
+ BOOST_REQUIRE_THROW (dcp.write_xml(), dcp::MiscError);
+}