| @@ 16-33 (lines=18) @@ | ||
| 13 | * numbers ( e.g. float(201) casted to int(200) ). Solved by round the |
|
| 14 | * floating number before passing to the Box constructor. |
|
| 15 | */ |
|
| 16 | class FloatToIntCastByRoundDownscaleFilterLoaderTest extends AbstractTest |
|
| 17 | { |
|
| 18 | public function testLoad() |
|
| 19 | { |
|
| 20 | $loader = new DownscaleFilterLoader(); |
|
| 21 | $imagine = new Imagine(); |
|
| 22 | $image = $imagine->open(__DIR__.'/../../../Fixtures/assets/square-300x300.png'); |
|
| 23 | ||
| 24 | $options = array( |
|
| 25 | 'max' => array(201, 201), |
|
| 26 | ); |
|
| 27 | ||
| 28 | $image = $loader->load($image, $options); |
|
| 29 | $size = $image->getSize(); |
|
| 30 | ||
| 31 | $this->assertEquals($options['max'], array($size->getWidth(), $size->getHeight())); |
|
| 32 | } |
|
| 33 | } |
|
| 34 | ||
| @@ 16-33 (lines=18) @@ | ||
| 13 | * numbers ( e.g. float(201) casted to int(200) ). Solved by round the |
|
| 14 | * floating number before passing to the Box constructor. |
|
| 15 | */ |
|
| 16 | class FloatToIntCastByRoundUpscaleFilterLoaderTest extends AbstractTest |
|
| 17 | { |
|
| 18 | public function testLoad() |
|
| 19 | { |
|
| 20 | $loader = new UpscaleFilterLoader(); |
|
| 21 | $imagine = new Imagine(); |
|
| 22 | $image = $imagine->open(__DIR__.'/../../../Fixtures/assets/square-50x50.png'); |
|
| 23 | ||
| 24 | $options = array( |
|
| 25 | 'min' => array(201, 201), |
|
| 26 | ); |
|
| 27 | ||
| 28 | $image = $loader->load($image, $options); |
|
| 29 | $size = $image->getSize(); |
|
| 30 | ||
| 31 | $this->assertEquals($options['min'], array($size->getWidth(), $size->getHeight())); |
|
| 32 | } |
|
| 33 | } |
|
| 34 | ||