X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=test%2Ftime_calculation_test.cc;h=ddd685d0c33f2bb789ef1cce5567421c863958a8;hp=5e5c6211b6f3582477ba9eae4b9c6e26e6d97760;hb=a8a0dfd1b21de6c0facf965ab119833ff6f790bf;hpb=19f94521139aac13ef8fb4eaa55855b2ada307b4 diff --git a/test/time_calculation_test.cc b/test/time_calculation_test.cc index 5e5c6211b..ddd685d0c 100644 --- a/test/time_calculation_test.cc +++ b/test/time_calculation_test.cc @@ -1,19 +1,20 @@ /* Copyright (C) 2015-2016 Carl Hetherington - This program is free software; you can redistribute it and/or modify + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + DCP-o-matic is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with DCP-o-matic. If not, see . */ @@ -42,7 +43,7 @@ static string const xml = "" "1280" "720" "25" - "0" + "2d" "0" "0" "0" @@ -83,6 +84,7 @@ static string const xml = "" "und; 2 channels" "2" "44100" + "44100" "2" "0" "" @@ -142,6 +144,31 @@ BOOST_AUTO_TEST_CASE (ffmpeg_time_calculation_test) /* 25fps content, 60fps DCP; length should be decreased */ film->set_video_frame_rate (60); BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (content->video->length() * (50.0 / 60) / 25.0)); + + /* Make the content audio-only */ + content->video.reset (); + + /* 24fps content, 24fps DCP */ + film->set_video_frame_rate (24); + content->set_video_frame_rate (24); + BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (1)); + /* 25fps content, 25fps DCP */ + film->set_video_frame_rate (25); + content->set_video_frame_rate (25); + BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (1)); + /* 25fps content, 24fps DCP; length should be increased */ + film->set_video_frame_rate (24); + BOOST_CHECK_SMALL (abs (content->full_length().get() - DCPTime::from_seconds(25.0 / 24).get()), 2); + /* 25fps content, 30fps DCP; length should be decreased */ + film->set_video_frame_rate (30); + BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (25.0 / 30)); + /* 25fps content, 50fps DCP; length should be the same */ + film->set_video_frame_rate (50); + BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (1)); + /* 25fps content, 60fps DCP; length should be decreased */ + film->set_video_frame_rate (60); + BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (50.0 / 60)); + } /** Test Player::dcp_to_content_video */