Skip to content

Commit

Permalink
FFMPEG::FormatParameters tests
Browse files Browse the repository at this point in the history
  • Loading branch information
drbrain committed Sep 6, 2009
1 parent 9985d40 commit c0592c0
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ffmpeg/format_parameters.rb
Expand Up @@ -17,7 +17,7 @@ class FFMPEG::FormatParameters
AVFormatParameters *format_parameters; AVFormatParameters *format_parameters;
VALUE obj; VALUE obj;
format_parameters = av_malloc(sizeof(AVFormatParameters)); format_parameters = av_mallocz(sizeof(AVFormatParameters));
if (!format_parameters) if (!format_parameters)
rb_raise(rb_eNoMemError, "unable to allocate AVFormatParameters"); rb_raise(rb_eNoMemError, "unable to allocate AVFormatParameters");
Expand Down Expand Up @@ -52,7 +52,7 @@ class FFMPEG::FormatParameters
builder.accessor :sample_rate, 'int' builder.accessor :sample_rate, 'int'
builder.accessor :width, 'int' builder.accessor :width, 'int'


builder.accessor :standard, 'char *' builder.accessor :standard, 'char *' # TODO need av_strlcpy?
end end
end end


47 changes: 47 additions & 0 deletions test/test_ffmpeg_format_parameters.rb
@@ -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.