From d9022f63880ce039446fba8364f68e656b7bf4cb Mon Sep 17 00:00:00 2001
From: Pierre Schmitz <pierre@archlinux.de>
Date: Thu, 3 May 2012 13:01:35 +0200
Subject: Update to MediaWiki 1.19.0

---
 tests/phpunit/includes/media/BitmapScalingTest.php | 25 +++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

(limited to 'tests/phpunit/includes/media/BitmapScalingTest.php')

diff --git a/tests/phpunit/includes/media/BitmapScalingTest.php b/tests/phpunit/includes/media/BitmapScalingTest.php
index 5bcd3232..11d9dc47 100644
--- a/tests/phpunit/includes/media/BitmapScalingTest.php
+++ b/tests/phpunit/includes/media/BitmapScalingTest.php
@@ -3,13 +3,16 @@
 class BitmapScalingTest extends MediaWikiTestCase {
 
 	function setUp() {
-		global $wgMaxImageArea;
+		global $wgMaxImageArea, $wgCustomConvertCommand;
 		$this->oldMaxImageArea = $wgMaxImageArea;
+		$this->oldCustomConvertCommand = $wgCustomConvertCommand;
 		$wgMaxImageArea = 1.25e7; // 3500x3500 
+		$wgCustomConvertCommand = 'dummy'; // Set so that we don't get client side rendering
 	}
 	function tearDown() {
-		global $wgMaxImageArea;
+		global $wgMaxImageArea, $wgCustomConvertCommand;
 		$wgMaxImageArea = $this->oldMaxImageArea;
+		$wgCustomConvertCommand = $this->oldCustomConvertCommand;
 	}
 	/**
 	 * @dataProvider provideNormaliseParams
@@ -105,14 +108,22 @@ class BitmapScalingTest extends MediaWikiTestCase {
 		$file = new FakeDimensionFile( array( 4000, 4000 ) );
 		$handler = new BitmapHandler;
 		$params = array( 'width' => '3700' ); // Still bigger than max size.
-		$this->assertFalse( $handler->normaliseParams( $file, $params ) );
+		$this->assertEquals( 'TransformParameterError', 
+			get_class( $handler->doTransform( $file, 'dummy path', '', $params ) ) );
 	}
 	function testTooBigMustRenderImage() {
 		$file = new FakeDimensionFile( array( 4000, 4000 ) );
 		$file->mustRender = true;
 		$handler = new BitmapHandler;
 		$params = array( 'width' => '5000' ); // Still bigger than max size.
-		$this->assertFalse( $handler->normaliseParams( $file, $params ) );
+		$this->assertEquals( 'TransformParameterError', 
+			get_class( $handler->doTransform( $file, 'dummy path', '', $params ) ) );
+	}
+	
+	function testImageArea() {
+		$file = new FakeDimensionFile( array( 7, 9 ) );
+		$handler = new BitmapHandler;
+		$this->assertEquals( 63, $handler->getImageArea( $file ) );
 	}
 }
 
@@ -120,7 +131,8 @@ class FakeDimensionFile extends File {
 	public $mustRender = false;
 
 	public function __construct( $dimensions ) {
-		parent::__construct( Title::makeTitle( NS_FILE, 'Test' ), null );
+		parent::__construct( Title::makeTitle( NS_FILE, 'Test' ), 
+			new NullRepo( null ) );
 		
 		$this->dimensions = $dimensions;
 	}
@@ -133,4 +145,7 @@ class FakeDimensionFile extends File {
 	public function mustRender() {
 		return $this->mustRender;
 	}
+	public function getPath() {
+		return '';
+	}
 }
-- 
cgit v1.2.3-54-g00ecf