diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2007-09-05 08:24:42 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2007-09-05 08:24:42 +0000 |
commit | 59192857ba65c14388bbe5b1633a4f1ac346e9d1 (patch) | |
tree | 46248b526996a538badd3fd8db82244e4c6efc4e /tests/line_test.php | |
parent | 0619fc50ccb698c85f7f7d4367e01dde406b8f9a (diff) | |
download | zetacomponents-graph-59192857ba65c14388bbe5b1633a4f1ac346e9d1.zip zetacomponents-graph-59192857ba65c14388bbe5b1633a4f1ac346e9d1.tar.gz |
- Implemented feature #11247: Custom highlight values in line and bar charts.
Thanks to Elger Thiele for the basic patch.
Diffstat (limited to 'tests/line_test.php')
-rw-r--r-- | tests/line_test.php | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/tests/line_test.php b/tests/line_test.php index 18a2588..002af62 100644 --- a/tests/line_test.php +++ b/tests/line_test.php @@ -9,13 +9,15 @@ * @license http://ez.no/licenses/new_bsd New BSD License */ +require_once dirname( __FILE__ ) . '/test_case.php'; + /** * Tests for ezcGraph class. * * @package ImageAnalysis * @subpackage Tests */ -class ezcGraphLineChartTest extends ezcTestCase +class ezcGraphLineChartTest extends ezcGraphTestCase { protected $basePath; @@ -39,7 +41,10 @@ class ezcGraphLineChartTest extends ezcTestCase protected function tearDown() { - $this->removeTempDir(); + if ( !$this->hasFailed() ) + { + $this->removeTempDir(); + } } protected function addSampleData( ezcGraphChart $chart ) @@ -760,5 +765,57 @@ class ezcGraphLineChartTest extends ezcTestCase $this->fail( 'Expected ezcGraphNoDataException.' ); } + + public function testLineChartHighlightValue() + { + $filename = $this->tempDir . __FUNCTION__ . '.svg'; + + $chart = new ezcGraphLineChart(); + $chart->data['sample'] = new ezcGraphArrayDataSet( array( + 'Mozilla' => 4375, + 'IE' => 345, + 'Opera' => 1204, + 'wget' => 231, + 'Safari' => 987, + ) ); + + $chart->data['sample']->highlight = true; + $chart->data['sample']->highlightValue['Opera'] = 'Opera!'; + + $chart->driver = new ezcGraphSvgDriver(); + $chart->render( 500, 200, $filename ); + + $this->compare( + $filename, + $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg' + ); + } + + public function testBarChartHighlightValue() + { + $filename = $this->tempDir . __FUNCTION__ . '.svg'; + + $chart = new ezcGraphBarChart(); + $chart->data['sample'] = new ezcGraphArrayDataSet( array( + 'Mozilla' => 4375, + 'IE' => 345, + 'Opera' => 1204, + 'wget' => 231, + 'Safari' => 987, + ) ); + + $chart->data['sample']->highlight = true; + $chart->data['sample']->highlight['IE'] = false; + $chart->data['sample']->highlightValue = 'foo'; + $chart->data['sample']->highlightValue['Opera'] = 'Opera!'; + + $chart->driver = new ezcGraphSvgDriver(); + $chart->render( 500, 200, $filename ); + + $this->compare( + $filename, + $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg' + ); + } } ?> |