Fixed dependencies for jquery.collapsibleTabs
[lhc/web/wiklou.git] / tests / phpunit / includes / media / GIFMetadataExtractorTest.php
1 <?php
2 class GIFMetadataExtractorTest extends MediaWikiTestCase {
3
4 public function setUp() {
5 $this->mediaPath = __DIR__ . '/../../data/media/';
6 }
7 /**
8 * Put in a file, and see if the metadata coming out is as expected.
9 * @param $filename String
10 * @param $expected Array The extracted metadata.
11 * @dataProvider dataGetMetadata
12 */
13 public function testGetMetadata( $filename, $expected ) {
14 $actual = GIFMetadataExtractor::getMetadata( $this->mediaPath . $filename );
15 $this->assertEquals( $expected, $actual );
16 }
17 public function dataGetMetadata() {
18
19 $xmpNugget = <<<EOF
20 <?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
21 <x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 7.30'>
22 <rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
23
24 <rdf:Description rdf:about=''
25 xmlns:Iptc4xmpCore='http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/'>
26 <Iptc4xmpCore:Location>The interwebs</Iptc4xmpCore:Location>
27 </rdf:Description>
28
29 <rdf:Description rdf:about=''
30 xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
31 <tiff:Artist>Bawolff</tiff:Artist>
32 <tiff:ImageDescription>
33 <rdf:Alt>
34 <rdf:li xml:lang='x-default'>A file to test GIF</rdf:li>
35 </rdf:Alt>
36 </tiff:ImageDescription>
37 </rdf:Description>
38 </rdf:RDF>
39 </x:xmpmeta>
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64 <?xpacket end='w'?>
65 EOF;
66 $xmpNugget = str_replace( "\r", '', $xmpNugget ); // Windows compat
67
68 return array(
69 array( 'nonanimated.gif', array(
70 'comment' => array( 'GIF test file ⁕ Created with GIMP' ),
71 'duration' => 0.1,
72 'frameCount' => 1,
73 'looped' => false,
74 'xmp' => '',
75 )
76 ),
77 array( 'animated.gif', array(
78 'comment' => array( 'GIF test file . Created with GIMP' ),
79 'duration' => 2.4,
80 'frameCount' => 4,
81 'looped' => true,
82 'xmp' => '',
83 )
84 ),
85
86 array( 'animated-xmp.gif', array(
87 'xmp' => $xmpNugget,
88 'duration' => 2.4,
89 'frameCount' => 4,
90 'looped' => true,
91 'comment' => array( 'GIƒ·test·file' ),
92 )
93 ),
94 );
95 }
96 }