X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=test%2Fcreate_cli_test.cc;h=523fd75e667ca9cd09f0334ae5957510bd68d7f3;hb=59c4edb69ba926d3790198cd2b62dc601944a632;hp=5425969b6d8f1c4acd745772b4a4b9dfec1f465f;hpb=4edc14c8b1410e24f68b510cc14409b96c0338a3;p=dcpomatic.git diff --git a/test/create_cli_test.cc b/test/create_cli_test.cc index 5425969b6..523fd75e6 100644 --- a/test/create_cli_test.cc +++ b/test/create_cli_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2019 Carl Hetherington + Copyright (C) 2019-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -21,6 +21,7 @@ #include "lib/create_cli.h" #include "lib/ratio.h" #include "lib/dcp_content_type.h" +#include "test.h" #include #include #include @@ -98,7 +99,11 @@ BOOST_AUTO_TEST_CASE (create_cli_test) cc = run ("dcpomatic2_create x --standard SMPTE"); BOOST_CHECK (!cc.error); - BOOST_CHECK_EQUAL (cc.standard, dcp::SMPTE); + BOOST_CHECK_EQUAL (cc.standard, dcp::Standard::SMPTE); + + cc = run ("dcpomatic2_create x --standard interop"); + BOOST_CHECK (!cc.error); + BOOST_CHECK_EQUAL (cc.standard, dcp::Standard::INTEROP); cc = run ("dcpomatic2_create x --standard SMPTEX"); BOOST_CHECK (cc.error); @@ -123,32 +128,62 @@ BOOST_AUTO_TEST_CASE (create_cli_test) BOOST_CHECK_EQUAL (cc.still_length, 42); BOOST_REQUIRE (cc.output_dir); BOOST_CHECK_EQUAL (*cc.output_dir, "flaps"); - BOOST_REQUIRE_EQUAL (cc.content.size(), 3); + BOOST_REQUIRE_EQUAL (cc.content.size(), 3U); BOOST_CHECK_EQUAL (cc.content[0].path, "fred"); - BOOST_CHECK_EQUAL (cc.content[0].frame_type, VIDEO_FRAME_TYPE_2D); + BOOST_CHECK_EQUAL (cc.content[0].frame_type, VideoFrameType::TWO_D); BOOST_CHECK_EQUAL (cc.content[1].path, "jim"); - BOOST_CHECK_EQUAL (cc.content[1].frame_type, VIDEO_FRAME_TYPE_2D); + BOOST_CHECK_EQUAL (cc.content[1].frame_type, VideoFrameType::TWO_D); BOOST_CHECK_EQUAL (cc.content[2].path, "sheila"); - BOOST_CHECK_EQUAL (cc.content[2].frame_type, VIDEO_FRAME_TYPE_2D); + BOOST_CHECK_EQUAL (cc.content[2].frame_type, VideoFrameType::TWO_D); cc = run ("dcpomatic2_create --left-eye left.mp4 --right-eye right.mp4"); - BOOST_REQUIRE_EQUAL (cc.content.size(), 2); + BOOST_REQUIRE_EQUAL (cc.content.size(), 2U); BOOST_CHECK_EQUAL (cc.content[0].path, "left.mp4"); - BOOST_CHECK_EQUAL (cc.content[0].frame_type, VIDEO_FRAME_TYPE_3D_LEFT); + BOOST_CHECK_EQUAL (cc.content[0].frame_type, VideoFrameType::THREE_D_LEFT); BOOST_CHECK_EQUAL (cc.content[1].path, "right.mp4"); - BOOST_CHECK_EQUAL (cc.content[1].frame_type, VIDEO_FRAME_TYPE_3D_RIGHT); + BOOST_CHECK_EQUAL (cc.content[1].frame_type, VideoFrameType::THREE_D_RIGHT); BOOST_CHECK_EQUAL (cc.fourk, false); + cc = run ("dcpomatic2_create --twok foo.mp4"); + BOOST_REQUIRE_EQUAL (cc.content.size(), 1U); + BOOST_CHECK_EQUAL (cc.content[0].path, "foo.mp4"); + BOOST_CHECK_EQUAL (cc.twok, true); + BOOST_CHECK (!cc.error); + cc = run ("dcpomatic2_create --fourk foo.mp4"); - BOOST_REQUIRE_EQUAL (cc.content.size(), 1); + BOOST_REQUIRE_EQUAL (cc.content.size(), 1U); BOOST_CHECK_EQUAL (cc.content[0].path, "foo.mp4"); BOOST_CHECK_EQUAL (cc.fourk, true); BOOST_CHECK (!cc.error); cc = run ("dcpomatic2_create --j2k-bandwidth 120 foo.mp4"); - BOOST_REQUIRE_EQUAL (cc.content.size(), 1); + BOOST_REQUIRE_EQUAL (cc.content.size(), 1U); BOOST_CHECK_EQUAL (cc.content[0].path, "foo.mp4"); BOOST_REQUIRE (cc.j2k_bandwidth); BOOST_CHECK_EQUAL (*cc.j2k_bandwidth, 120000000); BOOST_CHECK (!cc.error); + + 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); }