Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / includes / media / ExifTest.php
blob7b5e65381b06e4538ddd66cd43aec0625947ce2b
1 <?php
3 use MediaWiki\MainConfigNames;
5 /**
6 * @group Media
7 * @covers \Exif
8 * @requires extension exif
9 */
10 class ExifTest extends MediaWikiIntegrationTestCase {
11 private const FILE_PATH = __DIR__ . '/../../data/media/';
13 protected function setUp(): void {
14 parent::setUp();
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();
24 $expected = [
25 'GPSLatitude' => 88.5180555556,
26 'GPSLongitude' => -21.12357,
27 'GPSAltitude' => -3.141592653,
28 'GPSDOP' => '5/1',
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();
40 $expected = [
41 'UserComment' => 'test⁔comment',
43 $this->assertEquals( $expected, $data );