diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2007-09-04 09:53:56 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2007-09-04 09:53:56 +0000 |
commit | 86d31a8b94e881ad6640bd8fd6c450f15fceb96a (patch) | |
tree | 1a84067fa49fb28bddb1d024aec329286f4b0543 /tests | |
parent | 6e5582742fb0e67b71e94e0a9bedc91723c3ef3e (diff) | |
download | zetacomponents-graph-86d31a8b94e881ad6640bd8fd6c450f15fceb96a.zip zetacomponents-graph-86d31a8b94e881ad6640bd8fd6c450f15fceb96a.tar.gz |
- Added dataset properties for axis assignements
# More progress on the way to multiple axis support
Diffstat (limited to 'tests')
-rw-r--r-- | tests/multiple_axis_test.php | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/multiple_axis_test.php b/tests/multiple_axis_test.php index f3878a0..d67231b 100644 --- a/tests/multiple_axis_test.php +++ b/tests/multiple_axis_test.php @@ -135,5 +135,72 @@ class ezcGraphMultipleAxisTest extends ezcTestCase $this->fail( 'Expected ezcBaseValueException.' ); } + + public function testDatasetAxisAssignement() + { + $chart = new ezcGraphLineChart(); + + $chart->options->additionalAxis['marker'] = new ezcGraphChartElementNumericAxis(); + $chart->options->additionalAxis['new base'] = new ezcGraphChartElementLabeledAxis(); + + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => -21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData']->yAxis = $chart->options->additionalAxis['marker']; + $chart->data['sampleData']->xAxis = $chart->options->additionalAxis['new base']; + + $this->assertEquals( + new ezcGraphChartElementNumericAxis(), + $chart->data['sampleData']->yAxis->default, + 'yAxis property should point to a ezcGraphChartElementNumericAxis.' + ); + + $this->assertEquals( + new ezcGraphChartElementLabeledAxis(), + $chart->data['sampleData']->xAxis->default, + 'xAxis property should point to a ezcGraphChartElementLabeledAxis.' + ); + + try + { + $chart->data['sampleData']->yAxis['sample 1'] = $chart->options->additionalAxis['marker']; + } + catch ( ezcGraphInvalidAssignementException $e ) + { + return true; + } + + $this->fail( 'Expected ezcGraphInvalidAssignementException.' ); + } + + public function testDatasetAxisAssignementWithoutRegistration() + { + $chart = new ezcGraphLineChart(); + + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => -21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData']->yAxis = new ezcGraphChartElementNumericAxis(); + $chart->data['sampleData']->xAxis = new ezcGraphChartElementLabeledAxis(); + + $this->assertEquals( + new ezcGraphChartElementNumericAxis(), + $chart->data['sampleData']->yAxis->default, + 'yAxis property should point to a ezcGraphChartElementNumericAxis.' + ); + + $this->assertEquals( + new ezcGraphChartElementLabeledAxis(), + $chart->data['sampleData']->xAxis->default, + 'xAxis property should point to a ezcGraphChartElementLabeledAxis.' + ); + + try + { + $chart->data['sampleData']->xAxis[100] = new ezcGraphChartElementLabeledAxis(); + } + catch ( ezcGraphInvalidAssignementException $e ) + { + return true; + } + + $this->fail( 'Expected ezcGraphInvalidAssignementException.' ); + } } ?> |