1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-07-23 09:41:39 +02:00
Files
php-cimage/test/CImageResizerTest.php
2015-10-27 00:21:36 +01:00

44 lines
1.1 KiB
PHP

<?php
/**
* A testclass
*
*/
class CImageResizerTest extends \PHPUnit_Framework_TestCase
{
/**
* Provider
*
* @return array
*/
public function providerImages()
{
return array(
// Same as source, does not set target
array(100, 100, null, null, null, 1, null, null),
array(100, 150, null, null, null, 1, null, null),
array(150, 100, null, null, null, 1, null, null),
);
}
/**
* Test
*
* @dataProvider providerImages
*
* @return void
*/
public function testResize1($srcWidth, $srcHeight, $targetWidth, $targetHeigth, $aspectRatio, $dpr, $expectedWidth, $expectedHeight)
{
$img = new CImageResizer();
$img->setSource($srcWidth, $srcHeight)
->setBaseForCalculateTarget($targetWidth, $targetHeigth, $aspectRatio, $dpr)
->prepareTargetDimensions();
$this->assertEquals($expectedWidth, $img->width(), "Width not correct.");
$this->assertEquals($expectedHeight, $img->height(), "Heigth not correct.");
}
}