diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-06-14 13:03:43 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-06-14 13:03:43 +0000 |
commit | 815444c46accf9b5d6868daef2c5070bbf186476 (patch) | |
tree | 0f5c923d0d06fb43e60f7773089b0880d057b28e /tests/text_test.php | |
parent | 8e7294f3023f6b3836bbebb89d5c2845ab667354 (diff) | |
download | zetacomponents-graph-815444c46accf9b5d6868daef2c5070bbf186476.zip zetacomponents-graph-815444c46accf9b5d6868daef2c5070bbf186476.tar.gz |
- Use margin, when rendering chart title
Diffstat (limited to 'tests/text_test.php')
-rw-r--r-- | tests/text_test.php | 53 |
1 files changed, 53 insertions, 0 deletions
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 ); + } } ?> |