From 35851b9a4a6121546f53efdb86200ccb830ea25f Mon Sep 17 00:00:00 2001 From: "michael.schramm" Date: Fri, 26 Sep 2014 17:06:27 +0200 Subject: [PATCH] * implement interlace filter * add functional and unit test * move functional tests (DataManager and FilterManager) to subfolders --- .../Filter/Loader/InterlaceFilterLoader.php | 23 +++++++++++++++ Resources/config/imagine.xml | 5 ++++ Resources/doc/filters.md | 14 ++++++++++ .../Imagine/{ => Data}/DataManagerTest.php | 2 +- .../{ => Filter}/FilterManagerTest.php | 2 +- .../Loader/InterlaceFilterLoaderTest.php | 16 +++++++++++ .../Loader/InterlaceFilterLoaderTest.php | 28 +++++++++++++++++++ 7 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 Imagine/Filter/Loader/InterlaceFilterLoader.php rename Tests/Functional/Imagine/{ => Data}/DataManagerTest.php (86%) rename Tests/Functional/Imagine/{ => Filter}/FilterManagerTest.php (86%) create mode 100644 Tests/Functional/Imagine/Filter/Loader/InterlaceFilterLoaderTest.php create mode 100644 Tests/Imagine/Filter/Loader/InterlaceFilterLoaderTest.php diff --git a/Imagine/Filter/Loader/InterlaceFilterLoader.php b/Imagine/Filter/Loader/InterlaceFilterLoader.php new file mode 100644 index 000000000..97baad74b --- /dev/null +++ b/Imagine/Filter/Loader/InterlaceFilterLoader.php @@ -0,0 +1,23 @@ +interlace($mode); + + return $image; + } +} diff --git a/Resources/config/imagine.xml b/Resources/config/imagine.xml index c0be51481..e3454dc93 100644 --- a/Resources/config/imagine.xml +++ b/Resources/config/imagine.xml @@ -41,6 +41,7 @@ Liip\ImagineBundle\Imagine\Filter\Loader\BackgroundFilterLoader Liip\ImagineBundle\Imagine\Filter\Loader\UpscaleFilterLoader Liip\ImagineBundle\Imagine\Filter\Loader\AutoRotateFilterLoader + Liip\ImagineBundle\Imagine\Filter\Loader\InterlaceFilterLoader @@ -171,6 +172,10 @@ + + + + diff --git a/Resources/doc/filters.md b/Resources/doc/filters.md index eac0432e6..501cff1fe 100644 --- a/Resources/doc/filters.md +++ b/Resources/doc/filters.md @@ -149,6 +149,20 @@ liip_imagine: my_thumb: filters: auto_rotate: ~ + +### The `interlace` filter + +Set progressive loading on the image +Configuration looks like this: + +``` yaml +liip_imagine: + filter_sets: + my_thumb: + filters: + interlace: + # mode can be one of none,line,plane,partition + mode: line ``` ## Load your Custom Filters diff --git a/Tests/Functional/Imagine/DataManagerTest.php b/Tests/Functional/Imagine/Data/DataManagerTest.php similarity index 86% rename from Tests/Functional/Imagine/DataManagerTest.php rename to Tests/Functional/Imagine/Data/DataManagerTest.php index 710959b5a..94da78be3 100644 --- a/Tests/Functional/Imagine/DataManagerTest.php +++ b/Tests/Functional/Imagine/Data/DataManagerTest.php @@ -1,5 +1,5 @@ createClient(); + $service = self::$kernel->getContainer()->get('liip_imagine.filter.loader.interlace'); + + $this->assertInstanceOf('Liip\ImagineBundle\Imagine\Filter\Loader\InterlaceFilterLoader', $service); + } +} + diff --git a/Tests/Imagine/Filter/Loader/InterlaceFilterLoaderTest.php b/Tests/Imagine/Filter/Loader/InterlaceFilterLoaderTest.php new file mode 100644 index 000000000..cef7c4252 --- /dev/null +++ b/Tests/Imagine/Filter/Loader/InterlaceFilterLoaderTest.php @@ -0,0 +1,28 @@ +getMockImage(); + $image + ->expects($this->once()) + ->method('interlace') + ->with('TEST') + ; + + $result = $loader->load($image, array('mode' => 'TEST')); + + $this->assertInstanceOf('Imagine\Image\ImageInterface', $result); + } +}