2 class ExifTest
extends MediaWikiTestCase
{
4 protected function setUp() {
7 $this->mediaPath
= __DIR__
. '/../../data/media/';
9 if ( !wfDl( 'exif' ) ) {
10 $this->markTestSkipped( "This test needs the exif extension." );
13 $this->setMwGlobals( 'wgShowEXIF', true );
16 public function testGPSExtraction() {
17 $filename = $this->mediaPath
. 'exif-gps.jpg';
18 $seg = JpegMetadataExtractor
::segmentSplitter( $filename );
19 $exif = new Exif( $filename, $seg['byteOrder'] );
20 $data = $exif->getFilteredData();
22 'GPSLatitude' => 88.5180555556,
23 'GPSLongitude' => -21.12357,
24 'GPSAltitude' => -3.141592653,
26 'GPSVersionID' => '2.2.0.0',
28 $this->assertEquals( $expected, $data, '', 0.0000000001 );
31 public function testUnicodeUserComment() {
32 $filename = $this->mediaPath
. 'exif-user-comment.jpg';
33 $seg = JpegMetadataExtractor
::segmentSplitter( $filename );
34 $exif = new Exif( $filename, $seg['byteOrder'] );
35 $data = $exif->getFilteredData();
38 'UserComment' => 'testâcomment'
40 $this->assertEquals( $expected, $data );