summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/labeled_axis_test.php107
-rw-r--r--tests/suite.php6
2 files changed, 113 insertions, 0 deletions
diff --git a/tests/labeled_axis_test.php b/tests/labeled_axis_test.php
new file mode 100644
index 0000000..421d639
--- /dev/null
+++ b/tests/labeled_axis_test.php
@@ -0,0 +1,107 @@
+<?php
+/**
+ * ezcGraphLabeledAxisTest
+ *
+ * @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 ezcGraphLabeledAxisTest extends ezcTestCase
+{
+
+ public static function suite()
+ {
+ return new ezcTestSuite( "ezcGraphLabeledAxisTest" );
+ }
+
+ /**
+ * setUp
+ *
+ * @access public
+ */
+ public function setUp()
+ {
+ }
+
+ /**
+ * tearDown
+ *
+ * @access public
+ */
+ public function tearDown()
+ {
+ }
+
+ public function testFactoryLabeledAxis()
+ {
+ $chart = ezcGraph::create( 'Line' );
+
+ $this->assertTrue(
+ $chart->X_axis instanceof ezcGraphChartElementLabeledAxis
+ );
+ }
+
+ public function testAutomaticLabelingSingle()
+ {
+ try
+ {
+ $chart = ezcGraph::create( 'Line' );
+ $chart->sample = array( 2000 => 20, 70, 12, 130 );
+ }
+ catch ( Exception $e )
+ {
+ $this->fail( $e->getMessage() );
+ }
+
+ $this->assertSame(
+ array(
+ '2000',
+ '2001',
+ '2002',
+ '2003',
+ ),
+ $this->getNonPublicProperty( $chart->X_axis, 'labels' )
+ );
+ }
+
+ public function testAutomaticLabelingMultiple()
+ {
+ try
+ {
+ $chart = ezcGraph::create( 'Line' );
+ $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart->sample2 = array( 2002 => 1270, 1170, 1610, 1370 );
+ }
+ catch ( Exception $e )
+ {
+ $this->fail( $e->getMessage() );
+ }
+
+ $this->assertSame(
+ array(
+ '2000',
+ '2001',
+ '2002',
+ '2003',
+ '2004',
+ '2005',
+ ),
+ $this->getNonPublicProperty( $chart->X_axis, 'labels' )
+ );
+ }
+
+ public function testRender()
+ {
+ $this->fail( '@TODO: Implement renderer tests.' );
+ }
+}
+?>
diff --git a/tests/suite.php b/tests/suite.php
index f645ad6..188c99b 100644
--- a/tests/suite.php
+++ b/tests/suite.php
@@ -40,6 +40,11 @@ require_once 'legend_test.php';
require_once 'numeric_axis_test.php';
/**
+* Require test suite for ezcGraphChart class.
+*/
+require_once 'labeled_axis_test.php';
+
+/**
* Test suite for ImageAnalysis package.
*
* @package ImageAnalysis
@@ -58,6 +63,7 @@ class ezcGraphSuite extends ezcTestSuite
$this->addTest( ezcGraphDatasetTest::suite() );
$this->addTest( ezcGraphLegendTest::suite() );
$this->addTest( ezcGraphNumericAxisTest::suite() );
+ $this->addTest( ezcGraphLabeledAxisTest::suite() );
}
public static function suite()
OpenPOWER on IntegriCloud