1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-08-06 16:16:39 +02:00

Added conversion to sRGB using option , partly working, #120

This commit is contained in:
Mikael Roos
2015-10-23 14:19:46 +02:00
parent a62425e759
commit aedce7021f
6 changed files with 184 additions and 5 deletions

70
test/CImageSRGBTest.php Normal file
View File

@@ -0,0 +1,70 @@
<?php
/**
* A testclass
*
*/
class CImageSRGBTest extends \PHPUnit_Framework_TestCase
{
private $srgbDir = "srgb";
private $cache;
/**
* Setup before test
*
* @return void
*/
protected function setUp()
{
$this->cache = CACHE_PATH . "/" . $this->srgbDir;
if (!is_writable($this->cache)) {
mkdir($this->cache);
}
}
/**
* Test
*
* @return void
*/
public function testCreate1()
{
$img = new CImage();
$filename = $img->convert2sRGBColorSpace(
'car.png',
IMAGE_PATH,
$this->cache
);
if (class_exists("Imagick")) {
$this->assertEquals("car.png", basename($filename), "Filename not as expected on image.");
} else {
$this->assertFalse($filename, "ImageMagick not installed, silent fail");
}
}
/**
* Test
*
* @return void
*/
public function testCreate2()
{
$img = new CImage();
$filename = $img->convert2sRGBColorSpace(
'car.jpg',
IMAGE_PATH,
$this->cache
);
$this->assertFalse($filename);
}
}