diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-07-14 21:30:49 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-07-14 21:30:49 +0100 |
| commit | 0d6a18d8c1d80f4badb06929b90515bf121595b5 (patch) | |
| tree | 109f6ef3c56032abfdfc38124eabababc588d347 /test | |
| parent | 7cb037d17d5a34e2fddd4dce780144fd8d98513c (diff) | |
Try rounding down when calculating frames from Times.
Diffstat (limited to 'test')
| -rw-r--r-- | test/dcpomatic_time_test.cc | 39 | ||||
| -rw-r--r-- | test/wscript | 1 |
2 files changed, 40 insertions, 0 deletions
diff --git a/test/dcpomatic_time_test.cc b/test/dcpomatic_time_test.cc new file mode 100644 index 000000000..4462ae870 --- /dev/null +++ b/test/dcpomatic_time_test.cc @@ -0,0 +1,39 @@ +/* + Copyright (C) 2015 Carl Hetherington <cth@carlh.net> + + This program 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, + 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. + +*/ + +#include <boost/test/unit_test.hpp> +#include "lib/dcpomatic_time.h" + +BOOST_AUTO_TEST_CASE (dcpomatic_time_test) +{ + FrameRateChange frc (24, 48); + int j = 0; + int k = 0; + for (int64_t i = 0; i < 62000; i += 2000) { + DCPTime d (i); + ContentTime c (d, frc); + std::cout << i << " " << d << " " << c << " " << c.frames (24.0) << " " << j << "\n"; + BOOST_CHECK_EQUAL (c.frames (24.0), j); + ++k; + if (k == 2) { + ++j; + k = 0; + } + } +} diff --git a/test/wscript b/test/wscript index 7e2cf4b0d..931f3e924 100644 --- a/test/wscript +++ b/test/wscript @@ -47,6 +47,7 @@ def build(bld): client_server_test.cc colour_conversion_test.cc dcp_subtitle_test.cc + dcpomatic_time_test.cc ffmpeg_audio_test.cc ffmpeg_dcp_test.cc ffmpeg_decoder_seek_test.cc |
