-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #503 from wodka/master
implement interlace filter
- Loading branch information
Showing
7 changed files
with
88 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Liip\ImagineBundle\Imagine\Filter\Loader; | ||
|
||
use Imagine\Image\ImageInterface; | ||
|
||
class InterlaceFilterLoader implements LoaderInterface | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function load(ImageInterface $image, array $options = array()) | ||
{ | ||
$mode = ImageInterface::INTERLACE_LINE; | ||
if (!empty($options['mode'])) { | ||
$mode = $options['mode']; | ||
} | ||
|
||
$image->interlace($mode); | ||
|
||
return $image; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Tests/Functional/Imagine/DataManagerTest.php → ...nctional/Imagine/Data/DataManagerTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../Functional/Imagine/FilterManagerTest.php → ...onal/Imagine/Filter/FilterManagerTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
Tests/Functional/Imagine/Filter/Loader/InterlaceFilterLoaderTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
namespace Liip\ImagineBundle\Tests\Functional\Imagine\Filter\Loader; | ||
|
||
use Liip\ImagineBundle\Tests\Functional\WebTestCase; | ||
|
||
class InterlaceFilterLoaderTest extends WebTestCase | ||
{ | ||
public function testCouldBeGetFromContainerAsService() | ||
{ | ||
$this->createClient(); | ||
$service = self::$kernel->getContainer()->get('liip_imagine.filter.loader.interlace'); | ||
|
||
$this->assertInstanceOf('Liip\ImagineBundle\Imagine\Filter\Loader\InterlaceFilterLoader', $service); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Liip\ImagineBundle\Tests\Filter; | ||
|
||
use Liip\ImagineBundle\Imagine\Filter\Loader\InterlaceFilterLoader; | ||
use Liip\ImagineBundle\Tests\AbstractTest; | ||
|
||
/** | ||
* @covers Liip\ImagineBundle\Imagine\Filter\Loader\InterlaceFilterLoader | ||
*/ | ||
class InterlaceFilterLoaderTest extends AbstractTest | ||
{ | ||
public function testLoad() | ||
{ | ||
$loader = new InterlaceFilterLoader(); | ||
|
||
$image = $this->getMockImage(); | ||
$image | ||
->expects($this->once()) | ||
->method('interlace') | ||
->with('TEST') | ||
; | ||
|
||
$result = $loader->load($image, array('mode' => 'TEST')); | ||
|
||
$this->assertInstanceOf('Imagine\Image\ImageInterface', $result); | ||
} | ||
} |