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<int> 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");
}
BOOST_AUTO_TEST_CASE (client_server_test)
{
shared_ptr<Image> image (new CompactImage (PIX_FMT_RGB24, Size (1998, 1080)));
-
uint8_t* p = image->data()[0];
for (int y = 0; y < 1080; ++y) {
}
}
+ shared_ptr<Image> sub_image (new CompactImage (PIX_FMT_RGBA, Size (100, 200)));
+ p = sub_image->data()[0];
+ for (int y = 0; y < 200; ++y) {
+ for (int x = 0; x < 100; ++x) {
+ *p++ = y % 256;
+ *p++ = x % 256;
+ *p++ = (x + y) % 256;
+ *p++ = 1;
+ }
+ }
+
+ shared_ptr<Subtitle> subtitle (new Subtitle (Position (50, 60), sub_image));
+
FileLog log ("build/test/client_server_test.log");
shared_ptr<DCPVideoFrame> frame (
new DCPVideoFrame (
image,
- shared_ptr<Subtitle> (),
+ subtitle,
Size (1998, 1080),
0,
0,
- 0,
+ 1,
Scaler::from_id ("bicubic"),
0,
24,
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<const FilmState> s, shared_ptr<const Options> o, Log* l, shared_ptr<Job> req)
- : Job (s, o, l, req)
+ TestJob (shared_ptr<const FilmState> s, Log* l, shared_ptr<Job> req)
+ : Job (s, l, req)
{
}
BOOST_AUTO_TEST_CASE (job_manager_test)
{
shared_ptr<const FilmState> s;
- shared_ptr<const Options> o;
FileLog log ("build/test/job_manager_test.log");
/* Single job, no dependency */
- shared_ptr<TestJob> a (new TestJob (s, o, &log, shared_ptr<Job> ()));
+ shared_ptr<TestJob> a (new TestJob (s, &log, shared_ptr<Job> ()));
JobManager::instance()->add (a);
dvdomatic_sleep (1);
BOOST_CHECK_EQUAL (a->finished_ok(), true);
/* Two jobs, dependency */
- a.reset (new TestJob (s, o, &log, shared_ptr<Job> ()));
- shared_ptr<TestJob> b (new TestJob (s, o, &log, a));
+ a.reset (new TestJob (s, &log, shared_ptr<Job> ()));
+ shared_ptr<TestJob> b (new TestJob (s, &log, a));
JobManager::instance()->add (a);
JobManager::instance()->add (b);
BOOST_CHECK_EQUAL (b->finished_ok(), true);
/* Two jobs, dependency, first fails */
- a.reset (new TestJob (s, o, &log, shared_ptr<Job> ()));
- b.reset (new TestJob (s, o, &log, a));
+ a.reset (new TestJob (s, &log, shared_ptr<Job> ()));
+ b.reset (new TestJob (s, &log, a));
JobManager::instance()->add (a);
JobManager::instance()->add (b);
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");
+}