From 988be2f138dd038bfdc8f1801d53cd1fbd20b7ff Mon Sep 17 00:00:00 2001 From: EA Durbin Date: Thu, 31 Aug 2006 02:23:01 +0000 Subject: [PATCH] Fix a misnamed variable in image::resize_image_border() and add a unit test to make sure we call this function to test it --- include/image.php | 2 +- unit_test/test_image.php | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/include/image.php b/include/image.php index 4235932..8e23b6b 100644 --- a/include/image.php +++ b/include/image.php @@ -270,7 +270,7 @@ class Image { ." in $sBorderColor"); imagedestroy($this->oImage); $this->oImage = $new; - $this->iWidth = $new_witdh; + $this->iWidth = $iNewWidth; $this->iHeight= $iNewHeight; } diff --git a/unit_test/test_image.php b/unit_test/test_image.php index b25e558..8fa6de4 100644 --- a/unit_test/test_image.php +++ b/unit_test/test_image.php @@ -217,7 +217,23 @@ function test_image_add_watermark() return true; } +function test_resize_image_border() +{ + test_start(__FUNCTION__); + $sBorderColor = '#00EEFF'; + $iBorderWidth = 1; + $iNewWidth = 3; + $iNewHeight = 3; + $sImageFilename = TEST_IMAGE_FILENAME; + /* create a new image from a known image file */ + $oImage = new Image($sImageFilename); + + /* resize the image with a border */ + $oImage->resize_image_border($sBorderColor, $iBorderWidth, $iNewWidth, $iNewHeight); + + return true; +} if(!test_image_constructor()) @@ -245,4 +261,8 @@ if(!test_image_add_watermark()) else echo "test_image_add_watermark() passed\n"; -?> \ No newline at end of file +if(!test_resize_image_border()) + echo "test_resize_image_border() failed!\n"; +else + echo "test_resize_image_border() passed\n"; +?>