diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2009-01-20 10:50:42 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2009-01-20 10:50:42 +0000 |
commit | 5b619326b8c725be88d1b19c4d0719b6fd0da096 (patch) | |
tree | 2d23db04b57b757a1bdc28938bd7d62f4e422fb3 /tests/labeled_axis_test.php | |
parent | d23dd4b60242ffb23dbd0d294e7cef3bcdac6aff (diff) | |
download | zetacomponents-graph-5b619326b8c725be88d1b19c4d0719b6fd0da096.zip zetacomponents-graph-5b619326b8c725be88d1b19c4d0719b6fd0da096.tar.gz |
- Implemented feature #11980: Provide an initial array with labels for labeled
axis
Diffstat (limited to 'tests/labeled_axis_test.php')
-rw-r--r-- | tests/labeled_axis_test.php | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/labeled_axis_test.php b/tests/labeled_axis_test.php index 81bea21..d3b9cd5 100644 --- a/tests/labeled_axis_test.php +++ b/tests/labeled_axis_test.php @@ -404,6 +404,72 @@ class ezcGraphLabeledAxisTest extends ezcGraphTestCase ); } + public function testProvidedLabelsIdentity() + { + $chart = new ezcGraphLineChart(); + $chart->xAxis->provideLabels( array( 2000, 2001, 2002 ) ); + $chart->data['sample'] = new ezcGraphArrayDataSet( array( + 2000 => 42, + 2001 => 23, + 2002 => 5, + ) ); + $chart->render( 500, 200 ); + + $this->assertEquals( + array( + 2000, + 2001, + 2002, + ), + $this->readAttribute( $chart->xAxis, 'displayedLabels' ) + ); + } + + public function testProvidedLabelsReordered() + { + $chart = new ezcGraphLineChart(); + $chart->xAxis->provideLabels( array( 2002, 2001, 2000 ) ); + $chart->data['sample'] = new ezcGraphArrayDataSet( array( + 2000 => 42, + 2001 => 23, + 2002 => 5, + ) ); + $chart->render( 500, 200 ); + + $this->assertEquals( + array( + 2002, + 2001, + 2000, + ), + $this->readAttribute( $chart->xAxis, 'displayedLabels' ) + ); + } + + public function testProvidedLabelsAdditionalLabels() + { + $chart = new ezcGraphLineChart(); + $chart->xAxis->provideLabels( array( 2000, 2001, 2003, 2004, 2005 ) ); + $chart->data['sample'] = new ezcGraphArrayDataSet( array( + 2001 => 23, + 2002 => 5, + 2004 => 42, + ) ); + $chart->render( 500, 200 ); + + $this->assertEquals( + array( + 2000, + 2001, + 2002, + 2003, + 2004, + 2005, + ), + $this->readAttribute( $chart->xAxis, 'displayedLabels' ) + ); + } + public function testGetLabel() { $chart = new ezcGraphLineChart(); |