1
0
mirror of https://github.com/Intervention/image.git synced 2025-01-17 12:18:14 +01:00

Add tests for Image::blendTransparency()

This commit is contained in:
Oliver Vogel 2024-01-27 11:07:06 +01:00
parent fd09f59b09
commit 56a064d867
No known key found for this signature in database
GPG Key ID: 1B19D214C02D69BB
2 changed files with 18 additions and 0 deletions

View File

@ -276,6 +276,15 @@ class ImageTest extends TestCase
$this->assertColor(1, 2, 3, 4, $image->blendingColor());
}
public function testBlendTransparency(): void
{
$image = $this->readTestImage('gradient.gif');
$this->assertColor(0, 0, 0, 0, $image->pickColor(1, 0));
$result = $image->blendTransparency('ff5500');
$this->assertColor(255, 85, 0, 255, $image->pickColor(1, 0));
$this->assertColor(255, 85, 0, 255, $result->pickColor(1, 0));
}
public function testToJpeg(): void
{
$this->assertMediaType('image/jpeg', (string) $this->image->toJpeg());

View File

@ -269,6 +269,15 @@ class ImageTest extends TestCase
$this->assertColor(1, 2, 3, 4, $image->blendingColor());
}
public function testBlendTransparency(): void
{
$image = $this->readTestImage('gradient.gif');
$this->assertColor(0, 0, 0, 0, $image->pickColor(1, 0));
$result = $image->blendTransparency('ff5500');
$this->assertColor(255, 85, 0, 255, $image->pickColor(1, 0));
$this->assertColor(255, 85, 0, 255, $result->pickColor(1, 0));
}
public function testToJpeg(): void
{
$this->assertMediaType('image/jpeg', (string) $this->image->toJpeg());