diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-07-12 15:21:31 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-07-12 15:21:31 +0100 |
| commit | 2517ec798da291dedc02dd7a7a432f7aa63133e4 (patch) | |
| tree | 275fdd498846450725f4400ebb5863ba2a5ac15c /test/player_test.cc | |
| parent | 7698ee82874ee9cb5fa4b251a0a7e7e2df81fcfb (diff) | |
Add some tests; fix failure to make DCP when there is a bit of audio right at the end of the film (with no corresponding video).
Diffstat (limited to 'test/player_test.cc')
| -rw-r--r-- | test/player_test.cc | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/test/player_test.cc b/test/player_test.cc index a1b0f1148..14a1fa0c6 100644 --- a/test/player_test.cc +++ b/test/player_test.cc @@ -23,8 +23,6 @@ * @ingroup selfcontained */ -#include <iostream> -#include <boost/test/unit_test.hpp> #include "lib/film.h" #include "lib/ffmpeg_content.h" #include "lib/dcp_content_type.h" @@ -33,7 +31,10 @@ #include "lib/player.h" #include "lib/video_content.h" #include "lib/image_content.h" +#include "lib/content_factory.h" #include "test.h" +#include <boost/test/unit_test.hpp> +#include <iostream> using std::cout; using std::list; @@ -115,3 +116,32 @@ BOOST_AUTO_TEST_CASE (player_black_fill_test) check_dcp (ref.string(), check.string()); } + +/** Check behaviour with an awkward playlist whose data does not end on a video frame start */ +BOOST_AUTO_TEST_CASE (player_subframe_test) +{ + shared_ptr<Film> film = new_test_film ("reels_test7"); + film->set_name ("reels_test7"); + film->set_container (Ratio::from_id ("185")); + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); + shared_ptr<Content> A = content_factory(film, "test/data/flat_red.png").front(); + film->examine_and_add_content (A); + BOOST_REQUIRE (!wait_for_jobs ()); + shared_ptr<Content> B = content_factory(film, "test/data/awkward_length.wav").front(); + film->examine_and_add_content (B); + BOOST_REQUIRE (!wait_for_jobs ()); + film->set_video_frame_rate (24); + A->video->set_length (3 * 24); + + BOOST_CHECK (A->full_length() == DCPTime::from_frames(3 * 24, 24)); + BOOST_CHECK (B->full_length() == DCPTime(289920)); + /* Length should be rounded up from B's length to the next video frame */ + BOOST_CHECK (film->length() == DCPTime::from_frames(3 * 24 + 1, 24)); + + shared_ptr<Player> player (new Player (film, film->playlist ())); + player->setup_pieces (); + BOOST_REQUIRE_EQUAL (player->_black._periods.size(), 1); + BOOST_CHECK (player->_black._periods.front() == DCPTimePeriod(DCPTime::from_frames(3 * 24, 24), DCPTime::from_frames(3 * 24 + 1, 24))); + BOOST_REQUIRE_EQUAL (player->_silent._periods.size(), 1); + BOOST_CHECK (player->_silent._periods.front() == DCPTimePeriod(DCPTime(289920), DCPTime::from_frames(3 * 24 + 1, 24))); +} |
