diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2014-03-28 05:41:12 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2014-03-28 05:41:12 +0100 |
commit | 9441dde8bfb95277df073717ed7817dced40f948 (patch) | |
tree | ba31c10147e91bda378b77c8cae90c5651af9bfe /tests/phpunit/includes/media/ExifTest.php | |
parent | d417de70fcf39e0a7a15ba780b597914d16ca0f7 (diff) |
Update to MediaWiki 1.22.5
Diffstat (limited to 'tests/phpunit/includes/media/ExifTest.php')
-rw-r--r-- | tests/phpunit/includes/media/ExifTest.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/phpunit/includes/media/ExifTest.php b/tests/phpunit/includes/media/ExifTest.php new file mode 100644 index 00000000..dea36b03 --- /dev/null +++ b/tests/phpunit/includes/media/ExifTest.php @@ -0,0 +1,46 @@ +<?php +class ExifTest extends MediaWikiTestCase { + + /** @var string */ + protected $mediaPath; + + protected function setUp() { + parent::setUp(); + if ( !extension_loaded( 'exif' ) ) { + $this->markTestSkipped( "This test needs the exif extension." ); + } + + $this->mediaPath = __DIR__ . '/../../data/media/'; + + + + $this->setMwGlobals( 'wgShowEXIF', true ); + } + + public function testGPSExtraction() { + $filename = $this->mediaPath . 'exif-gps.jpg'; + $seg = JpegMetadataExtractor::segmentSplitter( $filename ); + $exif = new Exif( $filename, $seg['byteOrder'] ); + $data = $exif->getFilteredData(); + $expected = array( + 'GPSLatitude' => 88.5180555556, + 'GPSLongitude' => -21.12357, + 'GPSAltitude' => -3.141592653, + 'GPSDOP' => '5/1', + 'GPSVersionID' => '2.2.0.0', + ); + $this->assertEquals( $expected, $data, '', 0.0000000001 ); + } + + public function testUnicodeUserComment() { + $filename = $this->mediaPath . 'exif-user-comment.jpg'; + $seg = JpegMetadataExtractor::segmentSplitter( $filename ); + $exif = new Exif( $filename, $seg['byteOrder'] ); + $data = $exif->getFilteredData(); + + $expected = array( + 'UserComment' => 'testâcomment' + ); + $this->assertEquals( $expected, $data ); + } +} |