summaryrefslogtreecommitdiff
path: root/test/time_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-05-29 11:57:08 +0100
committerCarl Hetherington <cth@carlh.net>2014-05-29 11:57:08 +0100
commitaebf2cb7812c8f593b85182611b587e6014aefc6 (patch)
treec954ebc0cf39263b6c051e159f48e177cafae310 /test/time_test.cc
parent8b1958988ca234f51ec99385d81b95c1f0f092af (diff)
Re-work Subtitle class; remove STL text writer.
Diffstat (limited to 'test/time_test.cc')
-rw-r--r--test/time_test.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/test/time_test.cc b/test/time_test.cc
index a244377..977ebd2 100644
--- a/test/time_test.cc
+++ b/test/time_test.cc
@@ -20,7 +20,7 @@
#include <boost/test/unit_test.hpp>
#include "metric_time.h"
#include "frame_time.h"
-#include "convert_time.h"
+#include "time_pair.h"
/* Check time construction */
BOOST_AUTO_TEST_CASE (time_construction_test)
@@ -45,12 +45,17 @@ BOOST_AUTO_TEST_CASE (time_construction_test)
/* Check time conversions */
BOOST_AUTO_TEST_CASE (time_conversion_test)
{
+ sub::TimePair p;
+
/* 40ms = 1 frame at 25fps */
- BOOST_CHECK_EQUAL (metric_to_frame (sub::MetricTime (3, 5, 7, 40), 25), sub::FrameTime (3, 5, 7, 1));
- BOOST_CHECK_EQUAL (frame_to_metric (sub::FrameTime (3, 5, 7, 1), 25), sub::MetricTime (3, 5, 7, 40));
+ p.set_metric (sub::MetricTime (3, 5, 7, 40));
+ BOOST_CHECK_EQUAL (p.frame (25), sub::FrameTime (3, 5, 7, 1));
+ p.set_frame (sub::FrameTime (3, 5, 7, 1));
+ BOOST_CHECK_EQUAL (p.metric (25), sub::MetricTime (3, 5, 7, 40));
/* 120ms = 3 frames at 25fps */
- BOOST_CHECK_EQUAL (metric_to_frame (sub::MetricTime (3, 5, 7, 120), 25), sub::FrameTime (3, 5, 7, 3));
- BOOST_CHECK_EQUAL (frame_to_metric (sub::FrameTime (3, 5, 7, 3), 25), sub::MetricTime (3, 5, 7, 120));
+ p.set_metric (sub::MetricTime (3, 5, 7, 120));
+ BOOST_CHECK_EQUAL (p.frame (25), sub::FrameTime (3, 5, 7, 3));
+ p.set_frame (sub::FrameTime (3, 5, 7, 3));
+ BOOST_CHECK_EQUAL (p.metric (25), sub::MetricTime (3, 5, 7, 120));
}
-