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