7 class ExifTest
extends MediaWikiTestCase
{
12 protected function setUp() {
14 $this->checkPHPExtension( 'exif' );
16 $this->mediaPath
= __DIR__
. '/../../data/media/';
18 $this->setMwGlobals( 'wgShowEXIF', true );
21 public function testGPSExtraction() {
22 $filename = $this->mediaPath
. 'exif-gps.jpg';
23 $seg = JpegMetadataExtractor
::segmentSplitter( $filename );
24 $exif = new Exif( $filename, $seg['byteOrder'] );
25 $data = $exif->getFilteredData();
27 'GPSLatitude' => 88.5180555556,
28 'GPSLongitude' => -21.12357,
29 'GPSAltitude' => -3.141592653,
31 'GPSVersionID' => '2.2.0.0',
33 $this->assertEquals( $expected, $data, '', 0.0000000001 );
36 public function testUnicodeUserComment() {
37 $filename = $this->mediaPath
. 'exif-user-comment.jpg';
38 $seg = JpegMetadataExtractor
::segmentSplitter( $filename );
39 $exif = new Exif( $filename, $seg['byteOrder'] );
40 $data = $exif->getFilteredData();
43 'UserComment' => 'testâcomment',
45 $this->assertEquals( $expected, $data );