aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/media/Jpeg2000HandlerTest.php
blob: 089975d28d664e9008bab7d70871e05676d82678 (plain) (blame)
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
<?php

/**
 * @covers \Jpeg2000Handler
 */
class Jpeg2000HandlerTest extends MediaWikiIntegrationTestCase {

	/**
	 * @dataProvider provideTestGetSizeAndMetadata
	 */
	public function testGetSizeAndMetadata( $path, $expectedResult ) {
		$handler = new Jpeg2000Handler();
		$this->assertEquals( $expectedResult, $handler->getSizeAndMetadata(
			new TrivialMediaHandlerState, $path ) );
	}

	public static 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__, [] ],
		];
	}
}