summaryrefslogtreecommitdiffstats
path: root/tests/driver_gd_test.php
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-09-19 13:29:02 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-09-19 13:29:02 +0000
commitfe13be6dac3b9a019cd4ee7a4e1b3272ef922871 (patch)
tree3ac7e934fb907911583e4bd4c48aec7dc12bde95 /tests/driver_gd_test.php
parent27cffe45cdf9cc6d36751bcc998459ae9d8a1f4b (diff)
downloadzetacomponents-graph-fe13be6dac3b9a019cd4ee7a4e1b3272ef922871.zip
zetacomponents-graph-fe13be6dac3b9a019cd4ee7a4e1b3272ef922871.tar.gz
- Added background and border to font configuration
- Show value for highlighted datapoints in bar and line charts
Diffstat (limited to 'tests/driver_gd_test.php')
-rw-r--r--tests/driver_gd_test.php156
1 files changed, 156 insertions, 0 deletions
diff --git a/tests/driver_gd_test.php b/tests/driver_gd_test.php
index 45c0382..ee87bc8 100644
--- a/tests/driver_gd_test.php
+++ b/tests/driver_gd_test.php
@@ -1594,6 +1594,162 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$this->fail( 'Expected ezcGraphFontRenderingException.' );
}
+
+ public function testDrawTextWithBackground()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.png';
+
+ $this->driver->options->font->background = ezcGraphColor::fromHex( '#DDDDDD' );
+ $this->driver->options->font->minimizeBorder = false;
+
+ $this->driver->drawTextBox(
+ 'Some test string',
+ new ezcGraphCoordinate( 10, 10 ),
+ 150,
+ 70,
+ ezcGraph::LEFT | ezcGraph::MIDDLE
+ );
+
+ $this->driver->render( $filename );
+
+ $this->assertTrue(
+ file_exists( $filename ),
+ 'No image was generated.'
+ );
+
+ $this->assertImageSimilar(
+ $filename,
+ $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
+ 'Image does not look as expected.',
+ 2000
+ );
+ }
+
+ public function testDrawTextWithBorder()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.png';
+
+ $this->driver->options->font->border = ezcGraphColor::fromHex( '#555555' );
+ $this->driver->options->font->minimizeBorder = false;
+
+ $this->driver->drawTextBox(
+ 'Some test string',
+ new ezcGraphCoordinate( 10, 10 ),
+ 150,
+ 70,
+ ezcGraph::LEFT | ezcGraph::MIDDLE
+ );
+
+ $this->driver->render( $filename );
+
+ $this->assertTrue(
+ file_exists( $filename ),
+ 'No image was generated.'
+ );
+
+ $this->assertImageSimilar(
+ $filename,
+ $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
+ 'Image does not look as expected.',
+ 2000
+ );
+ }
+
+ public function testDrawTextWithMinimizedBorderAndBackgroundTopLeft()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.png';
+
+ $this->driver->options->font->border = ezcGraphColor::fromHex( '#555555' );
+ $this->driver->options->font->background = ezcGraphColor::fromHex( '#DDDDDD' );
+ $this->driver->options->font->minimizeBorder = true;
+ $this->driver->options->font->padding = 2;
+
+ $this->driver->drawTextBox(
+ 'Some test string',
+ new ezcGraphCoordinate( 10, 10 ),
+ 150,
+ 70,
+ ezcGraph::LEFT | ezcGraph::TOP
+ );
+
+ $this->driver->render( $filename );
+
+ $this->assertTrue(
+ file_exists( $filename ),
+ 'No image was generated.'
+ );
+
+ $this->assertImageSimilar(
+ $filename,
+ $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
+ 'Image does not look as expected.',
+ 2000
+ );
+ }
+
+ public function testDrawTextWithMinimizedBorderAndBackgroundMiddleCenter()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.png';
+
+ $this->driver->options->font->border = ezcGraphColor::fromHex( '#555555' );
+ $this->driver->options->font->background = ezcGraphColor::fromHex( '#DDDDDD' );
+ $this->driver->options->font->minimizeBorder = true;
+ $this->driver->options->font->padding = 2;
+
+ $this->driver->drawTextBox(
+ 'Some test string',
+ new ezcGraphCoordinate( 10, 10 ),
+ 150,
+ 70,
+ ezcGraph::CENTER | ezcGraph::MIDDLE
+ );
+
+ $this->driver->render( $filename );
+
+ $this->assertTrue(
+ file_exists( $filename ),
+ 'No image was generated.'
+ );
+
+ $this->assertImageSimilar(
+ $filename,
+ $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
+ 'Image does not look as expected.',
+ 2000
+ );
+ }
+
+ public function testDrawTextWithMinimizedBorderAndBackgroundBottomRight()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.png';
+
+ $this->driver->options->font->border = ezcGraphColor::fromHex( '#555555' );
+ $this->driver->options->font->background = ezcGraphColor::fromHex( '#DDDDDD' );
+ $this->driver->options->font->minimizeBorder = true;
+ $this->driver->options->font->padding = 2;
+
+ $this->driver->drawTextBox(
+ 'Some test string',
+ new ezcGraphCoordinate( 10, 10 ),
+ 150,
+ 70,
+ ezcGraph::RIGHT | ezcGraph::BOTTOM
+ );
+
+ $this->driver->render( $filename );
+
+ $this->assertTrue(
+ file_exists( $filename ),
+ 'No image was generated.'
+ );
+
+ $this->assertImageSimilar(
+ $filename,
+ $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
+ 'Image does not look as expected.',
+ 2000
+ );
+ }
}
?>
OpenPOWER on IntegriCloud