diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-09-20 09:59:56 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-09-20 09:59:56 +0000 |
commit | da06e1ce094169abdcd0ab4df70180fc1a4988cd (patch) | |
tree | 44fc4abcc8a8312d2ea01c4c0c9ae1415467e760 /tests/palette_test.php | |
parent | 593169b297351ac5f2a40b800a308eed4fd99955 (diff) | |
download | zetacomponents-graph-da06e1ce094169abdcd0ab4df70180fc1a4988cd.zip zetacomponents-graph-da06e1ce094169abdcd0ab4df70180fc1a4988cd.tar.gz |
- Made palette properties writeable
- Fixed wrong parameters
Diffstat (limited to 'tests/palette_test.php')
-rw-r--r-- | tests/palette_test.php | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/tests/palette_test.php b/tests/palette_test.php index bb57b0e..892d683 100644 --- a/tests/palette_test.php +++ b/tests/palette_test.php @@ -337,6 +337,96 @@ class ezcGraphPaletteTest extends ezcTestCase 'Chart background not set from pallet.' ); } + + public function testModifyPaletteColorProperty() + { + $palette = new ezcGraphPaletteTango(); + + $palette->axisColor = '#FFFFFF'; + $palette->majorGridColor = array( 255, 255, 255, 255 ); + $palette->minorGridColor = ezcGraphColor::fromHex( '#00000000' ); + + $this->assertEquals( + $palette->axisColor, + ezcGraphColor::fromHex( '#FFFFFF' ) + ); + + try + { + $palette->axisColor = false; + } + catch ( ezcGraphUnknownColorDefinitionException $e ) + { + return true; + } + + $this->fail( 'expected ezcGraphUnknownColorDefinitionException.' ); + } + + public function testModifyPaletteIntProperty() + { + $palette = new ezcGraphPaletteTango(); + + $palette->chartBorderWidth = 0; + $palette->padding = -1; + $palette->margin = 3; + + $this->assertSame( $palette->chartBorderWidth, 0 ); + $this->assertSame( $palette->padding, 0 ); + $this->assertSame( $palette->margin, 3 ); + } + + public function testModifyPaletteDatasetColorArray() + { + $palette = new ezcGraphPaletteTango(); + + $palette->dataSetColor = array( + '#ABCDEF', + array( 255, 255, 255 ), + ); + + $this->assertEquals( + $palette->dataSetColor, + ezcGraphColor::fromHex( '#ABCDEF' ) + ); + + try + { + $palette->dataSetColor = '#FFFFFF'; + } + catch ( ezcBaseValueException $e ) + { + return true; + } + + $this->fail( 'expected ezcBaseValueException.' ); + } + + public function testModifyPaletteDatasetSymbolArray() + { + $palette = new ezcGraphPaletteTango(); + + $palette->dataSetSymbol = array( + ezcGraph::BULLET, + ezcGraph::CIRCLE + ); + + $this->assertSame( + $palette->dataSetSymbol, + ezcGraph::BULLET + ); + + try + { + $palette->dataSetSymbol = ezcGraph::BULLET; + } + catch ( ezcBaseValueException $e ) + { + return true; + } + + $this->fail( 'expected ezcBaseValueException.' ); + } } ?> |