summaryrefslogtreecommitdiffstats
path: root/tests/palette_test.php
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-11-02 16:05:45 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-11-02 16:05:45 +0000
commit5bdf51ead2a5e1dfb683c56df48e3d887e743472 (patch)
tree7e39889aca43eff30617df44f5bb567be94035f9 /tests/palette_test.php
parent39d55ef60b9074920a1a3fc3d0c0f8d51f303760 (diff)
downloadzetacomponents-graph-5bdf51ead2a5e1dfb683c56df48e3d887e743472.zip
zetacomponents-graph-5bdf51ead2a5e1dfb683c56df48e3d887e743472.tar.gz
- Throw ezcBaseValueExceptions instead of typecasting
- Do range checks instead of converting numbers using min and max - Extended testcases to test for ezcBaseValueExceptions
Diffstat (limited to 'tests/palette_test.php')
-rw-r--r--tests/palette_test.php130
1 files changed, 116 insertions, 14 deletions
diff --git a/tests/palette_test.php b/tests/palette_test.php
index 25ae6c5..8861ec3 100644
--- a/tests/palette_test.php
+++ b/tests/palette_test.php
@@ -363,19 +363,6 @@ class ezcGraphPaletteTest extends ezcTestCase
$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();
@@ -427,6 +414,121 @@ class ezcGraphPaletteTest extends ezcTestCase
$this->fail( 'expected ezcBaseValueException.' );
}
-}
+ public function testPalettePropertyChartBorderWidth()
+ {
+ $options = new ezcGraphPaletteTango();
+
+ $this->assertSame(
+ 0,
+ $options->chartBorderWidth,
+ 'Wrong default value for property chartBorderWidth in class ezcGraphPalette'
+ );
+
+ $options->chartBorderWidth = 1;
+ $this->assertSame(
+ 1,
+ $options->chartBorderWidth,
+ 'Setting property value did not work for property chartBorderWidth in class ezcGraphPalette'
+ );
+
+ try
+ {
+ $options->chartBorderWidth = false;
+ }
+ catch( ezcBaseValueException $e )
+ {
+ return true;
+ }
+
+ $this->fail( 'Expected ezcBaseValueException.' );
+ }
+
+ public function testPalettePropertyElementBorderWidth()
+ {
+ $options = new ezcGraphPaletteTango();
+
+ $this->assertSame(
+ 0,
+ $options->elementBorderWidth,
+ 'Wrong default value for property elementBorderWidth in class ezcGraphPalette'
+ );
+
+ $options->elementBorderWidth = 1;
+ $this->assertSame(
+ 1,
+ $options->elementBorderWidth,
+ 'Setting property value did not work for property elementBorderWidth in class ezcGraphPalette'
+ );
+
+ try
+ {
+ $options->elementBorderWidth = false;
+ }
+ catch( ezcBaseValueException $e )
+ {
+ return true;
+ }
+
+ $this->fail( 'Expected ezcBaseValueException.' );
+ }
+
+ public function testPalettePropertyPadding()
+ {
+ $options = new ezcGraphPaletteTango();
+
+ $this->assertSame(
+ 1,
+ $options->padding,
+ 'Wrong default value for property padding in class ezcGraphPalette'
+ );
+
+ $options->padding = 2;
+ $this->assertSame(
+ 2,
+ $options->padding,
+ 'Setting property value did not work for property padding in class ezcGraphPalette'
+ );
+
+ try
+ {
+ $options->padding = false;
+ }
+ catch( ezcBaseValueException $e )
+ {
+ return true;
+ }
+
+ $this->fail( 'Expected ezcBaseValueException.' );
+ }
+
+ public function testPalettePropertyMargin()
+ {
+ $options = new ezcGraphPaletteTango();
+
+ $this->assertSame(
+ 0,
+ $options->margin,
+ 'Wrong default value for property margin in class ezcGraphPalette'
+ );
+
+ $options->margin = 1;
+ $this->assertSame(
+ 1,
+ $options->margin,
+ 'Setting property value did not work for property margin in class ezcGraphPalette'
+ );
+
+ try
+ {
+ $options->margin = false;
+ }
+ catch( ezcBaseValueException $e )
+ {
+ return true;
+ }
+
+ $this->fail( 'Expected ezcBaseValueException.' );
+ }
+}
?>
OpenPOWER on IntegriCloud