summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/media/PNGMetadataExtractorTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/includes/media/PNGMetadataExtractorTest.php')
-rw-r--r--tests/phpunit/includes/media/PNGMetadataExtractorTest.php48
1 files changed, 31 insertions, 17 deletions
diff --git a/tests/phpunit/includes/media/PNGMetadataExtractorTest.php b/tests/phpunit/includes/media/PNGMetadataExtractorTest.php
index 1b1b2ec3..939f2cfc 100644
--- a/tests/phpunit/includes/media/PNGMetadataExtractorTest.php
+++ b/tests/phpunit/includes/media/PNGMetadataExtractorTest.php
@@ -1,13 +1,21 @@
<?php
+
+/**
+ * @todo covers tags
+ */
class PNGMetadataExtractorTest extends MediaWikiTestCase {
- function setUp() {
+ protected function setUp() {
+ parent::setUp();
$this->filePath = __DIR__ . '/../../data/media/';
}
+
/**
- * Tests zTXt tag (compressed textual metadata)
+ * Tests zTXt tag (compressed textual metadata)
*/
- function testPngNativetZtxt() {
+ public function testPngNativetZtxt() {
+ $this->checkPHPExtension( 'zlib' );
+
$meta = PNGMetadataExtractor::getMetadata( $this->filePath .
'Png-native-test.png' );
$expected = "foo bar baz foo foo foo foof foo foo foo foo";
@@ -22,7 +30,7 @@ class PNGMetadataExtractorTest extends MediaWikiTestCase {
/**
* Test tEXt tag (Uncompressed textual metadata)
*/
- function testPngNativeText() {
+ public function testPngNativeText() {
$meta = PNGMetadataExtractor::getMetadata( $this->filePath .
'Png-native-test.png' );
$expected = "Some long image desc";
@@ -39,7 +47,7 @@ class PNGMetadataExtractorTest extends MediaWikiTestCase {
* tEXt tags must be encoded iso-8859-1 (vs iTXt which are utf-8)
* Make sure non-ascii characters get converted properly
*/
- function testPngNativeTextNonAscii() {
+ public function testPngNativeTextNonAscii() {
$meta = PNGMetadataExtractor::getMetadata( $this->filePath .
'Png-native-test.png' );
@@ -48,7 +56,6 @@ class PNGMetadataExtractorTest extends MediaWikiTestCase {
// encoded as just \xA9.
$expected = "© 2010 Bawolff";
-
$this->assertArrayHasKey( 'text', $meta );
$meta = $meta['text'];
$this->assertArrayHasKey( 'Copyright', $meta );
@@ -60,7 +67,9 @@ 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 () {
+ */
+ /*
+ public function testPngPhysTag() {
$meta = PNGMetadataExtractor::getMetadata( $this->filePath .
'Png-native-test.png' );
@@ -71,11 +80,12 @@ 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.
*/
- function testStaticPngAnimationMetadata() {
+ public function testStaticPngAnimationMetadata() {
$meta = PNGMetadataExtractor::getMetadata( $this->filePath .
'Png-native-test.png' );
@@ -88,7 +98,7 @@ class PNGMetadataExtractorTest extends MediaWikiTestCase {
* Given an animated APNG image file
* check it gets animated metadata right.
*/
- function testApngAnimationMetadata() {
+ public function testApngAnimationMetadata() {
$meta = PNGMetadataExtractor::getMetadata( $this->filePath .
'Animated_PNG_example_bouncing_beach_ball.png' );
@@ -98,44 +108,48 @@ class PNGMetadataExtractorTest extends MediaWikiTestCase {
$this->assertEquals( 1.5, $meta['duration'], '', 0.00001 );
}
- function testPngBitDepth8() {
+ public function testPngBitDepth8() {
$meta = PNGMetadataExtractor::getMetadata( $this->filePath .
'Png-native-test.png' );
$this->assertEquals( 8, $meta['bitDepth'] );
}
- function testPngBitDepth1() {
+
+ public function testPngBitDepth1() {
$meta = PNGMetadataExtractor::getMetadata( $this->filePath .
'1bit-png.png' );
$this->assertEquals( 1, $meta['bitDepth'] );
}
- function testPngIndexColour() {
+ public function testPngIndexColour() {
$meta = PNGMetadataExtractor::getMetadata( $this->filePath .
'Png-native-test.png' );
$this->assertEquals( 'index-coloured', $meta['colorType'] );
}
- function testPngRgbColour() {
+
+ public function testPngRgbColour() {
$meta = PNGMetadataExtractor::getMetadata( $this->filePath .
'rgb-png.png' );
$this->assertEquals( 'truecolour-alpha', $meta['colorType'] );
}
- function testPngRgbNoAlphaColour() {
+
+ public function testPngRgbNoAlphaColour() {
$meta = PNGMetadataExtractor::getMetadata( $this->filePath .
'rgb-na-png.png' );
$this->assertEquals( 'truecolour', $meta['colorType'] );
}
- function testPngGreyscaleColour() {
+
+ public function testPngGreyscaleColour() {
$meta = PNGMetadataExtractor::getMetadata( $this->filePath .
'greyscale-png.png' );
$this->assertEquals( 'greyscale-alpha', $meta['colorType'] );
}
- function testPngGreyscaleNoAlphaColour() {
+
+ public function testPngGreyscaleNoAlphaColour() {
$meta = PNGMetadataExtractor::getMetadata( $this->filePath .
'greyscale-na-png.png' );
$this->assertEquals( 'greyscale', $meta['colorType'] );
}
-
}