6 class ExifTest
extends MediaWikiTestCase
{
11 protected function setUp() {
13 $this->checkPHPExtension( 'exif' );
15 $this->mediaPath
= __DIR__
. '/../../data/media/';
17 $this->setMwGlobals( 'wgShowEXIF', true );
20 public function testGPSExtraction() {
21 $filename = $this->mediaPath
. 'exif-gps.jpg';
22 $seg = JpegMetadataExtractor
::segmentSplitter( $filename );
23 $exif = new Exif( $filename, $seg['byteOrder'] );
24 $data = $exif->getFilteredData();
26 'GPSLatitude' => 88.5180555556,
27 'GPSLongitude' => -21.12357,
28 'GPSAltitude' => -3.141592653,
30 'GPSVersionID' => '2.2.0.0',
32 $this->assertEquals( $expected, $data, '', 0.0000000001 );
35 public function testUnicodeUserComment() {
36 $filename = $this->mediaPath
. 'exif-user-comment.jpg';
37 $seg = JpegMetadataExtractor
::segmentSplitter( $filename );
38 $exif = new Exif( $filename, $seg['byteOrder'] );
39 $data = $exif->getFilteredData();
42 'UserComment' => 'testâcomment'
44 $this->assertEquals( $expected, $data );