r97656 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97655‎ | r97656 | r97657 >
Date:19:39, 20 September 2011
Author:brion
Status:ok
Tags:
Comment:
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) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/media/ExifRotationTest.php
@@ -9,6 +9,11 @@
1010 parent::setUp();
1111 $this->filePath = dirname( __FILE__ ) . '/../../data/media/';
1212 $this->handler = new BitmapHandler();
 13+ $this->repo = new FSRepo(array(
 14+ 'name' => 'temp',
 15+ 'directory' => wfTempDir() . '/exif-test-' . time(),
 16+ 'url' => 'http://localhost/thumbtest'
 17+ ));
1318 if ( !wfDl( 'exif' ) ) {
1419 $this->markTestSkipped( "This test needs the exif extension." );
1520 }
@@ -31,6 +36,29 @@
3237 $this->assertEquals( $file->getHeight(), $info['height'], "$name: height check" );
3338 }
3439
 40+ /**
 41+ *
 42+ * @dataProvider providerFiles
 43+ */
 44+ function testRotationRendering( $name, $type, $info ) {
 45+ $file = $this->localFile( $name, $type );
 46+ $thumb = $file->transform( array(
 47+ 'width' => 800,
 48+ 'height' => 600,
 49+ ), File::RENDER_NOW );
 50+
 51+ $this->assertEquals( $thumb->getWidth(), $info['thumbWidth'], "$name: thumb reported width check" );
 52+ $this->assertEquals( $thumb->getHeight(), $info['thumbHeight'], "$name: thumb reported height check" );
 53+
 54+ $gis = getimagesize( $thumb->getPath() );
 55+ $this->assertEquals( $gis[0], $info['thumbWidth'], "$name: thumb actual width check");
 56+ $this->assertEquals( $gis[0], $info['thumbWidth'], "$name: thumb actual height check");
 57+ }
 58+
 59+ private function localFile( $name, $type ) {
 60+ return new UnregisteredLocalFile( false, $this->repo, $this->filePath . $name, $type );
 61+ }
 62+
3563 function providerFiles() {
3664 return array(
3765 array(
@@ -39,6 +67,8 @@
4068 array(
4169 'width' => 1024,
4270 'height' => 768,
 71+ 'thumbWidth' => 800,
 72+ 'thumbHeight' => 600,
4373 )
4474 ),
4575 array(
@@ -47,6 +77,8 @@
4878 array(
4979 'width' => 768, // as rotated
5080 'height' => 1024, // as rotated
 81+ 'thumbWidth' => 450,
 82+ 'thumbHeight' => 600,
5183 )
5284 )
5385 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r97659Further tweaks to r96687, r90016, r97398, r97656 etc tests: try several thumb...brion20:04, 20 September 2011
r97671* (bug 6672, 31024) Fixes for handling of images with an EXIF orientation...brion22:13, 20 September 2011
r97675MFT r97651, r97656, r97659 updated test cases for bug 6672, 31024...brion22:40, 20 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r90016Start on test cases for bug 6672 (Exif orientation support), follow up to r79......brion22:13, 13 June 2011
r96687(bug 30640; follow-up r92279) Rotating images was making skewed images...bawolff20:13, 9 September 2011
r97398Follow-up r92635 Make sure the Exif related tests handle not having the Exif ...bawolff01:53, 18 September 2011

Status & tagging log