diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-06-12 07:16:35 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-06-12 07:16:35 +0000 |
commit | e8ef1f3c3429317ef3aaee3dffbb4a6636191554 (patch) | |
tree | 5de8fc5de984182a6f156a9b06e062991f554a78 /tests/renderer_2d_test.php | |
parent | 586b46467247a2fdeb2707ef2f654e0825da2924 (diff) | |
download | zetacomponents-graph-e8ef1f3c3429317ef3aaee3dffbb4a6636191554.zip zetacomponents-graph-e8ef1f3c3429317ef3aaee3dffbb4a6636191554.tar.gz |
- Added tests and implementation for pie segments and rects to the 2d renderer
Diffstat (limited to 'tests/renderer_2d_test.php')
-rw-r--r-- | tests/renderer_2d_test.php | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/tests/renderer_2d_test.php b/tests/renderer_2d_test.php index 8776144..15c3968 100644 --- a/tests/renderer_2d_test.php +++ b/tests/renderer_2d_test.php @@ -190,6 +190,104 @@ class ezcGraphRenderer2dTest extends ezcTestCase ); } + public function testRenderRect() + { + $this->driver + ->expects( $this->once() ) + ->method( 'drawPolygon' ) + ->with( + $this->equalTo( array( + new ezcGraphCoordinate( 100, 100 ), + new ezcGraphCoordinate( 150, 100 ), + new ezcGraphCoordinate( 150, 150 ), + new ezcGraphCoordinate( 100, 150 ), + ) ), + $this->equalTo( ezcGraphColor::fromHex( '#FF0000' ) ), + $this->equalTo( false ), + $this->equalTo( 1 ) + ); + + $this->renderer->drawRect( + ezcGraphColor::fromHex( '#FF0000' ), + new ezcGraphCoordinate( 100, 100 ), + 50, + 50 + ); + } + + public function testRenderThickRect() + { + $this->driver + ->expects( $this->once() ) + ->method( 'drawPolygon' ) + ->with( + $this->equalTo( array( + new ezcGraphCoordinate( 100, 100 ), + new ezcGraphCoordinate( 150, 100 ), + new ezcGraphCoordinate( 150, 150 ), + new ezcGraphCoordinate( 100, 150 ), + ) ), + $this->equalTo( ezcGraphColor::fromHex( '#FF0000' ) ), + $this->equalTo( false ), + $this->equalTo( 2 ) + ); + + $this->renderer->drawRect( + ezcGraphColor::fromHex( '#FF0000' ), + new ezcGraphCoordinate( 100, 100 ), + 50, + 50, + 2 + ); + } + + public function testRenderPieSegment() + { + $this->driver + ->expects( $this->once() ) + ->method( 'drawCircleSector' ) + ->with( + $this->equalTo( new ezcGraphCoordinate( 100, 100 ) ), + $this->equalTo( 200 ), + $this->equalTo( 200 ), + $this->equalTo( 20 ), + $this->equalTo( 124 ), + $this->equalTo( ezcGraphColor::fromHex( '#FF0000' ) ) + ); + + $this->renderer->drawPieSegment( + ezcGraphColor::fromHex( '#FF0000' ), + new ezcGraphCoordinate( 100, 100 ), + 100, + 20, + 124 + ); + } + + public function testRenderPieSegmentMoveOut() + { + $this->driver + ->expects( $this->once() ) + ->method( 'drawCircleSector' ) + ->with( + $this->equalTo( new ezcGraphCoordinate( 95, 100 ) ), + $this->equalTo( 200 ), + $this->equalTo( 200 ), + $this->equalTo( 90 ), + $this->equalTo( 270 ), + $this->equalTo( ezcGraphColor::fromHex( '#FF0000' ) ) + ); + + $this->renderer->drawPieSegment( + ezcGraphColor::fromHex( '#FF0000' ), + new ezcGraphCoordinate( 100, 100 ), + 100, + 90, + 270, + 5 + ); + } + public function testRenderBackground() { $this->driver |