scratch – Blame information for rev 120
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
120 | office | 1 | <?php |
2 | |||
3 | namespace Tests\FFMpeg\Unit\Coordinate; |
||
4 | |||
5 | use Tests\FFMpeg\Unit\TestCase; |
||
6 | use FFMpeg\Coordinate\TimeCode; |
||
7 | |||
8 | class TimeCodeTest extends TestCase |
||
9 | { |
||
10 | /** |
||
11 | * @dataProvider provideTimecodes |
||
12 | */ |
||
13 | public function testFromString($timecode, $expected) |
||
14 | { |
||
15 | $tc = TimeCode::fromString($timecode); |
||
16 | $this->assertEquals((string) $tc, $expected); |
||
17 | } |
||
18 | |||
19 | public function provideTimeCodes() |
||
20 | { |
||
21 | return array( |
||
22 | array('1:02:04:05:20', '26:04:05.20'), |
||
23 | array('1:02:04:05.20', '26:04:05.20'), |
||
24 | array('02:04:05:20', '02:04:05.20'), |
||
25 | array('02:04:05.20', '02:04:05.20'), |
||
26 | array('00:00:05.20', '00:00:05.20'), |
||
27 | array('00:00:00.00', '00:00:00.00'), |
||
28 | ); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @expectedException FFMpeg\Exception\InvalidArgumentException |
||
33 | */ |
||
34 | public function testFromInvalidString() |
||
35 | { |
||
36 | TimeCode::fromString('lalali lala'); |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @dataProvider provideSeconds |
||
41 | */ |
||
42 | public function testFromSeconds($seconds, $expected) |
||
43 | { |
||
44 | $tc = TimeCode::fromSeconds($seconds); |
||
45 | $this->assertEquals($expected, (string) $tc); |
||
46 | } |
||
47 | |||
48 | public function provideSeconds() |
||
49 | { |
||
50 | return array( |
||
51 | array(0.467, '00:00:00.47'), |
||
52 | array(12.467, '00:00:12.47'), |
||
53 | array(59.867, '00:00:59.87'), |
||
54 | array(72.467, '00:01:12.47'), |
||
55 | array(3599.467, '00:59:59.47'), |
||
56 | array(3600.467, '01:00:00.47'), |
||
57 | array(86422.467, '24:00:22.47'), |
||
58 | ); |
||
59 | } |
||
60 | } |