diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-05-09 09:14:06 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-05-09 09:14:06 +0000 |
commit | ee8e254fcaa69679b828a78b7d6666157170224b (patch) | |
tree | b1eea3114e8605ab07acee9e1297ee1334375c96 /tests/chart_test.php | |
parent | ded1cd35661c0a5536cc236e694f7cf6a9b79c19 (diff) | |
download | zetacomponents-graph-ee8e254fcaa69679b828a78b7d6666157170224b.zip zetacomponents-graph-ee8e254fcaa69679b828a78b7d6666157170224b.tar.gz |
- Forget to add tests for Graph class yesterday
- Added tests for ezcGraphColor factory methods
- Updated test suite for ezcGraphColor tests
Diffstat (limited to 'tests/chart_test.php')
-rw-r--r-- | tests/chart_test.php | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/tests/chart_test.php b/tests/chart_test.php new file mode 100644 index 0000000..d2e31a5 --- /dev/null +++ b/tests/chart_test.php @@ -0,0 +1,120 @@ +<?php +/** + * ezcChartTest + * + * @package Graph + * @version //autogen// + * @subpackage Tests + * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved. + * @license http://ez.no/licenses/new_bsd New BSD License + */ + +/** + * Tests for ezcGraph class. + * + * @package ImageAnalysis + * @subpackage Tests + */ +class ezcChartTest extends ezcTestCase +{ + protected $testFiles = array( + 'jpeg' => 'jpeg.jpg', + 'nonexistant' => 'nonexisting.jpg', + 'invalid' => 'text.txt', + ); + + protected $basePath; + + public static function suite() + { + return new ezcTestSuite( "ezcChartTest" ); + } + + /** + * setUp + * + * @access public + */ + public function setUp() + { + $this->basePath = dirname( __FILE__ ) . '/data/'; + } + + /** + * tearDown + * + * @access public + */ + public function tearDown() + { + } + + public function testSetTitle() + { + try + { + $pieChart = ezcGraph::create( 'Pie' ); + $pieChart->title = 'Test title'; + } + catch ( Exception $e ) + { + $this->fail( $e->getMessage() ); + } + + $this->assertProtectedPropertySame( $pieChart, 'title', 'Test title' ); + } + + public function testSetOptionsValidBackgroundImage() + { + try + { + $pieChart = ezcGraph::create( 'Pie' ); + $pieChart->options->backgroundImage = $this->basePath . $this->testFiles['jpeg']; + } + catch ( Exception $e ) + { + $this->fail( $e->getMessage() ); + } + } + + public function testSetOptionsInvalidBackgroundImage() + { + try + { + $pieChart = ezcGraph::create( 'Pie' ); + $pieChart->options->backgroundImage = $this->basePath . $this->testFiles['invalid']; + } + catch ( ezcGraphInvalidImageFileException $e ) + { + return true; + } + catch ( Exception $e ) + { + $this->fail( $e->getMessage() ); + } + + $this->fail( 'Expected ezcGraphInvalidImageFileException' ); + } + + public function testSetOptionsInvalidBackgroundImage() + { + try + { + $pieChart = ezcGraph::create( 'Pie' ); + $pieChart->options->backgroundImage = $this->basePath . $this->testFiles['nonexisting']; + } + catch ( ezcGraphFileNotFoundException $e ) + { + return true; + } + catch ( Exception $e ) + { + $this->fail( $e->getMessage() ); + } + + $this->fail( 'Expected ezcGraphFileNotFoundException' ); + } + + public function test +} +?> |