|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace Intervention\Image\Tests\Unit\Drivers\Imagick\Modifiers; |
| 6 | + |
| 7 | +use Intervention\Image\Colors\Rgb\Color; |
| 8 | +use Intervention\Image\Modifiers\FillTransparentAreasModifier; |
| 9 | +use Intervention\Image\Tests\ImagickTestCase; |
| 10 | +use PHPUnit\Framework\Attributes\CoversClass; |
| 11 | +use PHPUnit\Framework\Attributes\RequiresPhpExtension; |
| 12 | + |
| 13 | +#[RequiresPhpExtension('imagick')] |
| 14 | +#[CoversClass(\Intervention\Image\Modifiers\FillTransparentAreasModifier::class)] |
| 15 | +#[CoversClass(\Intervention\Image\Drivers\Imagick\Modifiers\FillTransparentAreasModifier::class)] |
| 16 | +final class FillTransparentAreasModifierTest extends ImagickTestCase |
| 17 | +{ |
| 18 | + public function testFillTransparentAreas(): void |
| 19 | + { |
| 20 | + $image = $this->readTestImage('circle.png'); |
| 21 | + $this->assertTransparency($image->colorAt(0, 0)); |
| 22 | + $image->modify(new FillTransparentAreasModifier(new Color(255, 85, 0))); |
| 23 | + $this->assertColor(255, 85, 0, 255, $image->colorAt(0, 0)); |
| 24 | + } |
| 25 | + |
| 26 | + public function testFillTransparentAreasKeepsAnimationFrames(): void |
| 27 | + { |
| 28 | + $image = $this->readTestImage('animation.gif'); |
| 29 | + $count = count($image); |
| 30 | + $this->assertGreaterThan(1, $count); |
| 31 | + $image->modify(new FillTransparentAreasModifier(new Color(255, 85, 0))); |
| 32 | + $this->assertCount($count, $image); |
| 33 | + } |
| 34 | +} |
0 commit comments