2 class ExifTest
extends MediaWikiTestCase
{
4 public function setUp() {
5 $this->mediaPath
= dirname( __FILE__
) . '/../../data/media/';
8 $this->showExif
= $wgShowEXIF;
11 public function tearDown() {
13 $wgShowEXIF = $this->showExif
;
16 public function testGPSExtraction() {
17 if ( !wfDl( 'exif' ) ) {
18 $this->markTestIncomplete( "This test needs the exif extension." );
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' => -200,
30 'GPSVersionID' => '2.2.0.0',
32 $this->assertEquals( $expected, $data, '', 0.0000000001 );
34 public function testUnicodeUserComment() {
35 if ( !wfDl( 'exif' ) ) {
36 $this->markTestIncomplete( "This test needs the exif extension." );
39 $filename = $this->mediaPath
. 'exif-user-comment.jpg';
40 $seg = JpegMetadataExtractor
::segmentSplitter( $filename );
41 $exif = new Exif( $filename, $seg['byteOrder'] );
42 $data = $exif->getFilteredData();
45 'UserComment' => 'testâcomment'
47 $this->assertEquals( $expected, $data );