From 72f455b2de3e6455a3ded9c6d7116e4fbe883814 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Sun, 5 May 2024 13:06:57 +0200 Subject: [PATCH] Add tests to reproduce bug --- .../Unit/Drivers/Gd/Modifiers/DrawLineModifierTest.php | 10 ++++++++++ .../Drivers/Imagick/Modifiers/DrawLineModifierTest.php | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/tests/Unit/Drivers/Gd/Modifiers/DrawLineModifierTest.php b/tests/Unit/Drivers/Gd/Modifiers/DrawLineModifierTest.php index 67e19f11..903c50ee 100644 --- a/tests/Unit/Drivers/Gd/Modifiers/DrawLineModifierTest.php +++ b/tests/Unit/Drivers/Gd/Modifiers/DrawLineModifierTest.php @@ -25,4 +25,14 @@ final class DrawLineModifierTest extends GdTestCase $image->modify(new DrawLineModifier($line)); $this->assertEquals('b53517', $image->pickColor(0, 0)->toHex()); } + + public function testApplyTransparent(): void + { + $image = $this->createTestImage(10, 10)->fill('ff5500'); + $this->assertColor(255, 85, 0, 255, $image->pickColor(5, 5)); + $line = new Line(new Point(0, 5), new Point(10, 5), 4); + $line->setBackgroundColor('fff4'); + $image->modify(new DrawLineModifier($line)); + $this->assertColor(255, 136, 77, 255, $image->pickColor(5, 5)); + } } diff --git a/tests/Unit/Drivers/Imagick/Modifiers/DrawLineModifierTest.php b/tests/Unit/Drivers/Imagick/Modifiers/DrawLineModifierTest.php index 01762cb9..645c7eed 100644 --- a/tests/Unit/Drivers/Imagick/Modifiers/DrawLineModifierTest.php +++ b/tests/Unit/Drivers/Imagick/Modifiers/DrawLineModifierTest.php @@ -25,4 +25,14 @@ final class DrawLineModifierTest extends ImagickTestCase $image->modify(new DrawLineModifier($line)); $this->assertEquals('b53517', $image->pickColor(0, 0)->toHex()); } + + public function testApplyTransparent(): void + { + $image = $this->createTestImage(10, 10)->fill('ff5500'); + $this->assertColor(255, 85, 0, 255, $image->pickColor(5, 5)); + $line = new Line(new Point(0, 5), new Point(10, 5), 4); + $line->setBackgroundColor('fff4'); + $image->modify(new DrawLineModifier($line)); + $this->assertColor(255, 136, 77, 255, $image->pickColor(5, 5)); + } }