diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2007-11-27 11:50:39 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2007-11-27 11:50:39 +0000 |
commit | e5578da0740ae8fa7ff10207fbdd6aa38d7e4233 (patch) | |
tree | 555d8235109c87847a1d4b45bccf251c613be94a | |
parent | 6c55988b401c47a5552e5aa3f11b459dde739306 (diff) | |
download | zetacomponents-graph-e5578da0740ae8fa7ff10207fbdd6aa38d7e4233.zip zetacomponents-graph-e5578da0740ae8fa7ff10207fbdd6aa38d7e4233.tar.gz |
- Test for ezcGraphGdDriverUnsupportedImageTypeException
-rw-r--r-- | src/driver/gd.php | 2 | ||||
-rw-r--r-- | tests/driver_gd_test.php | 23 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/driver/gd.php b/src/driver/gd.php index 1662a1d..be2da37 100644 --- a/src/driver/gd.php +++ b/src/driver/gd.php @@ -1182,6 +1182,8 @@ class ezcGraphGdDriver extends ezcGraphDriver case IMG_JPEG: imagejpeg( $image, $file, $this->options->jpegQuality ); break; + default: + throw new ezcGraphGdDriverUnsupportedImageTypeException( $this->options->imageFormat ); } } } diff --git a/tests/driver_gd_test.php b/tests/driver_gd_test.php index eb44084..c037bda 100644 --- a/tests/driver_gd_test.php +++ b/tests/driver_gd_test.php @@ -121,6 +121,29 @@ class ezcGraphGdDriverTest extends ezcTestImageCase ); } + 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'; |