+
+ cc = run ("dcpomatic2_create --channel L fred.wav --channel R jim.wav sheila.wav");
+ BOOST_REQUIRE_EQUAL (cc.content.size(), 3U);
+ BOOST_CHECK_EQUAL (cc.content[0].path, "fred.wav");
+ BOOST_CHECK (cc.content[0].channel);
+ BOOST_CHECK (*cc.content[0].channel == dcp::Channel::LEFT);
+ BOOST_CHECK_EQUAL (cc.content[1].path, "jim.wav");
+ BOOST_CHECK (cc.content[1].channel);
+ BOOST_CHECK (*cc.content[1].channel == dcp::Channel::RIGHT);
+ BOOST_CHECK_EQUAL (cc.content[2].path, "sheila.wav");
+ BOOST_CHECK (!cc.content[2].channel);
+
+ cc = run ("dcpomatic2_create --channel foo fred.wav");
+ BOOST_REQUIRE (cc.error);
+ BOOST_CHECK (boost::algorithm::starts_with(*cc.error, "dcpomatic2_create: foo is not valid for --channel"));
+
+ cc = run ("dcpomatic2_create fred.wav --gain -6 jim.wav --gain 2 sheila.wav");
+ BOOST_REQUIRE_EQUAL (cc.content.size(), 3U);
+ BOOST_CHECK_EQUAL (cc.content[0].path, "fred.wav");
+ BOOST_CHECK (!cc.content[0].gain);
+ BOOST_CHECK_EQUAL (cc.content[1].path, "jim.wav");
+ BOOST_CHECK_CLOSE (*cc.content[1].gain, -6, 0.001);
+ BOOST_CHECK_EQUAL (cc.content[2].path, "sheila.wav");
+ BOOST_CHECK_CLOSE (*cc.content[2].gain, 2, 0.001);
+
+ cc = run("dcpomatic2_create --cpl 123456-789-0 dcp");
+ BOOST_REQUIRE_EQUAL(cc.content.size(), 1U);
+ BOOST_CHECK_EQUAL(cc.content[0].path, "dcp");
+ BOOST_REQUIRE(static_cast<bool>(cc.content[0].cpl));
+ BOOST_CHECK_EQUAL(*cc.content[0].cpl, "123456-789-0");
+
+ cc = run("dcpomatic2_create -s SMPTE sheila.wav");
+ BOOST_CHECK(!cc.still_length);
+ BOOST_CHECK(cc.error);
+}
+
+
+BOOST_AUTO_TEST_CASE(create_cli_template_test)
+{
+ ConfigRestorer cr;
+
+ Config::override_path = "test/data";
+
+ auto cc = run("dcpomatic2_create test/data/flat_red.png");
+ auto film = cc.make_film();
+ BOOST_CHECK(!film->three_d());
+
+ cc = run("dcpomatic2_create test/data/flat_red.png --template 2d");
+ film = cc.make_film();
+ BOOST_CHECK(!film->three_d());
+
+ cc = run("dcpomatic2_create test/data/flat_red.png --template 2d --threed");
+ film = cc.make_film();
+ BOOST_CHECK(film->three_d());
+
+ cc = run("dcpomatic2_create test/data/flat_red.png --template 3d");
+ film = cc.make_film();
+ BOOST_CHECK(film->three_d());
+
+ cc = run("dcpomatic2_create test/data/flat_red.png --template 3d --twod");
+ film = cc.make_film();
+ BOOST_CHECK(!film->three_d());
+
+ cc = run("dcpomatic2_create test/data/flat_red.png");
+ film = cc.make_film();
+ BOOST_CHECK(!film->encrypted());
+
+ cc = run("dcpomatic2_create test/data/flat_red.png --template unencrypted");
+ film = cc.make_film();
+ BOOST_CHECK(!film->encrypted());
+
+ cc = run("dcpomatic2_create test/data/flat_red.png --template unencrypted --encrypt");
+ film = cc.make_film();
+ BOOST_CHECK(film->encrypted());
+
+ cc = run("dcpomatic2_create test/data/flat_red.png --template encrypted");
+ film = cc.make_film();
+ BOOST_CHECK(film->encrypted());
+
+ cc = run("dcpomatic2_create test/data/flat_red.png --template encrypted --no-encrypt");
+ film = cc.make_film();
+ BOOST_CHECK(!film->encrypted());
+
+ cc = run("dcpomatic2_create test/data/flat_red.png");
+ film = cc.make_film();
+ BOOST_CHECK(!film->interop());
+
+ cc = run("dcpomatic2_create test/data/flat_red.png --template interop");
+ film = cc.make_film();
+ BOOST_CHECK(film->interop());
+
+ cc = run("dcpomatic2_create test/data/flat_red.png --template interop --standard SMPTE");
+ film = cc.make_film();
+ BOOST_CHECK(!film->interop());
+
+ cc = run("dcpomatic2_create test/data/flat_red.png --template smpte");
+ film = cc.make_film();
+ BOOST_CHECK(!film->interop());
+
+ cc = run("dcpomatic2_create test/data/flat_red.png --template smpte --standard interop");
+ film = cc.make_film();
+ BOOST_CHECK(film->interop());