scratch – Blame information for rev 115

Subversion Repositories:
Rev:
Rev Author Line No. Line
115 office 1 <?php
2  
3 namespace Tests\FFMpeg\Unit\Format\Video;
4  
5 use Tests\FFMpeg\Unit\Format\Audio\AudioTestCase;
6  
7 abstract class VideoTestCase extends AudioTestCase
8 {
9 public function testGetVideoCodec()
10 {
11 $this->assertScalar($this->getFormat()->getVideoCodec());
12 $this->assertContains($this->getFormat()->getVideoCodec(), $this->getFormat()->getAvailableVideoCodecs());
13 }
14  
15 public function testSupportBFrames()
16 {
17 $this->assertInternalType('boolean', $this->getFormat()->supportBFrames());
18 }
19  
20 public function testSetVideoCodec()
21 {
22 $format = $this->getFormat();
23  
24 foreach ($format->getAvailableVideoCodecs() as $codec) {
25 $format->setVideoCodec($codec);
26 $this->assertEquals($codec, $format->getVideoCodec());
27 }
28 }
29  
30 public function testGetKiloBitrate()
31 {
32 $this->assertInternalType('integer', $this->getFormat()->getKiloBitrate());
33 }
34  
35 public function testSetKiloBitrate()
36 {
37 $format = $this->getFormat();
38 $format->setKiloBitrate(2560);
39 $this->assertEquals(2560, $format->getKiloBitrate());
40 }
41  
42 /**
43 * @expectedException FFMpeg\Exception\InvalidArgumentException
44 */
45 public function testSetInvalidVideoCodec()
46 {
47 $this->getFormat()->setVideoCodec('invalid-random-video-codec');
48 }
49  
50 public function testGetAvailableVideoCodecs()
51 {
52 $this->assertGreaterThan(0, count($this->getFormat()->getAvailableVideoCodecs()));
53 }
54  
55 public function testCreateProgressListener()
56 {
57 $media = $this->getMock('FFMpeg\Media\MediaTypeInterface');
58 $media->expects($this->any())
59 ->method('getPathfile')
60 ->will($this->returnValue(__FILE__));
61 $format = $this->getFormat();
62 $ffprobe = $this->getFFProbeMock();
63  
64 foreach ($format->createProgressListener($media, $ffprobe, 1, 3) as $listener) {
65 $this->assertInstanceOf('FFMpeg\Format\ProgressListener\VideoProgressListener', $listener);
66 $this->assertSame($ffprobe, $listener->getFFProbe());
67 $this->assertSame(__FILE__, $listener->getPathfile());
68 $this->assertSame(1, $listener->getCurrentPass());
69 $this->assertSame(3, $listener->getTotalPass());
70 }
71 }
72  
73 public function testGetPasses()
74 {
75 $this->assertInternalType('integer', $this->getFormat()->getPasses());
76 $this->assertGreaterThan(0, $this->getFormat()->getPasses());
77 }
78  
79 public function testGetModulus()
80 {
81 $this->assertInternalType('integer', $this->getFormat()->getModulus());
82 $this->assertGreaterThan(0, $this->getFormat()->getModulus());
83 $this->assertEquals(0, $this->getFormat()->getModulus() % 2);
84 }
85 }