Author: kn Date: Tue Nov 27 12:50:39 2007 New Revision: 6828 Log: - Test for ezcGraphGdDriverUnsupportedImageTypeException
Modified: trunk/Graph/src/driver/gd.php trunk/Graph/tests/driver_gd_test.php Modified: trunk/Graph/src/driver/gd.php ============================================================================== --- trunk/Graph/src/driver/gd.php [iso-8859-1] (original) +++ trunk/Graph/src/driver/gd.php [iso-8859-1] Tue Nov 27 12:50:39 2007 @@ -1182,6 +1182,8 @@ case IMG_JPEG: imagejpeg( $image, $file, $this->options->jpegQuality ); break; + default: + throw new ezcGraphGdDriverUnsupportedImageTypeException( $this->options->imageFormat ); } } } Modified: trunk/Graph/tests/driver_gd_test.php ============================================================================== --- trunk/Graph/tests/driver_gd_test.php [iso-8859-1] (original) +++ trunk/Graph/tests/driver_gd_test.php [iso-8859-1] Tue Nov 27 12:50:39 2007 @@ -121,6 +121,29 @@ ); } + public function testRenderUnhandledFormat() { + $filename = $this->tempDir . __FUNCTION__ . '.jpeg'; + + $this->driver->options->imageFormat = IMG_GIF; + $this->driver->drawLine( + new ezcGraphCoordinate( 12, 45 ), + new ezcGraphCoordinate( 134, 12 ), + ezcGraphColor::fromHex( '#3465A4' ) + ); + + try + { + $filename = $this->tempDir . __FUNCTION__ . '.jpeg'; + $this->driver->render( $filename ); + } + catch ( ezcGraphGdDriverUnsupportedImageTypeException $e ) + { + return; + } + + $this->fail( 'Expected ezcGraphGdDriverUnsupportedImageTypeException.' ); + } + public function testDrawLine() { $filename = $this->tempDir . __FUNCTION__ . '.png'; -- svn-components mailing list svn-components@lists.ez.no http://lists.ez.no/mailman/listinfo/svn-components