diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2007-09-05 08:50:23 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2007-09-05 08:50:23 +0000 |
commit | d0370fe7c59d1a70c527c413389679b1d42bab10 (patch) | |
tree | c27888abb8b22ef28d51037269a8909947e4937b /tests/pie_test.php | |
parent | 59192857ba65c14388bbe5b1633a4f1ac346e9d1 (diff) | |
download | zetacomponents-graph-d0370fe7c59d1a70c527c413389679b1d42bab10.zip zetacomponents-graph-d0370fe7c59d1a70c527c413389679b1d42bab10.tar.gz |
- Implemented feature #11325: Allow values of 0 to be added to pie charts, to
be included in the legend and not rendered in the actual pie.
Diffstat (limited to 'tests/pie_test.php')
-rw-r--r-- | tests/pie_test.php | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/tests/pie_test.php b/tests/pie_test.php index bd276a7..b0ce0a9 100644 --- a/tests/pie_test.php +++ b/tests/pie_test.php @@ -394,12 +394,12 @@ class ezcGraphPieChartTest extends ezcGraphTestCase $chart->render( 400, 200 ); } - public function testInavlidValues() + public function testInvalidValues() { try { $chart = new ezcGraphPieChart(); - $chart->data['Skien'] = new ezcGraphArrayDataSet( array() ); + $chart->data['Skien'] = new ezcGraphArrayDataSet( array( 3, -1, 2 ) ); $chart->render( 500, 200 ); } catch ( ezcGraphInvalidDataException $e ) @@ -410,12 +410,12 @@ class ezcGraphPieChartTest extends ezcGraphTestCase $this->fail( 'Expected ezcGraphInvalidDataException.' ); } - public function testInvalidValues() + public function testInvalidValueSum() { try { $chart = new ezcGraphPieChart(); - $chart->data['Skien'] = new ezcGraphArrayDataSet( array() ); + $chart->data['Skien'] = new ezcGraphArrayDataSet( array( 0, 0 ) ); $chart->render( 500, 200 ); } catch ( ezcGraphInvalidDataException $e ) @@ -479,6 +479,22 @@ class ezcGraphPieChartTest extends ezcGraphTestCase ); } + public function testRenderPieChartWithZeroValues() + { + $filename = $this->tempDir . __FUNCTION__ . '.svg'; + + $chart = new ezcGraphPieChart(); + $chart->data['Skien'] = new ezcGraphArrayDataSet( array( 'Norwegian' => 10, 'Dutch' => 3, 'German' => 2, 'French' => 2, 'Hindi' => 1, 'Taiwanese' => 0, 'Brazilian' => 1, 'Venezuelan' => 0, 'Japanese' => 1, 'Czech' => 0, 'Hungarian' => 1, 'Romanian' => 1 ) ); + $chart->data['Skien']->highlight['Norwegian'] = true; + + $chart->render( 500, 200, $filename ); + + $this->compare( + $filename, + $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg' + ); + } + public function testRenderPieChartWithLotsOfLabels() { $filename = $this->tempDir . __FUNCTION__ . '.svg'; |