summaryrefslogtreecommitdiff
path: root/test/time_calculation_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/time_calculation_test.cc')
-rw-r--r--test/time_calculation_test.cc102
1 files changed, 51 insertions, 51 deletions
diff --git a/test/time_calculation_test.cc b/test/time_calculation_test.cc
index abac4a6bd..fb916fa1f 100644
--- a/test/time_calculation_test.cc
+++ b/test/time_calculation_test.cc
@@ -142,19 +142,19 @@ BOOST_AUTO_TEST_CASE(ffmpeg_time_calculation_test)
/* 25fps content, 25fps DCP */
film->set_video_frame_rate(25);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(content->video->length() / 25.0).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(content->video->length() / 25.0));
/* 25fps content, 24fps DCP; length should be increased */
film->set_video_frame_rate(24);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(content->video->length() / 24.0).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(content->video->length() / 24.0));
/* 25fps content, 30fps DCP; length should be decreased */
film->set_video_frame_rate(30);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(content->video->length() / 30.0).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(content->video->length() / 30.0));
/* 25fps content, 50fps DCP; length should be the same */
film->set_video_frame_rate(50);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(content->video->length() / 25.0).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(content->video->length() / 25.0));
/* 25fps content, 60fps DCP; length should be decreased */
film->set_video_frame_rate(60);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(content->video->length() * (50.0 / 60) / 25.0).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(content->video->length() * (50.0 / 60) / 25.0));
/* Make the content audio-only */
content->video.reset();
@@ -162,23 +162,23 @@ BOOST_AUTO_TEST_CASE(ffmpeg_time_calculation_test)
/* 24fps content, 24fps DCP */
film->set_video_frame_rate(24);
content->set_video_frame_rate(film, 24);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(1).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(1));
/* 25fps content, 25fps DCP */
film->set_video_frame_rate(25);
content->set_video_frame_rate(film, 25);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(1).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(1));
/* 25fps content, 24fps DCP; length should be increased */
film->set_video_frame_rate(24);
- BOOST_CHECK_SMALL(labs(content->full_length(film).get() - DCPTime::from_seconds(25.0 / 24).get()), 2L);
+ BOOST_CHECK(DCPTime(content->full_length(film) - DCPTime::from_seconds(25.0 / 24)).abs() < DCPTime(2, 96000));
/* 25fps content, 30fps DCP; length should be decreased */
film->set_video_frame_rate(30);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(25.0 / 30).get());
+ BOOST_CHECK(content->full_length(film) == 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(film).get(), DCPTime::from_seconds(1).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(1));
/* 25fps content, 60fps DCP; length should be decreased */
film->set_video_frame_rate(60);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(50.0 / 60).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(50.0 / 60));
}
@@ -412,9 +412,9 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
auto piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), 0);
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 12).get(), DCPTime::from_seconds(0.5).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(3.0).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 12) == DCPTime::from_seconds(0.5));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 72) == DCPTime::from_seconds(3.0));
/* Position 3s, no trim, content rate = DCP rate */
content->set_position(film, DCPTime::from_seconds(3));
@@ -424,9 +424,9 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(3.00).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 36).get(), DCPTime::from_seconds(4.50).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 162).get(), DCPTime::from_seconds(9.75).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime::from_seconds(3.00));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 36) == DCPTime::from_seconds(4.50));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 162) == DCPTime::from_seconds(9.75));
/* Position 3s, 1.5s trim, content rate = DCP rate */
content->set_position(film, DCPTime::from_seconds(3));
@@ -436,10 +436,10 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(1.50).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 36).get(), DCPTime::from_seconds(3.00).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(4.50).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 198).get(), DCPTime::from_seconds(9.75).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime::from_seconds(1.50));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 36) == DCPTime::from_seconds(3.00));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 72) == DCPTime::from_seconds(4.50));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 198) == DCPTime::from_seconds(9.75));
/* Position 0, no trim, content rate 24, DCP rate 25.
Now, for example, a DCPTime position of 3s means 3s at 25fps. Since we run the video
@@ -452,9 +452,9 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), 0);
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 15).get(), DCPTime::from_seconds(0.6).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 75).get(), DCPTime::from_seconds(3.0).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime(0));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 15) == DCPTime::from_seconds(0.6));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 75) == DCPTime::from_seconds(3.0));
/* Position 3s, no trim, content rate 24, DCP rate 25 */
content->set_position(film, DCPTime::from_seconds(3));
@@ -464,9 +464,9 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(3.00).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 40).get(), DCPTime::from_seconds(4.60).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 169).get(), DCPTime::from_seconds(9.76).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime::from_seconds(3.00));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 40) == DCPTime::from_seconds(4.60));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 169) == DCPTime::from_seconds(9.76));
/* Position 3s, 1.6s trim, content rate 24, DCP rate 25, so the 1.6s trim is at 24fps */
content->set_position(film, DCPTime::from_seconds(3));
@@ -476,10 +476,10 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), 142080);
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 40).get(), 295680);
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 80).get(), 449280);
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 209).get(), 944640);
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime(142080, 96000));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 40) == DCPTime(295680, 96000));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 80) == DCPTime(449280, 96000));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 209) == DCPTime(944640, 96000));
/* Position 0, no trim, content rate 24, DCP rate 48
Now, for example, a DCPTime position of 3s means 3s at 48fps. Since we run the video
@@ -494,9 +494,9 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), 0);
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 12).get(), DCPTime::from_seconds(0.5).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(3.0).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 12) == DCPTime::from_seconds(0.5));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 72) == DCPTime::from_seconds(3.0));
/* Position 3s, no trim, content rate 24, DCP rate 48 */
content->set_position(film, DCPTime::from_seconds(3));
@@ -506,9 +506,9 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(3.00).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 36).get(), DCPTime::from_seconds(4.50).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 162).get(), DCPTime::from_seconds(9.75).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime::from_seconds(3.00));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 36) == DCPTime::from_seconds(4.50));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 162) == DCPTime::from_seconds(9.75));
/* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */
content->set_position(film, DCPTime::from_seconds(3));
@@ -518,10 +518,10 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(1.50).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 36).get(), DCPTime::from_seconds(3.00).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(4.50).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 198).get(), DCPTime::from_seconds(9.75).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime::from_seconds(1.50));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 36) == DCPTime::from_seconds(3.00));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 72) == DCPTime::from_seconds(4.50));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 198) == DCPTime::from_seconds(9.75));
/* Position 0, no trim, content rate 48, DCP rate 24
Now, for example, a DCPTime position of 3s means 3s at 24fps. Since we run the video
@@ -535,9 +535,9 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), 0);
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 24).get(), DCPTime::from_seconds(0.5).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 144).get(), DCPTime::from_seconds(3.0).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 24) == DCPTime::from_seconds(0.5));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 144) == DCPTime::from_seconds(3.0));
/* Position 3s, no trim, content rate 24, DCP rate 48 */
content->set_position(film, DCPTime::from_seconds(3));
@@ -547,9 +547,9 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(3.00).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(4.50).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 324).get(), DCPTime::from_seconds(9.75).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime::from_seconds(3.00));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 72) == DCPTime::from_seconds(4.50));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 324) == DCPTime::from_seconds(9.75));
/* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */
content->set_position(film, DCPTime::from_seconds(3));
@@ -559,10 +559,10 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(1.50).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(3.00).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 144).get(), DCPTime::from_seconds(4.50).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 396).get(), DCPTime::from_seconds(9.75).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime::from_seconds(1.50));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 72) == DCPTime::from_seconds(3.00));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 144) == DCPTime::from_seconds(4.50));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 396) == DCPTime::from_seconds(9.75));
}
/** Test Player::dcp_to_content_audio */