summaryrefslogtreecommitdiffstats
path: root/tests/dataset_average_test.php
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2008-02-05 10:25:23 +0000
committerKore Nordmann <github@kore-nordmann.de>2008-02-05 10:25:23 +0000
commit32504bf13da10bbda578708e8842a9a29fc21163 (patch)
tree0ef01c08197afe0be435761123d5729d97e03d8b /tests/dataset_average_test.php
parent11eb99389f0de210139e9282b7bbfd067e91ed74 (diff)
downloadzetacomponents-graph-32504bf13da10bbda578708e8842a9a29fc21163.zip
zetacomponents-graph-32504bf13da10bbda578708e8842a9a29fc21163.tar.gz
- Fixed issue #12483: Average dataset does not work with a single value.
Diffstat (limited to 'tests/dataset_average_test.php')
-rw-r--r--tests/dataset_average_test.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/dataset_average_test.php b/tests/dataset_average_test.php
index 5c05315..80394a6 100644
--- a/tests/dataset_average_test.php
+++ b/tests/dataset_average_test.php
@@ -58,6 +58,37 @@ class ezcGraphDataSetAverageTest extends ezcGraphTestCase
);
}
+ public function testCreateDatasetFromSingleElementDataset()
+ {
+ $arrayDataSet = new ezcGraphArrayDataSet( array( 1 => 1 ) );
+
+ $averageDataSet = new ezcGraphDataSetAveragePolynom( $arrayDataSet );
+
+ $polynom = $averageDataSet->getPolynom();
+
+ $this->assertEquals(
+ '1',
+ $polynom->__toString()
+ );
+ }
+
+ public function testCreateDatasetFromSingleElementDatasetRender()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.svg';
+
+ $chart = new ezcGraphLineChart();
+
+ $chart->data['src'] = new ezcGraphArrayDataSet( array( 1 => 1 ) );
+ $chart->data['avg'] = new ezcGraphDataSetAveragePolynom( $chart->data['src'] );
+
+ $chart->render( 500, 200, $filename );
+
+ $this->compare(
+ $filename,
+ $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg'
+ );
+ }
+
public function testCreateDatasetFromDataset2()
{
$arrayDataSet = new ezcGraphArrayDataSet( array( -1 => 2, 1 => 2, 3 => 10 ) );
OpenPOWER on IntegriCloud