MediaWiki
REL1_21
|
00001 <?php 00002 class GIFMetadataExtractorTest extends MediaWikiTestCase { 00003 00004 protected function setUp() { 00005 parent::setUp(); 00006 00007 $this->mediaPath = __DIR__ . '/../../data/media/'; 00008 } 00009 00016 public function testGetMetadata( $filename, $expected ) { 00017 $actual = GIFMetadataExtractor::getMetadata( $this->mediaPath . $filename ); 00018 $this->assertEquals( $expected, $actual ); 00019 } 00020 00021 public static function provideGetMetadata() { 00022 00023 $xmpNugget = <<<EOF 00024 <?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?> 00025 <x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 7.30'> 00026 <rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'> 00027 00028 <rdf:Description rdf:about='' 00029 xmlns:Iptc4xmpCore='http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/'> 00030 <Iptc4xmpCore:Location>The interwebs</Iptc4xmpCore:Location> 00031 </rdf:Description> 00032 00033 <rdf:Description rdf:about='' 00034 xmlns:tiff='http://ns.adobe.com/tiff/1.0/'> 00035 <tiff:Artist>Bawolff</tiff:Artist> 00036 <tiff:ImageDescription> 00037 <rdf:Alt> 00038 <rdf:li xml:lang='x-default'>A file to test GIF</rdf:li> 00039 </rdf:Alt> 00040 </tiff:ImageDescription> 00041 </rdf:Description> 00042 </rdf:RDF> 00043 </x:xmpmeta> 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 <?xpacket end='w'?> 00069 EOF; 00070 $xmpNugget = str_replace( "\r", '', $xmpNugget ); // Windows compat 00071 00072 return array( 00073 array( 00074 'nonanimated.gif', 00075 array( 00076 'comment' => array( 'GIF test file ⁕ Created with GIMP' ), 00077 'duration' => 0.1, 00078 'frameCount' => 1, 00079 'looped' => false, 00080 'xmp' => '', 00081 ) 00082 ), 00083 array( 00084 'animated.gif', 00085 array( 00086 'comment' => array( 'GIF test file . Created with GIMP' ), 00087 'duration' => 2.4, 00088 'frameCount' => 4, 00089 'looped' => true, 00090 'xmp' => '', 00091 ) 00092 ), 00093 00094 array( 00095 'animated-xmp.gif', 00096 array( 00097 'xmp' => $xmpNugget, 00098 'duration' => 2.4, 00099 'frameCount' => 4, 00100 'looped' => true, 00101 'comment' => array( 'GIƒ·test·file' ), 00102 ) 00103 ), 00104 ); 00105 } 00106 }