composer: * mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0 The following sniffs now pass and were enabled: * Generic.ControlStructures.InlineControlStructure * MediaWiki.PHPUnit.AssertCount.NotUsed npm: * svgo: 2.3.0 → 2.3.1 * https://npmjs.com/advisories/1754 (CVE-2021-33587) Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @covers Jpeg2000Handler
|
|
*/
|
|
class Jpeg2000HandlerTest extends MediaWikiIntegrationTestCase {
|
|
protected function setUp(): void {
|
|
parent::setUp();
|
|
// Allocated file for testing
|
|
$this->tempFileName = tempnam( wfTempDir(), 'JPEG2000' );
|
|
}
|
|
|
|
protected function tearDown(): void {
|
|
unlink( $this->tempFileName );
|
|
parent::tearDown();
|
|
}
|
|
|
|
/**
|
|
* @dataProvider provideTestGetSizeAndMetadata
|
|
*/
|
|
public function testGetSizeAndMetadata( $path, $expectedResult ) {
|
|
$handler = new Jpeg2000Handler();
|
|
$this->assertEquals( $expectedResult, $handler->getSizeAndMetadata(
|
|
new TrivialMediaHandlerState, $path ) );
|
|
}
|
|
|
|
public function provideTestGetSizeAndMetadata() {
|
|
return [
|
|
[ __DIR__ . '/../../data/media/jpeg2000-lossless.jp2', [
|
|
'width' => 100,
|
|
'height' => 100,
|
|
'bits' => 8,
|
|
] ],
|
|
[ __DIR__ . '/../../data/media/jpeg2000-lossy.jp2', [
|
|
'width' => 100,
|
|
'height' => 100,
|
|
'bits' => 8,
|
|
] ],
|
|
[ __DIR__ . '/../../data/media/jpeg2000-alpha.jp2', [
|
|
'width' => 100,
|
|
'height' => 100,
|
|
'bits' => 8,
|
|
] ],
|
|
[ __DIR__ . '/../../data/media/jpeg2000-profile.jpf', [
|
|
'width' => 100,
|
|
'height' => 100,
|
|
'bits' => 8,
|
|
] ],
|
|
|
|
// Error cases
|
|
[ __FILE__, [] ],
|
|
];
|
|
}
|
|
}
|