X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fmedia%2FPNGMetadataExtractorTest.php;h=58d791fdfe5d92d9fad2673af5b2448777d0026c;hb=9cd8ce5034b50a7f1a6570d7a6ac5bbeeb933be4;hp=0260f29f1c59a69d0c162a505120faeb8148cb03;hpb=e8c5b7f35722bb52dbe0e6c7853d3e73df27819e;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/media/PNGMetadataExtractorTest.php b/tests/phpunit/includes/media/PNGMetadataExtractorTest.php index 0260f29f1c..58d791fdfe 100644 --- a/tests/phpunit/includes/media/PNGMetadataExtractorTest.php +++ b/tests/phpunit/includes/media/PNGMetadataExtractorTest.php @@ -5,8 +5,9 @@ class PNGMetadataExtractorTest extends MediaWikiTestCase { parent::setUp(); $this->filePath = __DIR__ . '/../../data/media/'; } + /** - * Tests zTXt tag (compressed textual metadata) + * Tests zTXt tag (compressed textual metadata) */ function testPngNativetZtxt() { $this->checkPHPExtension( 'zlib' ); @@ -51,7 +52,6 @@ class PNGMetadataExtractorTest extends MediaWikiTestCase { // encoded as just \xA9. $expected = "© 2010 Bawolff"; - $this->assertArrayHasKey( 'text', $meta ); $meta = $meta['text']; $this->assertArrayHasKey( 'Copyright', $meta ); @@ -64,8 +64,8 @@ class PNGMetadataExtractorTest extends MediaWikiTestCase { * Test extraction of pHYs tags, which can tell what the * actual resolution of the image is (aka in dots per meter). */ -/* - function testPngPhysTag () { + /* + function testPngPhysTag() { $meta = PNGMetadataExtractor::getMetadata( $this->filePath . 'Png-native-test.png' ); @@ -76,7 +76,7 @@ class PNGMetadataExtractorTest extends MediaWikiTestCase { $this->assertEquals( '2835/100', $meta['YResolution'] ); $this->assertEquals( 3, $meta['ResolutionUnit'] ); // 3 = cm } -*/ + */ /** * Given a normal static PNG, check the animation metadata returned. @@ -110,6 +110,7 @@ class PNGMetadataExtractorTest extends MediaWikiTestCase { $this->assertEquals( 8, $meta['bitDepth'] ); } + function testPngBitDepth1() { $meta = PNGMetadataExtractor::getMetadata( $this->filePath . '1bit-png.png' ); @@ -123,25 +124,28 @@ class PNGMetadataExtractorTest extends MediaWikiTestCase { $this->assertEquals( 'index-coloured', $meta['colorType'] ); } + function testPngRgbColour() { $meta = PNGMetadataExtractor::getMetadata( $this->filePath . 'rgb-png.png' ); $this->assertEquals( 'truecolour-alpha', $meta['colorType'] ); } + function testPngRgbNoAlphaColour() { $meta = PNGMetadataExtractor::getMetadata( $this->filePath . 'rgb-na-png.png' ); $this->assertEquals( 'truecolour', $meta['colorType'] ); } + function testPngGreyscaleColour() { $meta = PNGMetadataExtractor::getMetadata( $this->filePath . 'greyscale-png.png' ); $this->assertEquals( 'greyscale-alpha', $meta['colorType'] ); } + function testPngGreyscaleNoAlphaColour() { $meta = PNGMetadataExtractor::getMetadata( $this->filePath . 'greyscale-na-png.png' ); $this->assertEquals( 'greyscale', $meta['colorType'] ); } - }