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