3 use MediaWiki\MainConfigNames
;
8 * @requires extension exif
10 class ExifTest
extends MediaWikiIntegrationTestCase
{
11 private const FILE_PATH
= __DIR__
. '/../../data/media/';
13 protected function setUp(): void
{
16 $this->overrideConfigValue( MainConfigNames
::ShowEXIF
, true );
19 public function testGPSExtraction() {
20 $filename = self
::FILE_PATH
. 'exif-gps.jpg';
21 $seg = JpegMetadataExtractor
::segmentSplitter( $filename );
22 $exif = new Exif( $filename, $seg['byteOrder'] );
23 $data = $exif->getFilteredData();
25 'GPSLatitude' => 88.5180555556,
26 'GPSLongitude' => -21.12357,
27 'GPSAltitude' => -3.141592653,
29 'GPSVersionID' => '2.2.0.0',
31 $this->assertEqualsWithDelta( $expected, $data, 0.0000000001 );
34 public function testUnicodeUserComment() {
35 $filename = self
::FILE_PATH
. 'exif-user-comment.jpg';
36 $seg = JpegMetadataExtractor
::segmentSplitter( $filename );
37 $exif = new Exif( $filename, $seg['byteOrder'] );
38 $data = $exif->getFilteredData();
41 'UserComment' => 'testâcomment',
43 $this->assertEquals( $expected, $data );