Author: Kore Nordmann
Date: 2006-09-24 11:44:54 +0200 (Sun, 24 Sep 2006)
New Revision: 3550
Log:
- Throw ezcGraphFontRenderingException on too small texts in SVG driver
Modified:
trunk/Graph/src/driver/svg.php
trunk/Graph/tests/driver_svg_test.php
Modified: trunk/Graph/src/driver/svg.php
===================================================================
--- trunk/Graph/src/driver/svg.php 2006-09-23 15:17:58 UTC (rev 3549)
+++ trunk/Graph/src/driver/svg.php 2006-09-24 09:44:54 UTC (rev 3550)
@@ -490,6 +490,11 @@
break;
}
}
+
+ if ( !is_array( $result ) )
+ {
+ throw new ezcGraphFontRenderingException( $string,
$this->options->font->minFontSize, $width, $height );
+ }
$this->options->font->minimalUsedFont = $size;
$this->strings[] = array(
Modified: trunk/Graph/tests/driver_svg_test.php
===================================================================
--- trunk/Graph/tests/driver_svg_test.php 2006-09-23 15:17:58 UTC (rev
3549)
+++ trunk/Graph/tests/driver_svg_test.php 2006-09-24 09:44:54 UTC (rev
3550)
@@ -1124,6 +1124,30 @@
'Expected xml id as return value.'
);
}
+
+ public function testDrawTooLongTextException()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.png';
+
+ try
+ {
+ $this->driver->drawTextBox(
+ 'This is very long text which is not supposed to fit in the
bounding box.',
+ new ezcGraphCoordinate( 10, 10 ),
+ 50,
+ 20,
+ ezcGraph::LEFT
+ );
+
+ $this->driver->render( $filename );
+ }
+ catch ( ezcGraphFontRenderingException $e )
+ {
+ return true;
+ }
+
+ $this->fail( 'Expected ezcGraphFontRenderingException.' );
+ }
}
?>
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components