From 815444c46accf9b5d6868daef2c5070bbf186476 Mon Sep 17 00:00:00 2001 From: Kore Nordmann Date: Wed, 14 Jun 2006 13:03:43 +0000 Subject: - Use margin, when rendering chart title --- tests/text_test.php | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'tests/text_test.php') diff --git a/tests/text_test.php b/tests/text_test.php index 8814dee..8cb6f36 100644 --- a/tests/text_test.php +++ b/tests/text_test.php @@ -63,6 +63,17 @@ class ezcGraphTextTest extends ezcTestCase $this->equalTo( 18 ), $this->equalTo( ezcGraph::CENTER | ezcGraph::MIDDLE ) ); + // Test for margin + $mockedRenderer + ->expects( $this->at( 1 ) ) + ->method( 'drawTextBox' ) + ->with( + $this->equalTo( new ezcGraphCoordinate( 17, 22 ) ), + $this->equalTo( 'sample' ), + $this->equalTo( 81 ), + $this->equalTo( 12 ), + $this->equalTo( ezcGraph::LEFT | ezcGraph::MIDDLE ) + ); $chart->renderer = $mockedRenderer; @@ -97,6 +108,48 @@ class ezcGraphTextTest extends ezcTestCase $chart->render( 500, 200 ); } + + public function testRenderTextTopMargin() + { + $chart = ezcGraph::create( 'Line' ); + $chart->sample = array( 'foo' => 1, 'bar' => 10 ); + + $chart->title = 'Title of a chart'; + $chart->title->position = ezcGraph::TOP; + $chart->title->margin = 5; + + $mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array( + 'drawTextBox', + ) ); + + // Y-Axis + $mockedRenderer + ->expects( $this->at( 0 ) ) + ->method( 'drawTextBox' ) + ->with( + $this->equalTo( new ezcGraphCoordinate( 1, 1 ) ), + $this->equalTo( 'Title of a chart' ), + $this->equalTo( 498 ), + $this->equalTo( 18 ), + $this->equalTo( ezcGraph::CENTER | ezcGraph::MIDDLE ) + ); + // Test for margin + $mockedRenderer + ->expects( $this->at( 1 ) ) + ->method( 'drawTextBox' ) + ->with( + $this->equalTo( new ezcGraphCoordinate( 17, 27 ) ), + $this->equalTo( 'sample' ), + $this->equalTo( 81 ), + $this->equalTo( 12 ), + $this->equalTo( ezcGraph::LEFT | ezcGraph::MIDDLE ) + ); + + + $chart->renderer = $mockedRenderer; + + $chart->render( 500, 200 ); + } } ?> -- cgit v1.1