[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gallery-checkins
Subject:    [Gallery-checkins] gallery2/modules/gd/test/phpunit GdToolkitTest.class,1.8,1.9 TestGdFunctionality.
From:       Ernesto Baschny <baschny () users ! sourceforge ! net>
Date:       2004-10-28 11:12:41
Message-ID: E1CN8Cv-0001x9-HS () sc8-pr-cvs1 ! sourceforge ! net
[Download RAW message or body]

Update of /cvsroot/gallery/gallery2/modules/gd/test/phpunit
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7489/test/phpunit

Modified Files:
	GdToolkitTest.class TestGdFunctionality.class 
Log Message:
* Composite operation in GD module should preserve alpha transparency on PNG-24 now

Index: GdToolkitTest.class
===================================================================
RCS file: /cvsroot/gallery/gallery2/modules/gd/test/phpunit/GdToolkitTest.class,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- GdToolkitTest.class	22 Oct 2004 05:34:00 -0000	1.8
+++ GdToolkitTest.class	28 Oct 2004 11:12:38 -0000	1.9
@@ -46,6 +46,8 @@
      */
     var $_gdEnvironments;
     var $_toolkit;
+
+    var $_oldBase;
     
     function GdToolkitTest($methodName) {
 	$this->GalleryTestCase($methodName);
@@ -78,6 +80,10 @@
 		return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
 	    }
 	}
+
+	/* Watermarks are relative to data.gallery.base */
+	$this->_oldBase = $gallery->getConfig('data.gallery.base');
+	$gallery->setConfig('data.gallery.base', '/valid/');
 	
 	/* Get a toolkit to work with */
 	$this->_toolkit = new GdToolkit();
@@ -97,6 +103,8 @@
 	    }
 	}
 
+	$gallery->setConfig('data.gallery.base', $this->_oldBase);
+
 	parent::tearDown();
     }
 
@@ -150,7 +158,9 @@
 			return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
 		    }
 		    $this->assertEquals($this->_gdFunctionality->getOutputFileData('/valid/cropped.ext'),
                
-					array('x' => '154', 'y' => '156', 'mimeType' => $mimeType),
+					array('x' => '154', 'y' => '156', 'mimeType' => $mimeType,
+					      'copy' => array('300x300.ext', 0, 0, 74, 71, 154, 156),
+					),
 					'crop dimensions mismatch');
 		}
 		
@@ -165,8 +175,9 @@
 			return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
 		    }
 		    $this->assertEquals($this->_gdFunctionality->getOutputFileData('/valid/rotated.ext'),
                
-					array('x' => '200', 'y' => '300', 'mimeType' => $mimeType));
-		    $this->assertEquals(array('width' => 200, 'height' => 300), $context, \
'context'); +					array('x' => '200', 'y' => '300', 'mimeType' => $mimeType),
+					'rotate');
+		    $this->assertEquals(array('width' => 200, 'height' => 300), $context, \
'rotate-context');  }
 		
 		if (GdToolkitHelper::isOperationSupported('convert-to-image/jpeg', $gd)) {
@@ -179,7 +190,8 @@
 			return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
 		    }
 		    $this->assertEquals($this->_gdFunctionality->getOutputFileData('/valid/converted.jpeg'),
                
-					array('x' => '400', 'y' => '400', 'mimeType' => 'image/jpeg'));
+					array('x' => '400', 'y' => '400', 'mimeType' => 'image/jpeg'),
+					'convert-to-image/jpeg');
 		}
 
 		if (GdToolkitHelper::isOperationSupported('composite', $gd)) {
@@ -196,6 +208,11 @@
 		    if ($ret->isError()) {
 			return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
 		    }
+		    $this->assertEquals($this->_gdFunctionality->getOutputFileData('/valid/composited.ext'),
 +					array('x' => '300', 'y' => '300', 'mimeType' => 'image/jpeg',
+					      'copy' => array('/valid/50x50.ext', '250', '0', '0', '0', '50', '50')
+					),
+					'composite #1 ' . $mimeType);
 		
 		    /* Test another composite with out of range params that should
 		     * get corrected

Index: TestGdFunctionality.class
===================================================================
RCS file: /cvsroot/gallery/gallery2/modules/gd/test/phpunit/TestGdFunctionality.class,v
 retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- TestGdFunctionality.class	5 Sep 2004 07:44:18 -0000	1.2
+++ TestGdFunctionality.class	28 Oct 2004 11:12:39 -0000	1.3
@@ -83,6 +83,7 @@
 	    'trueColor' => false,
 	);
 	if (isset($filename)) {
+	    $this->_resources[$name]['filename'] = $filename;
 	    if (preg_match('/(\d+)x(\d+)\./i', $filename, $matches)) {
 		$this->_resources[$name]['x'] = (int) $matches[1];
 		$this->_resources[$name]['y'] = (int) $matches[2];
@@ -117,6 +118,10 @@
 	    'y' => $this->getResourceData($res, 'y'),
 	    'mimeType' => $mimeType,
 	);
+	$other = $this->getResourceData($res, 'other');
+	if (is_array($other)) {
+	    $this->_outputFiles[$filename] = array_merge($this->_outputFiles[$filename], \
$other); +	}
     }
     function getOutputFileData($filename) {
 	if (! isset($this->_outputFiles[$filename])) {
@@ -406,6 +411,8 @@
 	if (! $this->isValidResource($srcRes) || ! $this->isValidResource($dstRes)) {
 	    return GalleryStatus::error(ERROR_BAD_PARAMETER, __FILE__, __LINE__);
 	}
+	
+	$this->setResourceData($dstRes, 'other', array('copy' => \
array($this->getResourceData($srcRes, 'filename'), $dstX, $dstY, $srcX, $srcY, $srcW, \
$srcH)));  return GalleryStatus::success();
     }
 



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
__[ g a l l e r y - c h e c k i n s ]_________________________

[ list info/archive --> http://gallery.sf.net/lists.php ]
[ gallery info/FAQ/download --> http://gallery.sf.net ]


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic