summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-09-11 08:41:25 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-09-11 08:41:25 +0000
commitb269dab61f162292ba4ad1f3cb400e182be23cee (patch)
tree0d70d5e446cd956427478ae04120383e7c7e0c08
parentb2f80e187bc61f0e9510c5cff18f6bb8e8eac4e6 (diff)
downloadzetacomponents-graph-b269dab61f162292ba4ad1f3cb400e182be23cee.zip
zetacomponents-graph-b269dab61f162292ba4ad1f3cb400e182be23cee.tar.gz
- Skip tests if extension or extension feature is not available
-rw-r--r--src/driver/gd.php8
-rw-r--r--tests/chart_test.php6
-rw-r--r--tests/driver_gd_test.php41
-rw-r--r--tests/line_test.php2
-rw-r--r--tests/pie_test.php12
-rw-r--r--tests/renderer_3d_test.php6
6 files changed, 70 insertions, 5 deletions
diff --git a/src/driver/gd.php b/src/driver/gd.php
index 6d066e6..bf9249b 100644
--- a/src/driver/gd.php
+++ b/src/driver/gd.php
@@ -234,7 +234,7 @@ class ezcGraphGdDriver extends ezcGraphDriver
case ezcGraph::TTF_FONT:
switch ( true )
{
- case function_exists( 'imageftbbox' ) && !$this->options->forceNativeTTF:
+ case ezcBaseFeatures::hasFunction( 'imageftbbox' ) && !$this->options->forceNativeTTF:
$boundings = imageFtBBox( $size, 0, $font->path, $text );
return new ezcGraphBoundings(
$boundings[0],
@@ -242,7 +242,7 @@ class ezcGraphGdDriver extends ezcGraphDriver
$boundings[4],
$boundings[5]
);
- case function_exists( 'imagettfbbox' ):
+ case ezcBaseFeatures::hasFunction( 'imagettfbbox' ):
$boundings = imageTtfBBox( $size, 0, $font->path, $text );
return new ezcGraphBoundings(
$boundings[0],
@@ -285,7 +285,7 @@ class ezcGraphGdDriver extends ezcGraphDriver
case ezcGraph::TTF_FONT:
switch ( true )
{
- case function_exists( 'imagefttext' ) && !$this->options->forceNativeTTF:
+ case ezcBaseFeatures::hasFunction( 'imagefttext' ) && !$this->options->forceNativeTTF:
imageFtText(
$image,
$size,
@@ -297,7 +297,7 @@ class ezcGraphGdDriver extends ezcGraphDriver
$text
);
break;
- case function_exists( 'imagettftext' ):
+ case ezcBaseFeatures::hasFunction( 'imagettftext' ):
imageTtfText(
$image,
$size,
diff --git a/tests/chart_test.php b/tests/chart_test.php
index 4ebf8ae..4baef53 100644
--- a/tests/chart_test.php
+++ b/tests/chart_test.php
@@ -167,6 +167,12 @@ class ezcGraphChartTest extends ezcTestCase
public function testSetDriver()
{
+ if ( !ezcBaseFeatures::hasExtensionSupport( 'gd' ) &&
+ ( ezcBaseFeatures::hasFunction( 'imagefttext' ) || ezcBaseFeatures::hasFunction( 'imagettftext' ) ) )
+ {
+ $this->markTestSkipped( 'This test needs ext/gd with native ttf support or FreeType 2 support.' );
+ }
+
$pieChart = new ezcGraphPieChart();
$driver = $pieChart->driver = new ezcGraphGdDriver();
diff --git a/tests/driver_gd_test.php b/tests/driver_gd_test.php
index 0be109c..48e2a32 100644
--- a/tests/driver_gd_test.php
+++ b/tests/driver_gd_test.php
@@ -41,6 +41,12 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
*/
public function setUp()
{
+ if ( !ezcBaseFeatures::hasExtensionSupport( 'gd' ) &&
+ ( ezcBaseFeatures::hasFunction( 'imagefttext' ) || ezcBaseFeatures::hasFunction( 'imagettftext' ) ) )
+ {
+ $this->markTestSkipped( 'This test needs ext/gd with native ttf support or FreeType 2 support.' );
+ }
+
static $i = 0;
$this->tempDir = $this->createTempDir( __CLASS__ . sprintf( '_%03d_', ++$i ) ) . '/';
$this->basePath = dirname( __FILE__ ) . '/data/';
@@ -1273,6 +1279,11 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
public function testDrawSmallNativeTTFStringWithSpecialChars()
{
+ if ( !ezcBaseFeatures::hasFunction( 'imagettftext' ) )
+ {
+ $this->markTestSkipped( 'This test needs native ttf support within your gd extension.' );
+ }
+
$filename = $this->tempDir . __FUNCTION__ . '.png';
$this->driver->options->forceNativeTTF = true;
@@ -1311,6 +1322,11 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
public function testDrawSmallFreeTypeStringWithSpecialChars()
{
+ if ( !ezcBaseFeatures::hasFunction( 'imagefttext' ) )
+ {
+ $this->markTestSkipped( 'This test needs FreeType 2 ttf support within your gd extension.' );
+ }
+
$filename = $this->tempDir . __FUNCTION__ . '.png';
$this->driver->drawPolygon(
@@ -1348,6 +1364,16 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
public function testDrawSmallPsStringWithSpecialChars()
{
+ if ( !ezcBaseFeatures::hasFunction( 'imagepstext' ) )
+ {
+ $this->markTestSkipped( 'This test needs Type 1 font support within your gd extension.' );
+ }
+
+ if ( !ezcBaseFeatures::hasFunction( 'imagepstext' ) )
+ {
+ $this->markTestSkipped( 'This test needs Type 1 font support within your gd extension.' );
+ }
+
$filename = $this->tempDir . __FUNCTION__ . '.png';
$this->driver->options->font->path = $this->basePath . 'ps_font.pfb';
@@ -1386,6 +1412,11 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
public function testDrawNativeTTFText()
{
+ if ( !ezcBaseFeatures::hasFunction( 'imagettftext' ) )
+ {
+ $this->markTestSkipped( 'This test needs native ttf support within your gd extension.' );
+ }
+
$filename = $this->tempDir . __FUNCTION__ . '.png';
$this->driver->options->font->path = $this->basePath . 'font.ttf';
$this->driver->options->forceNativeTTF = true;
@@ -1415,6 +1446,11 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
public function testDrawFreeTypeTTFText()
{
+ if ( !ezcBaseFeatures::hasFunction( 'imagefttext' ) )
+ {
+ $this->markTestSkipped( 'This test needs FreeType 2 ttf support within your gd extension.' );
+ }
+
$filename = $this->tempDir . __FUNCTION__ . '.png';
$this->driver->options->font->path = $this->basePath . 'font.ttf';
@@ -1443,6 +1479,11 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
public function testDrawPSText()
{
+ if ( !ezcBaseFeatures::hasFunction( 'imagepstext' ) )
+ {
+ $this->markTestSkipped( 'This test needs Type 1 font support within your gd extension.' );
+ }
+
$filename = $this->tempDir . __FUNCTION__ . '.png';
$this->driver->options->font->path = $this->basePath . 'ps_font.pfb';
diff --git a/tests/line_test.php b/tests/line_test.php
index e0a03d7..c19200f 100644
--- a/tests/line_test.php
+++ b/tests/line_test.php
@@ -39,7 +39,7 @@ class ezcGraphLineChartTest extends ezcTestCase
{
$this->markTestSkipped( "These tests required atleast PHP 5.1.3" );
}
- $this->tempDir = $this->createTempDir( 'ezcGraphGdDriverTest' . sprintf( '_%03d_', ++$i ) ) . '/';
+ $this->tempDir = $this->createTempDir( __CLASS__ . sprintf( '_%03d_', ++$i ) ) . '/';
$this->basePath = dirname( __FILE__ ) . '/data/';
}
diff --git a/tests/pie_test.php b/tests/pie_test.php
index bbea502..00d9292 100644
--- a/tests/pie_test.php
+++ b/tests/pie_test.php
@@ -183,6 +183,12 @@ class ezcGraphPieChartTest extends ezcImageTestCase
public function testRenderPieChartWithLotsOfLabels()
{
+ if ( !ezcBaseFeatures::hasExtensionSupport( 'gd' ) &&
+ ( ezcBaseFeatures::hasFunction( 'imagefttext' ) || ezcBaseFeatures::hasFunction( 'imagettftext' ) ) )
+ {
+ $this->markTestSkipped( 'This test needs ext/gd with native ttf support or FreeType 2 support.' );
+ }
+
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
@@ -204,6 +210,12 @@ class ezcGraphPieChartTest extends ezcImageTestCase
public function testRenderPortraitPieChartWithLotsOfLabels()
{
+ if ( !ezcBaseFeatures::hasExtensionSupport( 'gd' ) &&
+ ( ezcBaseFeatures::hasFunction( 'imagefttext' ) || ezcBaseFeatures::hasFunction( 'imagettftext' ) ) )
+ {
+ $this->markTestSkipped( 'This test needs ext/gd with native ttf support or FreeType 2 support.' );
+ }
+
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
diff --git a/tests/renderer_3d_test.php b/tests/renderer_3d_test.php
index 5dde168..0d22d80 100644
--- a/tests/renderer_3d_test.php
+++ b/tests/renderer_3d_test.php
@@ -393,6 +393,12 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
public function testRenderLabeledPieSegmentWithGleamAndShadowGD()
{
+ if ( !ezcBaseFeatures::hasExtensionSupport( 'gd' ) &&
+ ( ezcBaseFeatures::hasFunction( 'imagefttext' ) || ezcBaseFeatures::hasFunction( 'imagettftext' ) ) )
+ {
+ $this->markTestSkipped( 'This test needs ext/gd with native ttf support or FreeType 2 support.' );
+ }
+
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
OpenPOWER on IntegriCloud