summaryrefslogtreecommitdiffstats
path: root/tests/labeled_axis_test.php
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-05-31 10:09:24 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-05-31 10:09:24 +0000
commitbe71d4bacef6f010a54df59356f97727a932de43 (patch)
tree66506017c342c9d745346619f8ddcadff3e72b4c /tests/labeled_axis_test.php
parent4a2d7f6335135e7fe09ae71e6d9bc6dbd7100281 (diff)
downloadzetacomponents-graph-be71d4bacef6f010a54df59356f97727a932de43.zip
zetacomponents-graph-be71d4bacef6f010a54df59356f97727a932de43.tar.gz
- Added test for axis rendering
- Implemented axis rendering - Missing lables
Diffstat (limited to 'tests/labeled_axis_test.php')
-rw-r--r--tests/labeled_axis_test.php137
1 files changed, 137 insertions, 0 deletions
diff --git a/tests/labeled_axis_test.php b/tests/labeled_axis_test.php
index 7e53d36..180c247 100644
--- a/tests/labeled_axis_test.php
+++ b/tests/labeled_axis_test.php
@@ -342,6 +342,143 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
);
}
+ public function testRenderLabeledAxisBase()
+ {
+ try
+ {
+ $chart = ezcGraph::create( 'Line' );
+ $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart->sample->color = '#FF0000';
+ $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 );
+ $chart->sample2->color = '#00FF00';
+
+ $mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
+ 'drawLine',
+ ) );
+
+ // X-Axis
+ $mockedRenderer
+ ->expects( $this->at( 0 ) )
+ ->method( 'drawLine' )
+ ->with(
+ $this->equalTo( ezcGraphColor::fromHex( '#000000' ) ),
+ $this->equalTo( new ezcGraphCoordinate( 100, 190 ) ),
+ $this->equalTo( new ezcGraphCoordinate( 500, 190 ) ),
+ $this->equalTo( false )
+ );
+
+ $chart->renderer = $mockedRenderer;
+
+ $chart->render( 500, 200 );
+ }
+ catch ( Exception $e )
+ {
+ $this->fail( $e->getMessage() );
+ }
+ }
+
+ public function testRenderLabeledAxisMajor()
+ {
+ try
+ {
+ $chart = ezcGraph::create( 'Line' );
+ $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart->sample->color = '#FF0000';
+ $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 );
+ $chart->sample2->color = '#00FF00';
+
+ $mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
+ 'drawLine',
+ ) );
+
+ // X-Axis
+ $mockedRenderer
+ ->expects( $this->at( 1 ) )
+ ->method( 'drawLine' )
+ ->with(
+ $this->equalTo( ezcGraphColor::fromHex( '#000000' ) ),
+ $this->equalTo( new ezcGraphCoordinate( 120, 194 ) ),
+ $this->equalTo( new ezcGraphCoordinate( 120, 186 ) ),
+ $this->equalTo( false )
+ );
+ $mockedRenderer
+ ->expects( $this->at( 2 ) )
+ ->method( 'drawLine' )
+ ->with(
+ $this->equalTo( ezcGraphColor::fromHex( '#000000' ) ),
+ $this->equalTo( new ezcGraphCoordinate( 210, 194 ) ),
+ $this->equalTo( new ezcGraphCoordinate( 210, 186 ) ),
+ $this->equalTo( false )
+ );
+ $mockedRenderer
+ ->expects( $this->at( 3 ) )
+ ->method( 'drawLine' )
+ ->with(
+ $this->equalTo( ezcGraphColor::fromHex( '#000000' ) ),
+ $this->equalTo( new ezcGraphCoordinate( 301, 194 ) ),
+ $this->equalTo( new ezcGraphCoordinate( 301, 186 ) ),
+ $this->equalTo( false )
+ );
+ $mockedRenderer
+ ->expects( $this->at( 4 ) )
+ ->method( 'drawLine' )
+ ->with(
+ $this->equalTo( ezcGraphColor::fromHex( '#000000' ) ),
+ $this->equalTo( new ezcGraphCoordinate( 391, 194 ) ),
+ $this->equalTo( new ezcGraphCoordinate( 391, 186 ) ),
+ $this->equalTo( false )
+ );
+ $mockedRenderer
+ ->expects( $this->at( 5 ) )
+ ->method( 'drawLine' )
+ ->with(
+ $this->equalTo( ezcGraphColor::fromHex( '#000000' ) ),
+ $this->equalTo( new ezcGraphCoordinate( 481, 194 ) ),
+ $this->equalTo( new ezcGraphCoordinate( 481, 186 ) ),
+ $this->equalTo( false )
+ );
+
+ $chart->renderer = $mockedRenderer;
+
+ $chart->render( 500, 200 );
+ }
+ catch ( Exception $e )
+ {
+ $this->fail( $e->getMessage() );
+ }
+ }
+
+ public function testRenderLabeledAxisLabels()
+ {
+ try
+ {
+ $chart = ezcGraph::create( 'Line' );
+ $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart->sample->color = '#FF0000';
+ $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 );
+ $chart->sample2->color = '#00FF00';
+
+ $mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
+ 'drawTextBox',
+ ) );
+
+ // Y-Axis
+ $mockedRenderer
+ ->expects( $this->at( 2 ) )
+ ->method( 'drawTextBox' )
+ ->with(
+ );
+
+ $chart->renderer = $mockedRenderer;
+
+ $chart->render( 500, 200 );
+ }
+ catch ( Exception $e )
+ {
+ $this->fail( $e->getMessage() );
+ }
+ }
+
public function testRender()
{
throw new PHPUnit2_Framework_IncompleteTestError(
OpenPOWER on IntegriCloud