X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=test%2Ftest.cc;h=5aed18c523043512729a14533c85fbb9ccc56350;hb=4488ca79635bda37e034b888d1c43618f5e4285e;hp=730aa8d3e2a21dca5e0cf691a5f3f352f2787a92;hpb=068bb5b95652c022419c64f3d29cc42c4610ae93;p=dcpomatic.git diff --git a/test/test.cc b/test/test.cc index 730aa8d3e..5aed18c52 100644 --- a/test/test.cc +++ b/test/test.cc @@ -258,13 +258,15 @@ BOOST_AUTO_TEST_CASE (md5_digest_test) BOOST_AUTO_TEST_CASE (paths_test) { FilmState s; - s.directory = "build/test/a/b/c/d/e"; - s.thumbs.push_back (42); + s.set_directory ("build/test/a/b/c/d/e"); + vector thumbs; + thumbs.push_back (42); + s.set_thumbs (thumbs); BOOST_CHECK_EQUAL (s.thumb_file (0), "build/test/a/b/c/d/e/thumbs/00000042.png"); - s.content = "/foo/bar/baz"; + s._content = "/foo/bar/baz"; BOOST_CHECK_EQUAL (s.content_path(), "/foo/bar/baz"); - s.content = "foo/bar/baz"; + s._content = "foo/bar/baz"; BOOST_CHECK_EQUAL (s.content_path(), "build/test/a/b/c/d/e/foo/bar/baz"); } @@ -401,31 +403,31 @@ BOOST_AUTO_TEST_CASE (make_dcp_with_range_test) BOOST_AUTO_TEST_CASE (audio_sampling_rate_test) { FilmState fs; - fs.frames_per_second = 24; + fs.set_frames_per_second (24); - fs.audio_sample_rate = 48000; + fs.set_audio_sample_rate (48000); BOOST_CHECK_EQUAL (fs.target_sample_rate(), 48000); - fs.audio_sample_rate = 44100; + fs.set_audio_sample_rate (44100); BOOST_CHECK_EQUAL (fs.target_sample_rate(), 48000); - fs.audio_sample_rate = 80000; + fs.set_audio_sample_rate (80000); BOOST_CHECK_EQUAL (fs.target_sample_rate(), 96000); - fs.frames_per_second = 23.976; - fs.audio_sample_rate = 48000; + fs.set_frames_per_second (23.976); + fs.set_audio_sample_rate (48000); BOOST_CHECK_EQUAL (fs.target_sample_rate(), 47952); - fs.frames_per_second = 29.97; - fs.audio_sample_rate = 48000; + fs.set_frames_per_second (29.97); + fs.set_audio_sample_rate (48000); BOOST_CHECK_EQUAL (fs.target_sample_rate(), 47952); } class TestJob : public Job { public: - TestJob (shared_ptr s, shared_ptr o, Log* l, shared_ptr req) - : Job (s, o, l, req) + TestJob (shared_ptr s, Log* l, shared_ptr req) + : Job (s, l, req) { } @@ -455,11 +457,10 @@ public: BOOST_AUTO_TEST_CASE (job_manager_test) { shared_ptr s; - shared_ptr o; FileLog log ("build/test/job_manager_test.log"); /* Single job, no dependency */ - shared_ptr a (new TestJob (s, o, &log, shared_ptr ())); + shared_ptr a (new TestJob (s, &log, shared_ptr ())); JobManager::instance()->add (a); dvdomatic_sleep (1); @@ -469,8 +470,8 @@ BOOST_AUTO_TEST_CASE (job_manager_test) BOOST_CHECK_EQUAL (a->finished_ok(), true); /* Two jobs, dependency */ - a.reset (new TestJob (s, o, &log, shared_ptr ())); - shared_ptr b (new TestJob (s, o, &log, a)); + a.reset (new TestJob (s, &log, shared_ptr ())); + shared_ptr b (new TestJob (s, &log, a)); JobManager::instance()->add (a); JobManager::instance()->add (b); @@ -486,8 +487,8 @@ BOOST_AUTO_TEST_CASE (job_manager_test) BOOST_CHECK_EQUAL (b->finished_ok(), true); /* Two jobs, dependency, first fails */ - a.reset (new TestJob (s, o, &log, shared_ptr ())); - b.reset (new TestJob (s, o, &log, a)); + a.reset (new TestJob (s, &log, shared_ptr ())); + b.reset (new TestJob (s, &log, a)); JobManager::instance()->add (a); JobManager::instance()->add (b); @@ -499,3 +500,16 @@ BOOST_AUTO_TEST_CASE (job_manager_test) BOOST_CHECK_EQUAL (a->finished_in_error(), true); BOOST_CHECK_EQUAL (b->running(), false); } + +BOOST_AUTO_TEST_CASE (stream_test) +{ + AudioStream a ("4 9 hello there world"); + BOOST_CHECK_EQUAL (a.id(), 4); + BOOST_CHECK_EQUAL (a.channels(), 9); + BOOST_CHECK_EQUAL (a.name(), "hello there world"); + BOOST_CHECK_EQUAL (a.to_string(), "4 9 hello there world"); + + SubtitleStream s ("5 a b c"); + BOOST_CHECK_EQUAL (s.id(), 5); + BOOST_CHECK_EQUAL (s.name(), "a b c"); +}