intervention-image-vips-driver icon indicating copy to clipboard operation
intervention-image-vips-driver copied to clipboard

Add initial test suite, fix a few bugs in the process

Open Jalle19 opened this issue 6 years ago • 2 comments

Closes #11

This is a bit WIP still, but assuming you have Docker installed you can run the tests with:

composer install --ignore-platform-reqs
docker build -t phpunit-vips .
docker run -v $(pwd):/app --rm phpunit-vips php ./vendor/bin/phpunit

Currently it outputs this:

PHPUnit 7.5.16 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.1.32
Configuration: /app/phpunit.xml.dist

......................III...................I...........          56 / 56 (100%)

Time: 283 ms, Memory: 6.00 MB

There were 4 incomplete tests:

1) Intervention\Image\Vips\Tests\VipsSystemTest::testFitImageSquare
PNG resizing produces wrong colors due to alpha blending into the pixels

/app/tests/VipsSystemTest.php:325

2) Intervention\Image\Vips\Tests\VipsSystemTest::testFitImageRectangle
PNG resizing produces wrong colors due to alpha blending into the pixels

/app/tests/VipsSystemTest.php:341

3) Intervention\Image\Vips\Tests\VipsSystemTest::testFitImageWithConstraintUpsize
PNG resizing produces wrong colors due to alpha blending into the pixels

/app/tests/VipsSystemTest.php:358

4) Intervention\Image\Vips\Tests\VipsSystemTest::testGammaImage
Pixel color values are slightly off

/app/tests/VipsSystemTest.php:807

OK, but incomplete, skipped, or risky tests!
Tests: 56, Assertions: 452, Incomplete: 4.

Jalle19 avatar Oct 03 '19 13:10 Jalle19

I couldn't get the pixel values to be correct in some of the tests, it seems to be an issue with VIPS itself (possibly in combination with indexed PNGs). The Docker image has libvips 8.8.0 while some stuff regarding this was maybe fixed in 8.8.3, could be that it's fine with a newer library version.

Jalle19 avatar Oct 03 '19 13:10 Jalle19

Thanks! I will check it in the coming days.

bonzai avatar Oct 03 '19 20:10 bonzai