Permalink
Browse files

FFMPEG::FormatParameters tests

  • Loading branch information...
1 parent 9985d40 commit c0592c09a60e45ba3f8628562b16327dabf3ff39 @drbrain committed Sep 6, 2009
Showing with 49 additions and 2 deletions.
  1. +2 −2 lib/ffmpeg/format_parameters.rb
  2. +47 −0 test/test_ffmpeg_format_parameters.rb
@@ -17,7 +17,7 @@ class FFMPEG::FormatParameters
AVFormatParameters *format_parameters;
VALUE obj;
- format_parameters = av_malloc(sizeof(AVFormatParameters));
+ format_parameters = av_mallocz(sizeof(AVFormatParameters));
if (!format_parameters)
rb_raise(rb_eNoMemError, "unable to allocate AVFormatParameters");
@@ -52,7 +52,7 @@ class FFMPEG::FormatParameters
builder.accessor :sample_rate, 'int'
builder.accessor :width, 'int'
- builder.accessor :standard, 'char *'
+ builder.accessor :standard, 'char *' # TODO need av_strlcpy?
end
end
@@ -0,0 +1,47 @@
+require 'ffmpeg/test_case'
+
+class TestFFMPEGFormatParameters < FFMPEG::TestCase
+
+ def setup
+ super
+
+ @fp = FFMPEG::FormatParameters.new
+ end
+
+ def test_channel
+ @fp.channel = 1
+ assert_equal 1, @fp.channel
+ end
+
+ def test_channels
+ @fp.channels = 2
+ assert_equal 2, @fp.channels
+ end
+
+ def test_height
+ @fp.height = 30
+ assert_equal 30, @fp.height
+ end
+
+ def test_pixel_format
+ @fp.channel = FFMPEG::PixelFormat::YUV420P
+ assert_equal FFMPEG::PixelFormat::YUV420P, @fp.pixel_format
+ end
+
+ def test_sample_rate
+ @fp.sample_rate = 16_000
+ assert_equal 16_000, @fp.sample_rate
+ end
+
+ def test_width
+ @fp.width = 40
+ assert_equal 40, @fp.width
+ end
+
+ def test_standard
+ @fp.standard = 'NTSC'
+ assert_equal 'NTSC', @fp.standard
+ end
+
+end
+

0 comments on commit c0592c0

Please sign in to comment.