blob: f3c05fb1bedc3bedb4aa4e4349983f6a99492ad3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<?php
/**
* @group Media
* @covers Exif
*/
class ExifTest extends MediaWikiTestCase {
/** @var string */
protected $mediaPath;
protected function setUp() {
parent::setUp();
$this->checkPHPExtension( 'exif' );
$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 );
}
}
|