diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-06-07 12:28:53 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-06-07 12:28:53 +0000 |
commit | c8ce91759e37ab7afb61068862e4a057ce1aa5b8 (patch) | |
tree | ce983224b7f0259d8f59dee891cdbede9104a6a9 /tests/numeric_axis_test.php | |
parent | 03c4ad60f8fd30891fbbf981f6d56f6b1b5007c7 (diff) | |
download | zetacomponents-graph-c8ce91759e37ab7afb61068862e4a057ce1aa5b8.zip zetacomponents-graph-c8ce91759e37ab7afb61068862e4a057ce1aa5b8.tar.gz |
- Cleaned up tests
Diffstat (limited to 'tests/numeric_axis_test.php')
-rw-r--r-- | tests/numeric_axis_test.php | 660 |
1 files changed, 251 insertions, 409 deletions
diff --git a/tests/numeric_axis_test.php b/tests/numeric_axis_test.php index 6dd396a..e5378b2 100644 --- a/tests/numeric_axis_test.php +++ b/tests/numeric_axis_test.php @@ -47,23 +47,16 @@ class ezcGraphNumericAxisTest extends ezcTestCase $this->assertTrue( $chart->Y_axis instanceof ezcGraphChartElementNumericAxis - ); + ); } public function testManualScaling() { - try - { - $chart = ezcGraph::create( 'Line' ); - $chart->Y_axis->min = 10; - $chart->Y_axis->max = 50; - $chart->Y_axis->majorStep = 10; - $chart->Y_axis->minorStep = 1; - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->Y_axis->min = 10; + $chart->Y_axis->max = 50; + $chart->Y_axis->majorStep = 10; + $chart->Y_axis->minorStep = 1; $this->assertEquals( 10., @@ -88,18 +81,11 @@ class ezcGraphNumericAxisTest extends ezcTestCase public function testManualScalingPublicProperties() { - try - { - $chart = ezcGraph::create( 'Line' ); - $chart->Y_axis->min = 10; - $chart->Y_axis->max = 50; - $chart->Y_axis->majorStep = 10; - $chart->Y_axis->minorStep = 1; - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->Y_axis->min = 10; + $chart->Y_axis->max = 50; + $chart->Y_axis->majorStep = 10; + $chart->Y_axis->minorStep = 1; $this->assertEquals( 10., @@ -128,17 +114,9 @@ class ezcGraphNumericAxisTest extends ezcTestCase public function testAutomagicScalingSingle() { - try - { - $chart = ezcGraph::create( 'Line' ); - $chart->sample = array( 2000 => 20, 70, 12, 130 ); - $chart->sample->color = '#FF0000'; - $chart->render( 500, 200 ); - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->sample = array( 2000 => 20, 70, 12, 130 ); + $chart->render( 500, 200 ); $this->assertEquals( 0., @@ -167,17 +145,9 @@ class ezcGraphNumericAxisTest extends ezcTestCase public function testAutomagicScalingSingle2() { - try - { - $chart = ezcGraph::create( 'Line' ); - $chart->sample = array( 2000 => 1, 4.3, .2, 3.82 ); - $chart->sample->color = '#FF0000'; - $chart->render( 500, 200 ); - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->sample = array( 2000 => 1, 4.3, .2, 3.82 ); + $chart->render( 500, 200 ); $this->assertEquals( 0., @@ -206,17 +176,9 @@ class ezcGraphNumericAxisTest extends ezcTestCase public function testAutomagicScalingSingle3() { - try - { - $chart = ezcGraph::create( 'Line' ); - $chart->sample = array( 2000 => -1.8, 4.3, .2, 3.82 ); - $chart->sample->color = '#FF0000'; - $chart->render( 500, 200 ); - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->sample = array( 2000 => -1.8, 4.3, .2, 3.82 ); + $chart->render( 500, 200 ); $this->assertEquals( -2.5, @@ -245,17 +207,9 @@ class ezcGraphNumericAxisTest extends ezcTestCase public function testAutomagicScalingSingle4() { - try - { - $chart = ezcGraph::create( 'Line' ); - $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 ); - $chart->sample->color = '#FF0000'; - $chart->render( 500, 200 ); - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 ); + $chart->render( 500, 200 ); $this->assertEquals( 1000., @@ -284,19 +238,10 @@ class ezcGraphNumericAxisTest extends ezcTestCase public function testAutomagicScalingMultiple() { - 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'; - $chart->render( 500, 200 ); - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 ); + $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 ); + $chart->render( 500, 200 ); $this->assertEquals( 1000., @@ -325,18 +270,10 @@ class ezcGraphNumericAxisTest extends ezcTestCase public function testMixedAutomagicAndManualScaling() { - try - { - $chart = ezcGraph::create( 'Line' ); - $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 ); - $chart->sample->color = '#FF0000'; - $chart->Y_axis->majorStep = 50; - $chart->render( 500, 200 ); - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 ); + $chart->Y_axis->majorStep = 50; + $chart->render( 500, 200 ); $this->assertEquals( 1000., @@ -365,18 +302,10 @@ class ezcGraphNumericAxisTest extends ezcTestCase public function testPositionLeft() { - try - { - $chart = ezcGraph::create( 'Line' ); - $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 ); - $chart->sample->color = '#FF0000'; - $chart->Y_axis->position = ezcGraph::LEFT; - $chart->render( 500, 200 ); - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 ); + $chart->Y_axis->position = ezcGraph::LEFT; + $chart->render( 500, 200 ); $testBoundings = new ezcGraphBoundings(); $testBoundings->x0 = 50; @@ -411,18 +340,10 @@ class ezcGraphNumericAxisTest extends ezcTestCase public function testPositionRight() { - try - { - $chart = ezcGraph::create( 'Line' ); - $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 ); - $chart->sample->color = '#FF0000'; - $chart->Y_axis->position = ezcGraph::RIGHT; - $chart->render( 500, 200 ); - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 ); + $chart->Y_axis->position = ezcGraph::RIGHT; + $chart->render( 500, 200 ); $testBoundings = new ezcGraphBoundings(); $testBoundings->x0 = 50; @@ -457,18 +378,10 @@ class ezcGraphNumericAxisTest extends ezcTestCase public function testPositionTop() { - try - { - $chart = ezcGraph::create( 'Line' ); - $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 ); - $chart->sample->color = '#FF0000'; - $chart->Y_axis->position = ezcGraph::TOP; - $chart->render( 500, 200 ); - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 ); + $chart->Y_axis->position = ezcGraph::TOP; + $chart->render( 500, 200 ); $testBoundings = new ezcGraphBoundings(); $testBoundings->x0 = 50; @@ -503,18 +416,10 @@ class ezcGraphNumericAxisTest extends ezcTestCase public function testPositionBottom() { - try - { - $chart = ezcGraph::create( 'Line' ); - $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 ); - $chart->sample->color = '#FF0000'; - $chart->Y_axis->position = ezcGraph::BOTTOM; - $chart->render( 500, 200 ); - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 ); + $chart->Y_axis->position = ezcGraph::BOTTOM; + $chart->render( 500, 200 ); $testBoundings = new ezcGraphBoundings(); $testBoundings->x0 = 50; @@ -549,19 +454,11 @@ class ezcGraphNumericAxisTest extends ezcTestCase public function testPositionLeftNegativMinimum() { - try - { - $chart = ezcGraph::create( 'Line' ); - $chart->sample = array( 2000 => -300, 1300, 1012, 1450 ); - $chart->sample->color = '#FF0000'; - $chart->Y_axis->majorStep = 500; - $chart->Y_axis->position = ezcGraph::LEFT; - $chart->render( 500, 200 ); - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->sample = array( 2000 => -300, 1300, 1012, 1450 ); + $chart->Y_axis->majorStep = 500; + $chart->Y_axis->position = ezcGraph::LEFT; + $chart->render( 500, 200 ); $testBoundings = new ezcGraphBoundings(); $testBoundings->x0 = 50; @@ -596,21 +493,11 @@ class ezcGraphNumericAxisTest extends ezcTestCase public function testNullPositionMultipleDatasets() { - try - { - $chart = ezcGraph::create( 'Line' ); - $chart->sampleData = array( 'sample 1' => 234, 'sample 2' => -21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1); - $chart->sampleData->color = '#CC0000'; - $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->render( 500, 200 ); - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->sampleData = array( 'sample 1' => 234, 'sample 2' => -21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1); + $chart->moreData = array( 'sample 1' => 112, 'sample 2' => 54, 'sample 3' => 12, 'sample 4' => -167, 'sample 5' => 329); + $chart->evenMoreData = array( 'sample 1' => 300, 'sample 2' => -30, 'sample 3' => 220, 'sample 4' => 67, 'sample 5' => 450); + $chart->render( 500, 200 ); $testBoundings = new ezcGraphBoundings(); $testBoundings->x0 = 100; @@ -627,261 +514,216 @@ class ezcGraphNumericAxisTest extends ezcTestCase public function testRenderNumericAxisBase() { - 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', - ) ); - - // Y-Axis - // Base line - $mockedRenderer - ->expects( $this->at( 5 ) ) - ->method( 'drawLine' ) - ->with( - $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), - $this->equalTo( new ezcGraphCoordinate( 120, 200 ) ), - $this->equalTo( new ezcGraphCoordinate( 120, 0 ) ), - $this->equalTo( false ) - ); - - $chart->renderer = $mockedRenderer; - - $chart->render( 500, 200 ); - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 ); + $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 ); + + $mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array( + 'drawLine', + ) ); + + // Y-Axis + // Base line + $mockedRenderer + ->expects( $this->at( 5 ) ) + ->method( 'drawLine' ) + ->with( + $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), + $this->equalTo( new ezcGraphCoordinate( 120, 200 ) ), + $this->equalTo( new ezcGraphCoordinate( 120, 0 ) ), + $this->equalTo( false ) + ); + + $chart->renderer = $mockedRenderer; + + $chart->render( 500, 200 ); } public function testRenderNumericAxisArrowHead() { - 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( - 'drawPolygon', - ) ); - - // X-Axis - $mockedRenderer - ->expects( $this->at( 1 ) ) - ->method( 'drawPolygon' ) - ->with( - $this->equalTo( array( - new ezcGraphCoordinate( 120, 0 ), - new ezcGraphCoordinate( 123, 5 ), - new ezcGraphCoordinate( 118, 5 ), - ) ), - $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), - $this->equalTo( true ) - ); - - $chart->renderer = $mockedRenderer; - - $chart->render( 500, 200 ); - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 ); + $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 ); + + $mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array( + 'drawPolygon', + ) ); + + // X-Axis + $mockedRenderer + ->expects( $this->at( 1 ) ) + ->method( 'drawPolygon' ) + ->with( + $this->equalTo( array( + new ezcGraphCoordinate( 120, 0 ), + new ezcGraphCoordinate( 123, 5 ), + new ezcGraphCoordinate( 118, 5 ), + ) ), + $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), + $this->equalTo( true ) + ); + + $chart->renderer = $mockedRenderer; + + $chart->render( 500, 200 ); } public function testRenderNumericAxisMajor() { - 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', - ) ); - - // Y-Axis - // Major step lines - $mockedRenderer - ->expects( $this->at( 6 ) ) - ->method( 'drawLine' ) - ->with( - $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), - $this->equalTo( new ezcGraphCoordinate( 124, 190 ) ), - $this->equalTo( new ezcGraphCoordinate( 116, 190 ) ), - $this->equalTo( false ) - ); - $mockedRenderer - ->expects( $this->at( 7 ) ) - ->method( 'drawLine' ) - ->with( - $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), - $this->equalTo( new ezcGraphCoordinate( 124, 130 ) ), - $this->equalTo( new ezcGraphCoordinate( 116, 130 ) ), - $this->equalTo( false ) - ); - $mockedRenderer - ->expects( $this->at( 8 ) ) - ->method( 'drawLine' ) - ->with( - $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), - $this->equalTo( new ezcGraphCoordinate( 124, 70 ) ), - $this->equalTo( new ezcGraphCoordinate( 116, 70 ) ), - $this->equalTo( false ) - ); - $mockedRenderer - ->expects( $this->at( 9 ) ) - ->method( 'drawLine' ) - ->with( - $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), - $this->equalTo( new ezcGraphCoordinate( 124, 10 ) ), - $this->equalTo( new ezcGraphCoordinate( 116, 10 ) ), - $this->equalTo( false ) - ); - - - $chart->renderer = $mockedRenderer; - - $chart->render( 500, 200 ); - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 ); + $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 ); + + $mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array( + 'drawLine', + ) ); + + // Y-Axis + // Major step lines + $mockedRenderer + ->expects( $this->at( 6 ) ) + ->method( 'drawLine' ) + ->with( + $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), + $this->equalTo( new ezcGraphCoordinate( 124, 190 ) ), + $this->equalTo( new ezcGraphCoordinate( 116, 190 ) ), + $this->equalTo( false ) + ); + $mockedRenderer + ->expects( $this->at( 7 ) ) + ->method( 'drawLine' ) + ->with( + $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), + $this->equalTo( new ezcGraphCoordinate( 124, 130 ) ), + $this->equalTo( new ezcGraphCoordinate( 116, 130 ) ), + $this->equalTo( false ) + ); + $mockedRenderer + ->expects( $this->at( 8 ) ) + ->method( 'drawLine' ) + ->with( + $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), + $this->equalTo( new ezcGraphCoordinate( 124, 70 ) ), + $this->equalTo( new ezcGraphCoordinate( 116, 70 ) ), + $this->equalTo( false ) + ); + $mockedRenderer + ->expects( $this->at( 9 ) ) + ->method( 'drawLine' ) + ->with( + $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), + $this->equalTo( new ezcGraphCoordinate( 124, 10 ) ), + $this->equalTo( new ezcGraphCoordinate( 116, 10 ) ), + $this->equalTo( false ) + ); + + + $chart->renderer = $mockedRenderer; + + $chart->render( 500, 200 ); } public function testRenderNumericAxisMinor() { - 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', - ) ); - - // Y-Axis - // Minor step lines - $mockedRenderer - ->expects( $this->at( 10 ) ) - ->method( 'drawLine' ) - ->with( - $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), - $this->equalTo( new ezcGraphCoordinate( 122, 190 ) ), - $this->equalTo( new ezcGraphCoordinate( 118, 190 ) ), - $this->equalTo( false ) - ); - $mockedRenderer - ->expects( $this->at( 11 ) ) - ->method( 'drawLine' ) - ->with( - $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), - $this->equalTo( new ezcGraphCoordinate( 122, 178 ) ), - $this->equalTo( new ezcGraphCoordinate( 118, 178 ) ), - $this->equalTo( false ) - ); - $mockedRenderer - ->expects( $this->at( 12 ) ) - ->method( 'drawLine' ) - ->with( - $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), - $this->equalTo( new ezcGraphCoordinate( 122, 166 ) ), - $this->equalTo( new ezcGraphCoordinate( 118, 166 ) ), - $this->equalTo( false ) - ); - - // Last minor step - $mockedRenderer - ->expects( $this->at( 24 ) ) - ->method( 'drawLine' ) - ->with( - $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), - $this->equalTo( new ezcGraphCoordinate( 122, 22 ) ), - $this->equalTo( new ezcGraphCoordinate( 118, 22 ) ), - $this->equalTo( false ) - ); - - $chart->renderer = $mockedRenderer; - - $chart->render( 500, 200 ); - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 ); + $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 ); + + $mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array( + 'drawLine', + ) ); + + // Y-Axis + // Minor step lines + $mockedRenderer + ->expects( $this->at( 10 ) ) + ->method( 'drawLine' ) + ->with( + $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), + $this->equalTo( new ezcGraphCoordinate( 122, 190 ) ), + $this->equalTo( new ezcGraphCoordinate( 118, 190 ) ), + $this->equalTo( false ) + ); + $mockedRenderer + ->expects( $this->at( 11 ) ) + ->method( 'drawLine' ) + ->with( + $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), + $this->equalTo( new ezcGraphCoordinate( 122, 178 ) ), + $this->equalTo( new ezcGraphCoordinate( 118, 178 ) ), + $this->equalTo( false ) + ); + $mockedRenderer + ->expects( $this->at( 12 ) ) + ->method( 'drawLine' ) + ->with( + $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), + $this->equalTo( new ezcGraphCoordinate( 122, 166 ) ), + $this->equalTo( new ezcGraphCoordinate( 118, 166 ) ), + $this->equalTo( false ) + ); + + // Last minor step + $mockedRenderer + ->expects( $this->at( 24 ) ) + ->method( 'drawLine' ) + ->with( + $this->equalTo( ezcGraphColor::fromHex( '#2E3436' ) ), + $this->equalTo( new ezcGraphCoordinate( 122, 22 ) ), + $this->equalTo( new ezcGraphCoordinate( 118, 22 ) ), + $this->equalTo( false ) + ); + + $chart->renderer = $mockedRenderer; + + $chart->render( 500, 200 ); } public function testRenderNumericAxisLabels() { - 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( 7 ) ) - ->method( 'drawTextBox' ) - ->with( - $this->equalTo( new ezcGraphCoordinate( 100, 130 ) ), - $this->equalTo( '1000' ), - $this->equalTo( 18 ), - $this->equalTo( 58 ), - $this->equalTo( ezcGraph::RIGHT | ezcGraph::BOTTOM ) - ); - $mockedRenderer - ->expects( $this->at( 8 ) ) - ->method( 'drawTextBox' ) - ->with( - $this->equalTo( new ezcGraphCoordinate( 100, 70 ) ), - $this->equalTo( '1250' ), - $this->equalTo( 18 ), - $this->equalTo( 58 ), - $this->equalTo( ezcGraph::RIGHT | ezcGraph::BOTTOM ) - ); - $mockedRenderer - ->expects( $this->at( 9 ) ) - ->method( 'drawTextBox' ) - ->with( - $this->equalTo( new ezcGraphCoordinate( 100, 10 ) ), - $this->equalTo( '1500' ), - $this->equalTo( 18 ), - $this->equalTo( 58 ), - $this->equalTo( ezcGraph::RIGHT | ezcGraph::BOTTOM ) - ); - - $chart->renderer = $mockedRenderer; - - $chart->render( 500, 200 ); - } - catch ( Exception $e ) - { - $this->fail( $e->getMessage() ); - } + $chart = ezcGraph::create( 'Line' ); + $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 ); + $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 ); + + $mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array( + 'drawTextBox', + ) ); + + // Y-Axis + $mockedRenderer + ->expects( $this->at( 7 ) ) + ->method( 'drawTextBox' ) + ->with( + $this->equalTo( new ezcGraphCoordinate( 100, 130 ) ), + $this->equalTo( '1000' ), + $this->equalTo( 18 ), + $this->equalTo( 58 ), + $this->equalTo( ezcGraph::RIGHT | ezcGraph::BOTTOM ) + ); + $mockedRenderer + ->expects( $this->at( 8 ) ) + ->method( 'drawTextBox' ) + ->with( + $this->equalTo( new ezcGraphCoordinate( 100, 70 ) ), + $this->equalTo( '1250' ), + $this->equalTo( 18 ), + $this->equalTo( 58 ), + $this->equalTo( ezcGraph::RIGHT | ezcGraph::BOTTOM ) + ); + $mockedRenderer + ->expects( $this->at( 9 ) ) + ->method( 'drawTextBox' ) + ->with( + $this->equalTo( new ezcGraphCoordinate( 100, 10 ) ), + $this->equalTo( '1500' ), + $this->equalTo( 18 ), + $this->equalTo( 58 ), + $this->equalTo( ezcGraph::RIGHT | ezcGraph::BOTTOM ) + ); + + $chart->renderer = $mockedRenderer; + + $chart->render( 500, 200 ); } } ?> |