summaryrefslogtreecommitdiffstats
path: root/tests/labeled_axis_test.php
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2007-04-12 12:45:42 +0000
committerKore Nordmann <github@kore-nordmann.de>2007-04-12 12:45:42 +0000
commite3c691c66bc360caae052a7387a258ac8af0c2a1 (patch)
treeeda7c4184d615f590e20bf142b7dcd24bbe7f20c /tests/labeled_axis_test.php
parent40b5444276af768209c8a6b0df633b150da86ac8 (diff)
downloadzetacomponents-graph-e3c691c66bc360caae052a7387a258ac8af0c2a1.zip
zetacomponents-graph-e3c691c66bc360caae052a7387a258ac8af0c2a1.tar.gz
- Added feature #10470: Add support for format callback functions on all axis
Diffstat (limited to 'tests/labeled_axis_test.php')
-rw-r--r--tests/labeled_axis_test.php64
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/labeled_axis_test.php b/tests/labeled_axis_test.php
index 2bdc2ab..8d8bf86 100644
--- a/tests/labeled_axis_test.php
+++ b/tests/labeled_axis_test.php
@@ -575,6 +575,70 @@ class ezcGraphLabeledAxisTest extends ezcGraphTestCase
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg'
);
}
+
+ public function testRenderedLabels()
+ {
+ try
+ {
+ $chart = new ezcGraphLineChart();
+ $chart->data['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 2001 => 1300, 2004 => 1012 ) );
+ $chart->render( 500, 200 );
+ }
+ catch ( ezcGraphFontRenderingException $e )
+ {
+ // Ignore
+ }
+
+ $steps = $chart->xAxis->getSteps();
+
+ $expectedLabels = array(
+ '2000', '2001', '2004'
+ );
+
+ foreach ( $steps as $nr => $step )
+ {
+ $this->assertSame(
+ $step->label,
+ $expectedLabels[$nr],
+ 'Label not as expected'
+ );
+ }
+ }
+
+ public function testRenderedLabelsWithLabelFormattingCallback()
+ {
+ try
+ {
+ $chart = new ezcGraphLineChart();
+
+ $chart->xAxis->labelCallback = create_function(
+ '$label',
+ 'return "*$label*";'
+ );
+
+ $chart->data['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 2001 => 1300, 2004 => 1012 ) );
+ $chart->render( 500, 200 );
+ }
+ catch ( ezcGraphFontRenderingException $e )
+ {
+ // Ignore
+ }
+
+ $steps = $chart->xAxis->getSteps();
+
+ $expectedLabels = array(
+ '*2000*', '*2001*', '*2004*'
+ );
+
+ foreach ( $steps as $nr => $step )
+ {
+ $this->assertSame(
+ $step->label,
+ $expectedLabels[$nr],
+ 'Label not as expected'
+ );
+ }
+ }
}
?>
OpenPOWER on IntegriCloud