Subject: [PATCH] Fix for Bug #103139 for FFmpeg-Command: The tests in 06-output_options.t fail as Command Line build is not ordered consistently Signed-off-by:Nick Charsley Date: Sat, 28 Mar 2015 12:59:01 +0000 To: bug-FFmpeg-Command@rt.cpan.org From: Nick Charsley From: Nick Charsley --- .gitignore | 6 ++++ t/06-output_options.t | 81 ++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 79 insertions(+), 8 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cc19a57 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/MYMETA.json +/MYMETA.yml +/Makefile +/pm_to_blib +/blib/lib/FFmpeg/Command.pm +/blib/man3/FFmpeg::Command.3pm \ No newline at end of file diff --git a/t/06-output_options.t b/t/06-output_options.t index c96a5c8..1480a9b 100644 --- a/t/06-output_options.t +++ b/t/06-output_options.t @@ -21,11 +21,44 @@ $ffmpeg->output_options({ }); my $cmd = $ffmpeg->_compose_command; +## This was too order specific!!! +my $tst_cmd= join(' ', @$cmd); +##It will be exactly this long +is(length($tst_cmd),98); +##it will have these bits + +ok( (index $tst_cmd,$ffmpeg->ffmpeg) eq 0);##must be first item +like( $tst_cmd,qr/out.mp4$/);##Must be last item on the line +like( $tst_cmd,qr/-y/); + +like( $tst_cmd,qr/-i in.mp4/); +like( $tst_cmd,qr/-y .*-i in.mp4/); + +like( $tst_cmd,qr/-acodec libaac/); +like( $tst_cmd,qr/-i .*-acodec libaac .*out.mp4/);##must be after -i and before out.mp4 + +like( $tst_cmd,qr/-acodec libaac/); +like( $tst_cmd,qr/-i .*-acodec libaac .*out.mp4/);##must be after -i and before out.mp4 + +like( $tst_cmd,qr/-b 600/); +like( $tst_cmd,qr/-i .*-b 600 .*out.mp4/);##must be after -i and before out.mp4 + +like( $tst_cmd,qr/-f mp4/); +like( $tst_cmd,qr/-i .*-f mp4 .*out.mp4/);##must be after -i and before out.mp4 + +like( $tst_cmd,qr/-vcodec mpeg4/); +like( $tst_cmd,qr/-i .*-vcodec mpeg4 .*out.mp4/);##must be after -i and before out.mp4 + +like( $tst_cmd,qr/-ar 48000/); +like( $tst_cmd,qr/-i .*-ar 48000 .*out.mp4/);##must be after -i and before out.mp4 + +like( $tst_cmd,qr/-s 320x240/); +like( $tst_cmd,qr/-i .*-s 320x240 .*out.mp4/);##must be after -i and before out.mp4 + +like( $tst_cmd,qr/-ab 64/); +like( $tst_cmd,qr/-i .*-ab 64 .*out.mp4/);##must be after -i and before out.mp4 + -is( - join(' ', @$cmd), - $ffmpeg->ffmpeg . ' -y -i in.mp4 -acodec libaac -b 600 -f mp4 -vcodec mpeg4 -ar 48000 -s 320x240 -ab 64 out.mp4' -); $ffmpeg = FFmpeg::Command->new; $ffmpeg->input_options({ file => 'in.mp4' }); @@ -35,7 +68,39 @@ $ffmpeg->output_options({ }); $cmd = $ffmpeg->_compose_command; -is( - join(' ', @$cmd), - $ffmpeg->ffmpeg . ' -y -i in.mp4 -b 600 -acodec libfaac -f mp4 -vcodec mpeg4 -ar 48000 -s 320x240 -ab 64 out.mp4' -); +## This was too order specific!!! +$tst_cmd= join(' ', @$cmd); +##It will be exactly this long +is(length($tst_cmd),99); +##it will have these bits + +ok( (index $tst_cmd,$ffmpeg->ffmpeg) eq 0);##must be first item +like( $tst_cmd,qr/out.mp4$/);##Must be last item on the line +like( $tst_cmd,qr/-y/); + +like( $tst_cmd,qr/-i in.mp4/); +like( $tst_cmd,qr/-y .*-i in.mp4/); + +like( $tst_cmd,qr/-acodec libfaac/); +like( $tst_cmd,qr/-i .*-acodec libfaac .*out.mp4/);##must be after -i and before out.mp4 + +like( $tst_cmd,qr/-acodec libfaac/); +like( $tst_cmd,qr/-i .*-acodec libfaac .*out.mp4/);##must be after -i and before out.mp4 + +like( $tst_cmd,qr/-b 600/); +like( $tst_cmd,qr/-i .*-b 600 .*out.mp4/);##must be after -i and before out.mp4 + +like( $tst_cmd,qr/-f mp4/); +like( $tst_cmd,qr/-i .*-f mp4 .*out.mp4/);##must be after -i and before out.mp4 + +like( $tst_cmd,qr/-vcodec mpeg4/); +like( $tst_cmd,qr/-i .*-vcodec mpeg4 .*out.mp4/);##must be after -i and before out.mp4 + +like( $tst_cmd,qr/-ar 48000/); +like( $tst_cmd,qr/-i .*-ar 48000 .*out.mp4/);##must be after -i and before out.mp4 + +like( $tst_cmd,qr/ -s 320x240 /); +like( $tst_cmd,qr/-i .*-s 320x240 .*out.mp4/);##must be after -i and before out.mp4 + +like( $tst_cmd,qr/ -ab 64 /); +like( $tst_cmd,qr/-i .*-ab 64 .*out.mp4/);##must be after -i and before out.mp4 -- 1.9.1