From 28172a9efcfce8681dc475c525c4617fbd51dc66 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Sun, 18 May 2014 17:51:27 +0200 Subject: [PATCH] added testSaveImageWithoutParameter --- tests/GdSystemTest.php | 26 ++++++++++++++++++++++++++ tests/ImagickSystemTest.php | 26 ++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/tests/GdSystemTest.php b/tests/GdSystemTest.php index 57b76c7f..2db20a94 100644 --- a/tests/GdSystemTest.php +++ b/tests/GdSystemTest.php @@ -1430,6 +1430,32 @@ class GdSystemTest extends PHPUnit_Framework_TestCase @unlink($save_as); } + public function testSaveImageWithoutParameter() + { + $path = 'tests/tmp/bar.png'; + + // create temp. test image (red) + $img = $this->manager()->canvas(16, 16, '#ff0000'); + $img->save($path); + $img->destroy(); + + // open test image again + $img = $this->manager()->make($path); + $this->assertColorAtPosition('#ff0000', $img, 0, 0); + + // fill with green and save wthout paramater + $img->fill('#00ff00'); + $img->save(); + $img->destroy(); + + // re-open test image (should be green) + $img = $this->manager()->make($path); + $this->assertColorAtPosition('#00ff00', $img, 0, 0); + $img->destroy(); + + @unlink($path); + } + public function testDestroy() { $img = $this->manager()->make('tests/images/trim.png'); diff --git a/tests/ImagickSystemTest.php b/tests/ImagickSystemTest.php index 21adc2df..af686ceb 100644 --- a/tests/ImagickSystemTest.php +++ b/tests/ImagickSystemTest.php @@ -1412,6 +1412,32 @@ class ImagickSystemTest extends PHPUnit_Framework_TestCase @unlink($save_as); } + public function testSaveImageWithoutParameter() + { + $path = 'tests/tmp/bar.png'; + + // create temp. test image (red) + $img = $this->manager()->canvas(16, 16, '#ff0000'); + $img->save($path); + $img->destroy(); + + // open test image again + $img = $this->manager()->make($path); + $this->assertColorAtPosition('#ff0000', $img, 0, 0); + + // fill with green and save wthout paramater + $img->fill('#00ff00'); + $img->save(); + $img->destroy(); + + // re-open test image (should be green) + $img = $this->manager()->make($path); + $this->assertColorAtPosition('#00ff00', $img, 0, 0); + $img->destroy(); + + @unlink($path); + } + /** * @expectedException ImagickException */