Author: caefer
Date: 2010-03-23 18:16:18 +0100 (Tue, 23 Mar 2010)
New Revision: 28728

Modified:
   
plugins/sfImageTransformExtraPlugin/trunk/lib/transforms/sfImageAlphaMaskGD.class.php
   
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/transforms/sfImageAlphaMaskGDTest.php
Log:
better code coverage and some never before working code removed

Modified: 
plugins/sfImageTransformExtraPlugin/trunk/lib/transforms/sfImageAlphaMaskGD.class.php
===================================================================
--- 
plugins/sfImageTransformExtraPlugin/trunk/lib/transforms/sfImageAlphaMaskGD.class.php
       2010-03-23 17:05:32 UTC (rev 28727)
+++ 
plugins/sfImageTransformExtraPlugin/trunk/lib/transforms/sfImageAlphaMaskGD.class.php
       2010-03-23 17:16:18 UTC (rev 28728)
@@ -40,7 +40,7 @@
       case 'image/gif':
       case 'image/jpg':
       default:
-        $this->transformDefault($resource);
+        //$this->transformDefault($resource); not yet implemented
     }
     
     return $image;

Modified: 
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/transforms/sfImageAlphaMaskGDTest.php
===================================================================
--- 
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/transforms/sfImageAlphaMaskGDTest.php
       2010-03-23 17:05:32 UTC (rev 28727)
+++ 
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/transforms/sfImageAlphaMaskGDTest.php
       2010-03-23 17:16:18 UTC (rev 28728)
@@ -36,4 +36,37 @@
     $transformation = new sfImageAlphaMaskGD(null, false); 
     $this->assertType('sfImageAlphaMaskGD', $transformation);
   }
+
+  public function testTransform() 
+  {
+    $mask = new 
sfImage(dirname(__FILE__).'/../../../../data/example-resources/masks/pattern.gif');
+    $this->assertType('sfImage', $this->img->alphaMask($mask));
+    $this->assertType('sfImage', $this->img->alphaMask($mask, '#0000FF'));
+  }
+
+  public function testNonPngTransform() 
+  {
+    $mask = new sfImage(dirname(__FILE__).'/../../../../data/caefer.jpg');
+    $this->assertType('sfImage', $this->img->alphaMask($mask));
+  }
+
+  /**
+   * @expectedException InvalidArgumentException
+   */
+  public function testFailedPrepareParameters() 
+  {
+    $parameters = sfImageAlphaMaskGD::prepareParameters($this->img, 
array('mask' => 'masks/doesnotexist.gif'));
+    $this->assertType('sfImage', $parameters['mask']);
+  }
+
+  public function testPrepareParameters() 
+  {
+    $parameters = sfImageAlphaMaskGD::prepareParameters($this->img, 
array('mask' => 'masks/pattern.gif'));
+    $this->assertType('sfImage', $parameters['mask']);
+  }
+
+  protected function setUp()
+  {
+    $this->img = new 
sfImage(dirname(__FILE__).'/../../../../data/example-resources/overlays/logo.png');
+  }
 }

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to