add tests
This commit is contained in:
parent
b1778f0764
commit
6c39d07274
1 changed files with 40 additions and 0 deletions
40
tests/FFMpeg/Tests/Filters/Video/CropFilterTest.php
Normal file
40
tests/FFMpeg/Tests/Filters/Video/CropFilterTest.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace FFMpeg\Tests\Filters\Video;
|
||||
|
||||
use FFMpeg\Coordinate\Dimension;
|
||||
use FFMpeg\Coordinate\Point;
|
||||
use FFMpeg\FFProbe\DataMapping\Stream;
|
||||
use FFMpeg\FFProbe\DataMapping\StreamCollection;
|
||||
use FFMpeg\Filters\Video\CropFilter;
|
||||
use FFMpeg\Tests\TestCase;
|
||||
|
||||
class CropFilterTest extends TestCase
|
||||
{
|
||||
|
||||
public function testCommandParamsAreCorrectAndStreamIsUpdated()
|
||||
{
|
||||
$stream = new Stream(array('width' => 320, 'height' => 240, 'codec_type' => 'video'));
|
||||
$streams = new StreamCollection(array($stream));
|
||||
|
||||
$video = $this->getVideoMock();
|
||||
$video->expects($this->once())
|
||||
->method('getStreams')
|
||||
->will($this->returnValue($streams));
|
||||
|
||||
$format = $this->getMock('FFMpeg\Format\VideoInterface');
|
||||
|
||||
$dimension = new Dimension(200, 150);
|
||||
$point = new Point(25, 35);
|
||||
$filter = new CropFilter($point, $dimension);
|
||||
$expected = array(
|
||||
'-filter:v',
|
||||
'crop=' . $dimension->getWidth() . ":" . $dimension->getHeight() . ":" . $point->getX() . ":" . $point->getY()
|
||||
);
|
||||
$this->assertEquals($expected, $filter->apply($video, $format));
|
||||
|
||||
$this->assertEquals(200, $stream->get('width'));
|
||||
$this->assertEquals(150, $stream->get('height'));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue