summaryrefslogtreecommitdiff
path: root/test/player_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-05-19 21:35:46 +0200
committerCarl Hetherington <cth@carlh.net>2022-05-19 21:35:46 +0200
commit8d67ad2e74b6d2c88b52a397a2c2823254ec09fb (patch)
treec5901380449dcd83ea8f5eaeafd775d8f40e6c29 /test/player_test.cc
parente08d1ce718493a869e429be3a6f811575f2c8dd1 (diff)
wip: black pieces; sad part is that Shuffler can't cope with content that doesn't start at the same time.2253-3d-empty
Diffstat (limited to 'test/player_test.cc')
-rw-r--r--test/player_test.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/test/player_test.cc b/test/player_test.cc
index 3954fbbae..d7a8035e8 100644
--- a/test/player_test.cc
+++ b/test/player_test.cc
@@ -26,6 +26,7 @@
#include "lib/audio_buffers.h"
+#include "lib/black_content.h"
#include "lib/butler.h"
#include "lib/compose.hpp"
#include "lib/content_factory.h"
@@ -35,6 +36,7 @@
#include "lib/ffmpeg_content.h"
#include "lib/film.h"
#include "lib/image_content.h"
+#include "lib/piece.h"
#include "lib/player.h"
#include "lib/ratio.h"
#include "lib/string_text_file_content.h"
@@ -47,6 +49,7 @@
using std::cout;
+using std::dynamic_pointer_cast;
using std::list;
using std::shared_ptr;
using std::make_shared;
@@ -164,9 +167,20 @@ BOOST_AUTO_TEST_CASE (player_subframe_test)
BOOST_CHECK (film->length() == DCPTime::from_frames(3 * 24 + 1, 24));
auto player = std::make_shared<Player>(film, Image::Alignment::COMPACT);
+
player->setup_pieces ();
- BOOST_REQUIRE_EQUAL (player->_black._periods.size(), 1U);
- BOOST_CHECK (player->_black._periods.front().first == DCPTimePeriod(DCPTime::from_frames(3 * 24, 24), DCPTime::from_frames(3 * 24 + 1, 24)));
+ list<std::shared_ptr<Piece>> black;
+ std::copy_if(
+ player->_pieces.begin(),
+ player->_pieces.end(),
+ std::back_inserter(black),
+ [](shared_ptr<Piece> piece) {
+ return static_cast<bool>(dynamic_pointer_cast<BlackContent>(piece->content));
+ });
+ BOOST_REQUIRE_EQUAL (black.size(), 1U);
+ BOOST_CHECK (black.front()->content->position() == DCPTime::from_frames(3 * 24, 24));
+ BOOST_CHECK (black.front()->content->full_length(film) == DCPTime::from_frames(1, 24));
+
BOOST_REQUIRE_EQUAL (player->_silent._periods.size(), 1U);
BOOST_CHECK (player->_silent._periods.front() == DCPTimePeriod(DCPTime(289920), DCPTime::from_frames(3 * 24 + 1, 24)));
}