80aaac2332551669d7ae2828739f2eaab7c6a28c
2 class ExifTest
extends MediaWikiTestCase
{
4 public function setUp() {
5 $this->mediaPath
= dirname( __FILE__
) . '/../../data/media/';
7 if ( !wfDl( 'exif' ) ) {
8 $this->markTestSkipped( "This test needs the exif extension." );
11 $this->showExif
= $wgShowEXIF;
15 public function tearDown() {
17 $wgShowEXIF = $this->showExif
;
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' => -200,
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 );