summaryrefslogtreecommitdiffstats
path: root/tests/font_test.php
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-06-02 14:43:09 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-06-02 14:43:09 +0000
commitb6efb38bbd2ef8d9f9ac110b852ac36711b8c7a7 (patch)
treeece31ec907520b7bf0a6843894b0cc83ce77b407 /tests/font_test.php
parentc2757a0ecfaa7337c34370b831ec7c739ff93e89 (diff)
downloadzetacomponents-graph-b6efb38bbd2ef8d9f9ac110b852ac36711b8c7a7.zip
zetacomponents-graph-b6efb38bbd2ef8d9f9ac110b852ac36711b8c7a7.tar.gz
- Fixed issue with custom fonts for single elements
Diffstat (limited to 'tests/font_test.php')
-rw-r--r--tests/font_test.php54
1 files changed, 50 insertions, 4 deletions
diff --git a/tests/font_test.php b/tests/font_test.php
index 3c06078..ce389c0 100644
--- a/tests/font_test.php
+++ b/tests/font_test.php
@@ -102,9 +102,9 @@ class ezcGraphFontTest extends ezcTestCase
{
try
{
- $chart = ezcGraph::create( 'Pie' );
+ $chart = ezcGraph::create( 'Line' );
$chart->options->font = $this->basePath . 'font.ttf';
- $chart->legend->font->font = $this->basePath . 'font2.ttf';
+ $chart->legend->font = $this->basePath . 'font2.ttf';
}
catch ( Exception $e )
{
@@ -114,7 +114,13 @@ class ezcGraphFontTest extends ezcTestCase
$this->assertEquals(
$this->basePath . 'font.ttf',
$chart->options->font->font,
- 'Font face was not properly assigned.'
+ 'General font face should be the old one.'
+ );
+
+ $this->assertEquals(
+ $this->basePath . 'font.ttf',
+ $chart->title->font->font,
+ 'Font face for X axis should be the old one.'
);
$this->assertTrue(
@@ -125,7 +131,47 @@ class ezcGraphFontTest extends ezcTestCase
$this->assertEquals(
$this->basePath . 'font2.ttf',
$chart->legend->font->font,
- 'Font face was not properly assigned.'
+ 'Font face for legend has not changed.'
+ );
+ }
+
+ public function testSetFontForElementWithRendering()
+ {
+ 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->options->font = $this->basePath . 'font.ttf';
+ $chart->legend->font = $this->basePath . 'font2.ttf';
+ $chart->render( 500, 200 );
+ }
+ catch ( Exception $e )
+ {
+ $this->fail( $e->getMessage() );
+ }
+
+ $this->assertEquals(
+ $this->basePath . 'font.ttf',
+ $chart->options->font->font,
+ 'General font face should be the old one.'
+ );
+
+ $this->assertEquals(
+ $this->basePath . 'font.ttf',
+ $chart->title->font->font,
+ 'Font face for X axis should be the old one.'
+ );
+
+ $this->assertTrue(
+ $chart->legend->font instanceof ezcGraphFontOptions,
+ 'No fontOptions object was created.'
+ );
+
+ $this->assertEquals(
+ $this->basePath . 'font2.ttf',
+ $chart->legend->font->font,
+ 'Font face for legend has not changed.'
);
}
}
OpenPOWER on IntegriCloud