http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97656

Revision: 97656
Author:   brion
Date:     2011-09-20 19:39:17 +0000 (Tue, 20 Sep 2011)
Log Message:
-----------
Further tweaks to r96687, r90016, r97398 etc tests: actually produce a 
thumbnail and check its size as well. Confirms that we're handling bounding 
boxes incorrectly.

Modified Paths:
--------------
    trunk/phase3/tests/phpunit/includes/media/ExifRotationTest.php

Modified: trunk/phase3/tests/phpunit/includes/media/ExifRotationTest.php
===================================================================
--- trunk/phase3/tests/phpunit/includes/media/ExifRotationTest.php      
2011-09-20 19:31:26 UTC (rev 97655)
+++ trunk/phase3/tests/phpunit/includes/media/ExifRotationTest.php      
2011-09-20 19:39:17 UTC (rev 97656)
@@ -9,6 +9,11 @@
                parent::setUp();
                $this->filePath = dirname( __FILE__ ) . '/../../data/media/';
                $this->handler = new BitmapHandler();
+               $this->repo = new FSRepo(array(
+                       'name' => 'temp',
+                       'directory' => wfTempDir() . '/exif-test-' . time(),
+                       'url' => 'http://localhost/thumbtest'
+               ));
                if ( !wfDl( 'exif' ) ) {
                        $this->markTestSkipped( "This test needs the exif 
extension." );
                }
@@ -31,6 +36,29 @@
                $this->assertEquals( $file->getHeight(), $info['height'], 
"$name: height check" );
        }
 
+       /**
+        *
+        * @dataProvider providerFiles
+        */
+       function testRotationRendering( $name, $type, $info ) {
+               $file = $this->localFile( $name, $type );
+               $thumb = $file->transform( array(
+                       'width' => 800,
+                       'height' => 600,
+               ), File::RENDER_NOW );
+
+               $this->assertEquals( $thumb->getWidth(), $info['thumbWidth'], 
"$name: thumb reported width check" );
+               $this->assertEquals( $thumb->getHeight(), $info['thumbHeight'], 
"$name: thumb reported height check" );
+
+               $gis = getimagesize( $thumb->getPath() );
+               $this->assertEquals( $gis[0], $info['thumbWidth'], "$name: 
thumb actual width check");
+               $this->assertEquals( $gis[0], $info['thumbWidth'], "$name: 
thumb actual height check");
+       }
+
+       private function localFile( $name, $type ) {
+               return new UnregisteredLocalFile( false, $this->repo, 
$this->filePath . $name, $type );
+       }
+
        function providerFiles() {
                return array(
                        array(
@@ -39,6 +67,8 @@
                                array(
                                        'width' => 1024,
                                        'height' => 768,
+                                       'thumbWidth' => 800,
+                                       'thumbHeight' => 600,
                                )
                        ),
                        array(
@@ -47,6 +77,8 @@
                                array(
                                        'width' => 768, // as rotated
                                        'height' => 1024, // as rotated
+                                       'thumbWidth' => 450,
+                                       'thumbHeight' => 600,
                                )
                        )
                );


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to