Fix issues identified by SpaceBeforeSingleLineComment sniff
[lhc/web/wiklou.git] / tests / phpunit / includes / media / PNGTest.php
index 092be89..5f1f6ca 100644 (file)
@@ -93,7 +93,7 @@ class PNGHandlerTest extends MediaWikiMediaTestCase {
        public function testGetMetadata( $filename, $expected ) {
                $file = $this->dataFile( $filename, 'image/png' );
                $actual = $this->handler->getMetadata( $file, "$this->filePath/$filename" );
-//             $this->assertEquals( unserialize( $expected ), unserialize( $actual ) );
+//             $this->assertEquals( unserialize( $expected ), unserialize( $actual ) );
                $this->assertEquals( ( $expected ), ( $actual ) );
        }
 
@@ -118,7 +118,7 @@ class PNGHandlerTest extends MediaWikiMediaTestCase {
                $this->assertEquals( $expected, $actual );
        }
 
-       public function provideGetIndependentMetaArray() {
+       public static function provideGetIndependentMetaArray() {
                return array(
                        array( 'rgb-na-png.png', array() ),
                        array( 'xmp.png',
@@ -128,4 +128,24 @@ class PNGHandlerTest extends MediaWikiMediaTestCase {
                        ),
                );
        }
+
+       /**
+        * @param $filename string
+        * @param $expectedLength float
+        * @dataProvider provideGetLength
+        */
+       public function testGetLength( $filename, $expectedLength ) {
+               $file = $this->dataFile( $filename, 'image/png' );
+               $actualLength = $file->getLength();
+               $this->assertEquals( $expectedLength, $actualLength, '', 0.00001 );
+       }
+
+       public function provideGetLength() {
+               return array(
+                       array( 'Animated_PNG_example_bouncing_beach_ball.png', 1.5 ),
+                       array( 'Png-native-test.png', 0.0 ),
+                       array( 'greyscale-png.png', 0.0 ),
+                       array( '1bit-png.png', 0.0 ),
+               );
+       }
 }