From f964e99d63f5f5999ae4f245e6b25ced014d8383 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 7 Feb 2018 21:38:01 +0000 Subject: db8af2f changed rebase() to round down when rebasing times, but did not say why. This rounding down produces some unexpected results, e.g. taking 41 at a TCR of 1000 to a TCR of 24 gives 0, which upsets those who use DCP-o-matic and put in a SRT subtitle ending at ,041 --- the sub time is rounded down to 0 for a SMPTE DCP. This commit restores round-to-nearest behaviour. --- test/dcp_time_test.cc | 9 ++++----- test/write_subtitle_test.cc | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/dcp_time_test.cc b/test/dcp_time_test.cc index 099892b1..48a35b5a 100644 --- a/test/dcp_time_test.cc +++ b/test/dcp_time_test.cc @@ -96,14 +96,13 @@ BOOST_AUTO_TEST_CASE (dcp_time) /* Check rounding on conversion from seconds */ BOOST_CHECK_EQUAL (dcp::Time (80.990, 1000), dcp::Time (0, 1, 20, 990, 1000)); - /* Check rebase() */ + /* Check rebase */ a = dcp::Time (1, 58, 56, 2, 25); - BOOST_CHECK_EQUAL (a.rebase (250), dcp::Time (1, 58, 56, 20, 250)); + BOOST_CHECK_EQUAL (a.rebase(250), dcp::Time(1, 58, 56, 20, 250)); b = dcp::Time (9, 12, 41, 17, 99); - BOOST_CHECK_EQUAL (b.rebase (250), dcp::Time (9, 12, 41, 42, 250)); - /* We must round down in rebase() */ + BOOST_CHECK_EQUAL (b.rebase(250), dcp::Time(9, 12, 41, 43, 250)); a = dcp::Time (0, 2, 57, 999, 1000); - BOOST_CHECK_EQUAL (a.rebase (250), dcp::Time (0, 2, 57, 249, 250)); + BOOST_CHECK_EQUAL (a.rebase(250), dcp::Time(0, 2, 57, 250, 250)); /* Check some allowed constructions from string */ diff --git a/test/write_subtitle_test.cc b/test/write_subtitle_test.cc index bb5a77c4..d9240a30 100644 --- a/test/write_subtitle_test.cc +++ b/test/write_subtitle_test.cc @@ -207,7 +207,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test) "" "" "" - "" + "" "What's going on" "" "" @@ -289,7 +289,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test2) "" "" "" - "" + "" "What's going on" "" "" -- cgit v1.2.3