3 use MediaWiki\MainConfigNames
;
7 * @requires extension exif
9 class TiffTest
extends MediaWikiIntegrationTestCase
{
10 private const FILE_PATH
= __DIR__
. '/../../data/media/';
12 /** @var TiffHandler */
15 protected function setUp(): void
{
18 $this->overrideConfigValue( MainConfigNames
::ShowEXIF
, true );
20 $this->handler
= new TiffHandler
;
24 * @covers \TiffHandler::getSizeAndMetadata
26 public function testInvalidFile() {
27 $res = $this->handler
->getSizeAndMetadata( null, self
::FILE_PATH
. 'README' );
28 $this->assertEquals( [ 'metadata' => [ '_error' => ExifBitmapHandler
::BROKEN_FILE
] ], $res );
32 * @covers \TiffHandler::getSizeAndMetadata
34 public function testTiffMetadataExtraction() {
35 $res = $this->handler
->getSizeAndMetadata( null, self
::FILE_PATH
. 'test.tiff' );
49 'PhotometricInterpretation' => 2,
50 'ImageDescription' => 'Created with GIMP',
53 'SamplesPerPixel' => 3,
55 'StripByteCounts' => 238,
56 'XResolution' => '1207959552/16777216',
57 'YResolution' => '1207959552/16777216',
58 'PlanarConfiguration' => 1,
59 'ResolutionUnit' => 2,
60 'MEDIAWIKI_EXIF_VERSION' => 2,
64 // Re-unserialize in case there are subtle differences between how versions
65 // of php serialize stuff.
66 $this->assertEquals( $expected, $res );