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