summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/axis/labeled.php2
-rw-r--r--src/charts/line.php50
-rw-r--r--src/driver/gd.php8
-rw-r--r--src/element/axis.php96
-rw-r--r--tests/labeled_axis_test.php58
-rw-r--r--tests/legend_test.php18
-rw-r--r--tests/line_test.php36
-rw-r--r--tests/numeric_axis_test.php60
8 files changed, 247 insertions, 81 deletions
diff --git a/src/axis/labeled.php b/src/axis/labeled.php
index 679066a..d679855 100644
--- a/src/axis/labeled.php
+++ b/src/axis/labeled.php
@@ -149,7 +149,7 @@ class ezcGraphChartElementLabeledAxis extends ezcGraphChartElementAxis
*/
protected function getMajorStepCount()
{
- return count( $this->labels );
+ return count( $this->labels ) - 1;
}
protected function getLabel( $step )
diff --git a/src/charts/line.php b/src/charts/line.php
index 132b090..e17ef2d 100644
--- a/src/charts/line.php
+++ b/src/charts/line.php
@@ -25,6 +25,54 @@ class ezcGraphLineChart extends ezcGraphChart
$this->elements['Y_axis']->position = ezcGraph::BOTTOM;
}
+ protected function renderData( $renderer, $boundings )
+ {
+ foreach ( $this->data as $data )
+ {
+ $lastPoint = false;
+ foreach ( $data as $key => $value )
+ {
+ $point = new ezcGraphCoordinate(
+ $this->elements['X_axis']->getCoordinate( $boundings, $key ),
+ $this->elements['Y_axis']->getCoordinate( $boundings, $value )
+ );
+
+ // Draw line
+ if ( $lastPoint !== false )
+ {
+ $renderer->drawLine(
+ $data->color->default,
+ $lastPoint,
+ $point,
+ true
+ );
+ }
+
+ // Draw Symbol
+ $symbol = $data->symbol[$key];
+ // @TODO: Make config option
+ $symbolSize = 8;
+ $symbolPosition = new ezcGraphCoordinate(
+ $point->x - $symbolSize / 2,
+ $point->y - $symbolSize / 2
+ );
+
+ if ( $symbol != ezcGraph::NO_SYMBOL )
+ {
+ $renderer->drawSymbol(
+ $data->color[$key],
+ $symbolPosition,
+ $symbolSize,
+ $symbolSize,
+ $symbol
+ );
+ }
+
+ $lastPoint = $point;
+ }
+ }
+ }
+
/**
* Render a line chart
*
@@ -72,7 +120,7 @@ class ezcGraphLineChart extends ezcGraphChart
}
// Render graph
- //$this->renderData( $this->renderer, $boundings );
+ $this->renderData( $this->renderer, $boundings );
if ( !empty( $file ) )
{
diff --git a/src/driver/gd.php b/src/driver/gd.php
index 43276b4..1df035d 100644
--- a/src/driver/gd.php
+++ b/src/driver/gd.php
@@ -226,15 +226,15 @@ class ezcGraphGdDriver extends ezcGraphDriver
$boundings = imagettfbbox( $size, 0, $this->options->font, $string );
$position->y += $size;
- switch ( $align )
+ switch ( true )
{
- case ezcGraph::LEFT:
+ case ( $align & ezcGraph::LEFT ):
imagettftext( $image, $size, 0, $position->x, $position->y, $drawColor, $this->options->font, $string );
break;
- case ezcGraph::RIGHT:
+ case ( $align & ezcGraph::RIGHT ):
imagettftext( $image, $size, 0, $position->x + ( $width - $boundings[2] ), $position->y, $drawColor, $this->options->font, $string );
break;
- case ezcGraph::CENTER:
+ case ( $align & ezcGraph::CENTER ):
imagettftext( $image, $size, 0, $position->x + ( ( $width - $boundings[2] ) / 2 ), $position->y, $drawColor, $this->options->font, $string );
break;
}
diff --git a/src/element/axis.php b/src/element/axis.php
index 2096cf0..1d8a09a 100644
--- a/src/element/axis.php
+++ b/src/element/axis.php
@@ -174,7 +174,7 @@ abstract class ezcGraphChartElementAxis extends ezcGraphChartElement
* @param float $minor
* @return void
*/
- protected function drawAxis( ezcGraphRenderer $renderer, ezcGraphCoordinate $start, ezcGraphCoordinate $end )
+ protected function drawAxis( ezcGraphRenderer $renderer, ezcGraphCoordinate $start, ezcGraphCoordinate $end, ezcGraphBoundings $boundings )
{
// Determine normalized direction
$direction = new ezcGraphCoordinate(
@@ -202,26 +202,90 @@ abstract class ezcGraphChartElementAxis extends ezcGraphChartElement
// Draw major steps
$steps = $this->getMajorStepCount();
+ // Calculate stepsize
+ $xStepsize = ( $end->x - $start->x ) / $steps;
+ $yStepsize = ( $end->y - $start->y ) / $steps;
+
+ // Caluclate datafree chart border
+ $xBorder = abs ( ( $boundings->x1 - $boundings->x0 ) * ( $this->padding / 2 ) );
+ $yBorder = abs ( ( $boundings->y1 - $boundings->y0 ) * ( $this->padding / 2 ) );
+
for ( $i = 0; $i <= $steps; ++$i )
{
$renderer->drawLine(
$this->border,
new ezcGraphCoordinate(
- (int) round($start->x + $i * ( $end->x - $start->x ) / $steps
- + $direction->y * $this->majorScalingLineLength),
- (int) round($start->y + $i * ( $end->y - $start->y ) / $steps
- + $direction->x * -$this->majorScalingLineLength)
+ (int) round( $start->x + $i * $xStepsize
+ + $direction->y * $this->majorScalingLineLength ),
+ (int) round( $start->y + $i * $yStepsize
+ + $direction->x * -$this->majorScalingLineLength )
),
new ezcGraphCoordinate(
- (int) round($start->x + $i * ( $end->x - $start->x ) / $steps
- + $direction->y * -$this->majorScalingLineLength),
- (int) round($start->y + $i * ( $end->y - $start->y ) / $steps
- + $direction->x * $this->majorScalingLineLength)
+ (int) round( $start->x + $i * $xStepsize
+ + $direction->y * -$this->majorScalingLineLength ),
+ (int) round( $start->y + $i * $yStepsize
+ + $direction->x * $this->majorScalingLineLength )
),
false
);
- // @TODO: Draw labels
+ // Draw label
+ if ( $i < $steps )
+ {
+ $label = $this->getLabel( $i );
+
+ switch ( $this->position )
+ {
+ case ezcGraph::LEFT:
+ $renderer->drawTextBox(
+ new ezcGraphCoordinate(
+ (int) round( $start->x + $i * $xStepsize ),
+ (int) round( $start->y + $i * $yStepsize )
+ ),
+ $label,
+ (int) round( $xStepsize ),
+ $yBorder,
+ ezcGraph::LEFT | ezcGraph::TOP
+ );
+ break;
+ case ezcGraph::RIGHT:
+ $renderer->drawTextBox(
+ new ezcGraphCoordinate(
+ (int) round( $start->x + $i * $xStepsize + $xStepsize ),
+ (int) round( $start->y + $i * $yStepsize )
+ ),
+ $label,
+ (int) round( -$xStepsize ),
+ $yBorder,
+ ezcGraph::RIGHT | ezcGraph::TOP
+ );
+ break;
+ case ezcGraph::BOTTOM:
+ $renderer->drawTextBox(
+ new ezcGraphCoordinate(
+ (int) round( $start->x + $i * $xStepsize - $xBorder ),
+ (int) round( $start->y + $i * $yStepsize + $yStepsize )
+ ),
+ $label,
+ $xBorder,
+ (int) round( -$yStepsize ),
+ ezcGraph::RIGHT | ezcGraph::BOTTOM
+ );
+ break;
+ case ezcGraph::TOP:
+ $renderer->drawTextBox(
+ new ezcGraphCoordinate(
+ (int) round( $start->x + $i * $xStepsize - $xBorder ),
+ (int) round( $start->y + $i * $yStepsize )
+ ),
+ $label,
+ $xBorder,
+ (int) round( $yStepsize ),
+ ezcGraph::RIGHT | ezcGraph::TOP
+ );
+ break;
+ }
+ }
}
// Draw minor steps if wanted
@@ -272,7 +336,8 @@ abstract class ezcGraphChartElementAxis extends ezcGraphChartElement
new ezcGraphCoordinate(
$this->nullPosition,
$boundings->y1
- )
+ ),
+ $boundings
);
break;
case ezcGraph::BOTTOM:
@@ -285,7 +350,8 @@ abstract class ezcGraphChartElementAxis extends ezcGraphChartElement
new ezcGraphCoordinate(
$this->nullPosition,
$boundings->y0
- )
+ ),
+ $boundings
);
break;
case ezcGraph::LEFT:
@@ -298,7 +364,8 @@ abstract class ezcGraphChartElementAxis extends ezcGraphChartElement
new ezcGraphCoordinate(
$boundings->x1,
$this->nullPosition
- )
+ ),
+ $boundings
);
break;
case ezcGraph::RIGHT:
@@ -311,7 +378,8 @@ abstract class ezcGraphChartElementAxis extends ezcGraphChartElement
new ezcGraphCoordinate(
$boundings->x0,
$this->nullPosition
- )
+ ),
+ $boundings
);
break;
}
diff --git a/tests/labeled_axis_test.php b/tests/labeled_axis_test.php
index a2648da..657a7fa 100644
--- a/tests/labeled_axis_test.php
+++ b/tests/labeled_axis_test.php
@@ -354,7 +354,7 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawLine',
- ), array(), 'mocked_ezcGraphRenderer2D' . __FUNCTION__ );
+ ) );
// X-Axis
$mockedRenderer
@@ -389,7 +389,7 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawLine',
- ), array(), 'mocked_ezcGraphRenderer2D' . __FUNCTION__ );
+ ) );
// X-Axis
$mockedRenderer
@@ -406,8 +406,8 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
->method( 'drawLine' )
->with(
$this->equalTo( ezcGraphColor::fromHex( '#000000' ) ),
- $this->equalTo( new ezcGraphCoordinate( 210, 194 ) ),
- $this->equalTo( new ezcGraphCoordinate( 210, 186 ) ),
+ $this->equalTo( new ezcGraphCoordinate( 240, 194 ) ),
+ $this->equalTo( new ezcGraphCoordinate( 240, 186 ) ),
$this->equalTo( false )
);
$mockedRenderer
@@ -415,8 +415,8 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
->method( 'drawLine' )
->with(
$this->equalTo( ezcGraphColor::fromHex( '#000000' ) ),
- $this->equalTo( new ezcGraphCoordinate( 301, 194 ) ),
- $this->equalTo( new ezcGraphCoordinate( 301, 186 ) ),
+ $this->equalTo( new ezcGraphCoordinate( 361, 194 ) ),
+ $this->equalTo( new ezcGraphCoordinate( 361, 186 ) ),
$this->equalTo( false )
);
$mockedRenderer
@@ -424,15 +424,6 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
->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 )
@@ -460,13 +451,38 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawTextBox',
- ), array(), 'mocked_ezcGraphRenderer2D' . __FUNCTION__ );
+ ) );
- // Y-Axis
+ // X-Axis
$mockedRenderer
->expects( $this->at( 2 ) )
->method( 'drawTextBox' )
->with(
+ $this->equalTo( new ezcGraphCoordinate( 120, 190 ) ),
+ $this->equalTo( '2000' ),
+ $this->equalTo( 120 ),
+ $this->equalTo( 10 ),
+ $this->equalTo( ezcGraph::LEFT | ezcGraph::TOP )
+ );
+ $mockedRenderer
+ ->expects( $this->at( 3 ) )
+ ->method( 'drawTextBox' )
+ ->with(
+ $this->equalTo( new ezcGraphCoordinate( 240, 190 ) ),
+ $this->equalTo( '2001' ),
+ $this->equalTo( 120 ),
+ $this->equalTo( 10 ),
+ $this->equalTo( ezcGraph::LEFT | ezcGraph::TOP )
+ );
+ $mockedRenderer
+ ->expects( $this->at( 4 ) )
+ ->method( 'drawTextBox' )
+ ->with(
+ $this->equalTo( new ezcGraphCoordinate( 361, 190 ) ),
+ $this->equalTo( '2002' ),
+ $this->equalTo( 120 ),
+ $this->equalTo( 10 ),
+ $this->equalTo( ezcGraph::LEFT | ezcGraph::TOP )
);
$chart->renderer = $mockedRenderer;
@@ -478,12 +494,6 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
$this->fail( $e->getMessage() );
}
}
-
- public function testRender()
- {
- throw new PHPUnit2_Framework_IncompleteTestError(
- '@TODO: Implement renderer tests.'
- );
- }
}
+
?>
diff --git a/tests/legend_test.php b/tests/legend_test.php
index 5dfaa81..4555886 100644
--- a/tests/legend_test.php
+++ b/tests/legend_test.php
@@ -164,7 +164,7 @@ class ezcGraphLegendTest extends ezcTestCase
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawBackground',
- ), array(), 'mocked_ezcGraphRenderer2D' . __FUNCTION__ );
+ ) );
$mockedRenderer
->expects( $this->once() )
@@ -195,7 +195,7 @@ class ezcGraphLegendTest extends ezcTestCase
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawSymbol',
- ), array(), 'mocked_ezcGraphRenderer2D' . __FUNCTION__ );
+ ) );
$mockedRenderer
->expects( $this->at( 0 ) )
@@ -248,7 +248,7 @@ class ezcGraphLegendTest extends ezcTestCase
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawTextBox',
- ), array(), 'mocked_ezcGraphRenderer2D' . __FUNCTION__ );
+ ) );
$mockedRenderer
->expects( $this->at( 0 ) )
@@ -302,7 +302,7 @@ class ezcGraphLegendTest extends ezcTestCase
'drawTextBox',
'drawSymbol',
'drawLine',
- ), array(), 'mocked_ezcGraphRenderer2D' . __FUNCTION__ );
+ ) );
$mockedRenderer
->expects( $this->once() )
->method( 'drawBackground' )
@@ -333,7 +333,7 @@ class ezcGraphLegendTest extends ezcTestCase
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawSymbol',
- ), array(), 'mocked_ezcGraphRenderer2D' . __FUNCTION__ );
+ ) );
$mockedRenderer
->expects( $this->at( 0 ) )
@@ -387,7 +387,7 @@ class ezcGraphLegendTest extends ezcTestCase
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawBackground',
- ), array(), 'mocked_ezcGraphRenderer2D' . __FUNCTION__ );
+ ) );
$mockedRenderer
->expects( $this->once() )
->method( 'drawBackground' )
@@ -418,7 +418,7 @@ class ezcGraphLegendTest extends ezcTestCase
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawSymbol',
- ), array(), 'mocked_ezcGraphRenderer2D' . __FUNCTION__ );
+ ) );
$mockedRenderer
->expects( $this->at( 0 ) )
@@ -472,7 +472,7 @@ class ezcGraphLegendTest extends ezcTestCase
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawTextBox',
- ), array(), 'mocked_ezcGraphRenderer2D' . __FUNCTION__ );
+ ) );
$mockedRenderer
->expects( $this->at( 0 ) )
@@ -524,7 +524,7 @@ class ezcGraphLegendTest extends ezcTestCase
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawSymbol',
- ), array(), 'mocked_ezcGraphRenderer2D' . __FUNCTION__ );
+ ) );
$mockedRenderer
->expects( $this->at( 0 ) )
diff --git a/tests/line_test.php b/tests/line_test.php
index 2e330cb..b46a9d4 100644
--- a/tests/line_test.php
+++ b/tests/line_test.php
@@ -17,6 +17,8 @@
*/
class ezcGraphLineChartTest extends ezcTestCase
{
+
+ protected $basePath;
public static function suite()
{
@@ -30,6 +32,7 @@ class ezcGraphLineChartTest extends ezcTestCase
*/
public function setUp()
{
+ $this->basePath = dirname( __FILE__ ) . '/data/';
}
/**
@@ -44,12 +47,13 @@ class ezcGraphLineChartTest extends ezcTestCase
protected function addSampleData( ezcGraphChart $chart )
{
$chart->sampleData = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
- $chart->sampleData->color = '#0000FF';
+ $chart->sampleData->color = '#CC0000';
$chart->sampleData->symbol = ezcGraph::DIAMOND;
- $chart->moreData = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
- $chart->moreData->color = '#FF0000';
- $chart->evenMoreData = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
- $chart->evenMoreData->color = '#FF0000';
+ $chart->moreData = array( 'sample 1' => 112, 'sample 2' => 54, 'sample 3' => 12, 'sample 4' => 167, 'sample 5' => 329);
+ $chart->moreData->color = '#3465A4';
+ $chart->evenMoreData = array( 'sample 1' => 300, 'sample 2' => 30, 'sample 3' => 220, 'sample 4' => 67, 'sample 5' => 450);
+ $chart->evenMoreData->color = '#73D216';
+ $chart->evenMoreData->symbol = ezcGraph::BULLET;
$chart->evenMoreData->label = 'Even more data';
}
@@ -87,18 +91,36 @@ class ezcGraphLineChartTest extends ezcTestCase
);
$this->assertEquals(
- ezcGraphColor::fromHex( '#0000FF' ),
+ ezcGraphColor::fromHex( '#CC0000' ),
$legend[0]['color'],
'Color for first label is wrong.'
);
$this->assertEquals(
- ezcGraphColor::fromHex( '#FF0000' ),
+ ezcGraphColor::fromHex( '#3465A4' ),
$legend[1]['color'],
'Color for second label is wrong.'
);
}
+ public function testCompleteRendering()
+ {
+ try
+ {
+ $chart = ezcGraph::create( 'Line' );
+ $chart->title = 'Test graph';
+ $this->addSampleData( $chart );
+ $chart->driver = new ezcGraphGdDriver();
+ $chart->driver->options->font = $this->basePath . 'font.ttf';
+ $chart->render( 500, 200, '/home/kore/test.png' );
+ }
+ catch ( Exception $e )
+ {
+ echo $e;
+ $this->fail( $e->getMessage() );
+ }
+ }
+
public function testRender()
{
throw new PHPUnit2_Framework_IncompleteTestError(
diff --git a/tests/numeric_axis_test.php b/tests/numeric_axis_test.php
index e1d4316..46599c8 100644
--- a/tests/numeric_axis_test.php
+++ b/tests/numeric_axis_test.php
@@ -606,12 +606,12 @@ class ezcGraphNumericAxisTest extends ezcTestCase
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawLine',
- ), array(), 'mocked_ezcGraphRenderer2D_' . __FUNCTION__ );
+ ) );
// Y-Axis
// Base line
$mockedRenderer
- ->expects( $this->at( 6 ) )
+ ->expects( $this->at( 5 ) )
->method( 'drawLine' )
->with(
$this->equalTo( ezcGraphColor::fromHex( '#000000' ) ),
@@ -642,12 +642,12 @@ class ezcGraphNumericAxisTest extends ezcTestCase
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawLine',
- ), array(), 'mocked_ezcGraphRenderer2D_' . __FUNCTION__ );
+ ) );
// Y-Axis
// Major step lines
$mockedRenderer
- ->expects( $this->at( 7 ) )
+ ->expects( $this->at( 6 ) )
->method( 'drawLine' )
->with(
$this->equalTo( ezcGraphColor::fromHex( '#000000' ) ),
@@ -656,7 +656,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
$this->equalTo( false )
);
$mockedRenderer
- ->expects( $this->at( 8 ) )
+ ->expects( $this->at( 7 ) )
->method( 'drawLine' )
->with(
$this->equalTo( ezcGraphColor::fromHex( '#000000' ) ),
@@ -665,7 +665,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
$this->equalTo( false )
);
$mockedRenderer
- ->expects( $this->at( 9 ) )
+ ->expects( $this->at( 8 ) )
->method( 'drawLine' )
->with(
$this->equalTo( ezcGraphColor::fromHex( '#000000' ) ),
@@ -674,7 +674,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
$this->equalTo( false )
);
$mockedRenderer
- ->expects( $this->at( 10 ) )
+ ->expects( $this->at( 9 ) )
->method( 'drawLine' )
->with(
$this->equalTo( ezcGraphColor::fromHex( '#000000' ) ),
@@ -706,12 +706,12 @@ class ezcGraphNumericAxisTest extends ezcTestCase
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawLine',
- ), array(), 'mocked_ezcGraphRenderer2D_' . __FUNCTION__ );
+ ) );
// Y-Axis
// Minor step lines
$mockedRenderer
- ->expects( $this->at( 11 ) )
+ ->expects( $this->at( 10 ) )
->method( 'drawLine' )
->with(
$this->equalTo( ezcGraphColor::fromHex( '#000000' ) ),
@@ -720,7 +720,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
$this->equalTo( false )
);
$mockedRenderer
- ->expects( $this->at( 12 ) )
+ ->expects( $this->at( 11 ) )
->method( 'drawLine' )
->with(
$this->equalTo( ezcGraphColor::fromHex( '#000000' ) ),
@@ -729,7 +729,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
$this->equalTo( false )
);
$mockedRenderer
- ->expects( $this->at( 13 ) )
+ ->expects( $this->at( 12 ) )
->method( 'drawLine' )
->with(
$this->equalTo( ezcGraphColor::fromHex( '#000000' ) ),
@@ -740,7 +740,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
// Last minor step
$mockedRenderer
- ->expects( $this->at( 25 ) )
+ ->expects( $this->at( 24 ) )
->method( 'drawLine' )
->with(
$this->equalTo( ezcGraphColor::fromHex( '#000000' ) ),
@@ -771,13 +771,38 @@ class ezcGraphNumericAxisTest extends ezcTestCase
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawTextBox',
- ), array(), 'mocked_ezcGraphRenderer2D_' . __FUNCTION__ );
+ ) );
// Y-Axis
$mockedRenderer
- ->expects( $this->at( 2 ) )
+ ->expects( $this->at( 5 ) )
->method( 'drawTextBox' )
->with(
+ $this->equalTo( new ezcGraphCoordinate( 100, 130 ) ),
+ $this->equalTo( '1000' ),
+ $this->equalTo( 20 ),
+ $this->equalTo( 60 ),
+ $this->equalTo( ezcGraph::RIGHT | ezcGraph::BOTTOM )
+ );
+ $mockedRenderer
+ ->expects( $this->at( 6 ) )
+ ->method( 'drawTextBox' )
+ ->with(
+ $this->equalTo( new ezcGraphCoordinate( 100, 70 ) ),
+ $this->equalTo( '1250' ),
+ $this->equalTo( 20 ),
+ $this->equalTo( 60 ),
+ $this->equalTo( ezcGraph::RIGHT | ezcGraph::BOTTOM )
+ );
+ $mockedRenderer
+ ->expects( $this->at( 7 ) )
+ ->method( 'drawTextBox' )
+ ->with(
+ $this->equalTo( new ezcGraphCoordinate( 100, 10 ) ),
+ $this->equalTo( '1500' ),
+ $this->equalTo( 20 ),
+ $this->equalTo( 60 ),
+ $this->equalTo( ezcGraph::RIGHT | ezcGraph::BOTTOM )
);
$chart->renderer = $mockedRenderer;
@@ -789,12 +814,5 @@ class ezcGraphNumericAxisTest extends ezcTestCase
$this->fail( $e->getMessage() );
}
}
-
- public function testRender()
- {
- throw new PHPUnit2_Framework_IncompleteTestError(
- '@TODO: Implement renderer tests.'
- );
- }
}
?>
OpenPOWER on IntegriCloud