Add --twod option to create CLI and stop 2D from being forced over
[dcpomatic.git] / test / create_cli_test.cc
index 253f3cadd05dbc1ebb81cb0f07887304668bdf59..8da07d5d5d9402637edbbb965752855a79d9acf4 100644 (file)
 
 */
 
+
+#include "lib/config.h"
 #include "lib/create_cli.h"
+#include "lib/film.h"
 #include "lib/ratio.h"
 #include "lib/dcp_content_type.h"
 #include "test.h"
 #include <boost/algorithm/string/predicate.hpp>
 #include <iostream>
 
+
 using std::string;
 
+
 static CreateCLI
 run (string cmd)
 {
@@ -106,6 +111,15 @@ BOOST_AUTO_TEST_CASE (create_cli_test)
        cc = run ("dcpomatic2_create x --standard SMPTEX");
        BOOST_CHECK (cc.error);
 
+       cc = run("dcpomatic2_create x --twod");
+       BOOST_CHECK(cc._twod);
+
+       cc = run("dcpomatic2_create x --threed");
+       BOOST_CHECK(cc._threed);
+
+       cc = run("dcpomatic2_create x --twod --threed");
+       BOOST_CHECK(cc.error);
+
        cc = run ("dcpomatic2_create x --config foo/bar");
        BOOST_CHECK (!cc.error);
        BOOST_REQUIRE (cc.config_dir);
@@ -195,3 +209,28 @@ BOOST_AUTO_TEST_CASE (create_cli_test)
        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 --template 2d");
+       auto 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());
+}
+