diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-06-14 15:34:12 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-06-14 15:34:12 +0000 |
commit | ccd7c75ecbaa8f13af316b14d7a4162b6a54819d (patch) | |
tree | 3617484fa52c3552aad97845f787c5ffbc43f487 /tests | |
parent | 67864e582b01d121626bb3f9b60b45b7181bb1b7 (diff) | |
download | zetacomponents-graph-ccd7c75ecbaa8f13af316b14d7a4162b6a54819d.zip zetacomponents-graph-ccd7c75ecbaa8f13af316b14d7a4162b6a54819d.tar.gz |
- Add possibility to use filled line charts
Diffstat (limited to 'tests')
-rw-r--r-- | tests/line_test.php | 80 |
1 files changed, 79 insertions, 1 deletions
diff --git a/tests/line_test.php b/tests/line_test.php index 7f32ff0..28fae16 100644 --- a/tests/line_test.php +++ b/tests/line_test.php @@ -99,7 +99,7 @@ class ezcGraphLineChartTest extends ezcTestCase public function testRenderChartLines() { $chart = ezcGraph::create( 'Line' ); - $chart->sampleData = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1); + $chart->sampleData = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1 ); $chart->sampleData->color = '#CC0000'; $chart->sampleData->symbol = ezcGraph::DIAMOND; @@ -149,6 +149,84 @@ class ezcGraphLineChartTest extends ezcTestCase $chart->render( 500, 200 ); } + public function testRenderChartFilledLines() + { + $chart = ezcGraph::create( 'Line' ); + $chart->sampleData = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => -46, 'sample 4' => 120 ); + $chart->palette = 'Black'; + $chart->options->fillLines = 100; + + $mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array( + 'drawPolygon', + ) ); + + $mockedRenderer + ->expects( $this->at( 2 ) ) + ->method( 'drawPolygon' ) + ->with( + $this->equalTo( array( + new ezcGraphCoordinate( 120, 40 ), + new ezcGraphCoordinate( 240, 136 ), + new ezcGraphCoordinate( 240, 145 ), + new ezcGraphCoordinate( 120, 145 ), + ) ), + $this->equalTo( ezcGraphColor::fromHex( '#3465A464' ) ), + $this->equalTo( true ) + ); + $mockedRenderer + ->expects( $this->at( 3 ) ) + ->method( 'drawPolygon' ) + ->with( + $this->equalTo( array( + new ezcGraphCoordinate( 240, 136 ), + new ezcGraphCoordinate( 276, 145 ), + new ezcGraphCoordinate( 240, 145 ), + ) ), + $this->equalTo( ezcGraphColor::fromHex( '#3465A464' ) ), + $this->equalTo( true ) + ); + $mockedRenderer + ->expects( $this->at( 4 ) ) + ->method( 'drawPolygon' ) + ->with( + $this->equalTo( array( + new ezcGraphCoordinate( 360, 166 ), + new ezcGraphCoordinate( 276, 145 ), + new ezcGraphCoordinate( 360, 145 ), + ) ), + $this->equalTo( ezcGraphColor::fromHex( '#3465A464' ) ), + $this->equalTo( true ) + ); + $mockedRenderer + ->expects( $this->at( 5 ) ) + ->method( 'drawPolygon' ) + ->with( + $this->equalTo( array( + new ezcGraphCoordinate( 360, 166 ), + new ezcGraphCoordinate( 394, 145 ), + new ezcGraphCoordinate( 360, 145 ), + ) ), + $this->equalTo( ezcGraphColor::fromHex( '#3465A464' ) ), + $this->equalTo( true ) + ); + $mockedRenderer + ->expects( $this->at( 6 ) ) + ->method( 'drawPolygon' ) + ->with( + $this->equalTo( array( + new ezcGraphCoordinate( 480, 91 ), + new ezcGraphCoordinate( 394, 145 ), + new ezcGraphCoordinate( 480, 145 ), + ) ), + $this->equalTo( ezcGraphColor::fromHex( '#3465A464' ) ), + $this->equalTo( true ) + ); + + $chart->renderer = $mockedRenderer; + + $chart->render( 500, 200 ); + } + public function testRenderChartLinesModifiedThickness() { $chart = ezcGraph::create( 'Line' ); |