Author: Kore Nordmann
Date: 2006-09-24 12:04:45 +0200 (Sun, 24 Sep 2006)
New Revision: 3552

Log:
- Ensure proper polygon initialization

Modified:
   trunk/Graph/src/datasets/average.php
   trunk/Graph/tests/dataset_average_test.php

Modified: trunk/Graph/src/datasets/average.php
===================================================================
--- trunk/Graph/src/datasets/average.php        2006-09-24 09:56:07 UTC (rev 
3551)
+++ trunk/Graph/src/datasets/average.php        2006-09-24 10:04:45 UTC (rev 
3552)
@@ -200,6 +200,7 @@
      */
     protected function getKey()
     {
+        $polynom = $this->getPolynom();
         return $this->min +
             ( $this->max - $this->min ) / $this->resolution * $this->position;
     }
@@ -213,6 +214,7 @@
      */
     public function offsetExists( $key )
     {
+        $polynom = $this->getPolynom();
         return ( ( $key >= $this->min ) && ( $key <= $this->max ) );
     }
 
@@ -310,6 +312,7 @@
      */
     final public function valid()
     {
+        $polynom = $this->getPolynom();
         return ( ( $this->getKey() >= $this->min ) && ( $this->getKey() <= 
$this->max ) );
     }
 

Modified: trunk/Graph/tests/dataset_average_test.php
===================================================================
--- trunk/Graph/tests/dataset_average_test.php  2006-09-24 09:56:07 UTC (rev 
3551)
+++ trunk/Graph/tests/dataset_average_test.php  2006-09-24 10:04:45 UTC (rev 
3552)
@@ -293,5 +293,20 @@
 
         $this->fail( 'Expected ezcGraphDatasetAverageInvalidKeysException.' );
     }
+
+    public function testPAverageDataSetIsset()
+    {
+        $arrayDataSet = new ezcGraphArrayDataSet( array( -1 => 2, 1 => 2, 3 => 
10 ) );
+
+        $averageDataSet = new ezcGraphDataSetAveragePolynom( $arrayDataSet );
+        $averageDataSet->polynomOrder = 3;
+        $averageDataSet->resolution = 10;
+
+        $this->assertSame( 
+            isset( $averageDataSet[0] ),
+            true,
+            'Polygon not properly initialized.'
+        );
+    }
 }
 ?>

-- 
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to