Addition of the tests
This commit is contained in:
parent
7c4eed68f9
commit
bbe94784c2
2 changed files with 49 additions and 0 deletions
|
|
@ -19,6 +19,11 @@
|
||||||
"name": "Patrik Karisch",
|
"name": "Patrik Karisch",
|
||||||
"email": "patrik@karisch.guru",
|
"email": "patrik@karisch.guru",
|
||||||
"homepage": "http://www.karisch.guru"
|
"homepage": "http://www.karisch.guru"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Romain Biard",
|
||||||
|
"email": "romain.biard@gmail.com",
|
||||||
|
"homepage": "https://www.strime.io/"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
|
|
|
||||||
44
tests/Unit/Filters/Video/PadFilterTest.php
Normal file
44
tests/Unit/Filters/Video/PadFilterTest.php
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\FFMpeg\Unit\Filters\Video;
|
||||||
|
|
||||||
|
use FFMpeg\Filters\Video\PadFilter;
|
||||||
|
use Tests\FFMpeg\Unit\TestCase;
|
||||||
|
use FFMpeg\FFProbe\DataMapping\Stream;
|
||||||
|
use FFMpeg\FFProbe\DataMapping\StreamCollection;
|
||||||
|
use FFMpeg\Coordinate\Dimension;
|
||||||
|
|
||||||
|
class PadFilterTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @dataProvider provideDimensions
|
||||||
|
*/
|
||||||
|
public function testApply(Dimension $dimension, $width, $height, $expected)
|
||||||
|
{
|
||||||
|
$video = $this->getVideoMock();
|
||||||
|
$pathfile = '/path/to/file'.mt_rand();
|
||||||
|
|
||||||
|
$format = $this->createMock('FFMpeg\Format\VideoInterface');
|
||||||
|
|
||||||
|
$streams = new StreamCollection(array(
|
||||||
|
new Stream(array(
|
||||||
|
'codec_type' => 'video',
|
||||||
|
'width' => $width,
|
||||||
|
'height' => $height,
|
||||||
|
))
|
||||||
|
));
|
||||||
|
|
||||||
|
$filter = new PadFilter($dimension);
|
||||||
|
$this->assertEquals($expected, $filter->apply($video, $format));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provideDimensions()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array(new Dimension(1000, 800), 640, 480, array('-vf', 'scale=iw*min(1000/iw\,800/ih):ih*min(1000/iw\,800/ih),pad=1000:800:(1000-iw)/2:(800-ih)/2')),
|
||||||
|
array(new Dimension(300, 600), 640, 480, array('-vf', 'scale=iw*min(300/iw\,600/ih):ih*min(300/iw\,600/ih),pad=300:600:(300-iw)/2:(600-ih)/2')),
|
||||||
|
array(new Dimension(100, 900), 640, 480, array('-vf', 'scale=iw*min(100/iw\,900/ih):ih*min(100/iw\,900/ih),pad=100:900:(100-iw)/2:(900-ih)/2')),
|
||||||
|
array(new Dimension(1200, 200), 640, 480, array('-vf', 'scale=iw*min(1200/iw\,200/ih):ih*min(1200/iw\,200/ih),pad=1200:200:(1200-iw)/2:(200-ih)/2')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue