Apply EXIF rotation to X-Content-Dimensions
[lhc/web/wiklou.git] / tests / phpunit / includes / media / XContentDimensionsTest.php
1 <?php
2
3 /**
4 * @group Media
5 */
6 class XContentDimensionsTest extends MediaWikiMediaTestCase {
7 /**
8 * @param string $filename
9 * @param string $expectedXContentDimensions
10 * @dataProvider provideGetContentHeaders
11 * @covers File::getContentHeaders
12 */
13 public function testGetContentHeaders( $filename, $expectedXContentDimensions ) {
14 $file = $this->dataFile( $filename );
15 $headers = $file->getContentHeaders();
16 $this->assertEquals( true, isset( $headers['X-Content-Dimensions'] ) );
17 $this->assertEquals( $headers['X-Content-Dimensions'], $expectedXContentDimensions );
18 }
19
20 public static function provideGetContentHeaders() {
21 return [
22 [ '80x60-2layers.xcf', '80x60:1' ],
23 [ 'animated.gif', '45x30:1' ],
24 [ 'landscape-plain.jpg', '1024x768:1' ],
25 [ 'portrait-rotated.jpg', '768x1024:1' ],
26 [ 'Wikimedia-logo.svg', '1024x1024:1' ],
27 [ 'webp_animated.webp', '300x225:1' ],
28 [ 'test.tiff', '20x20:1' ],
29 ];
30 }
31 }