Test for black fill and stroke style removal

This commit is contained in:
Brabli
2022-08-29 19:31:27 +01:00
parent 3e4b948569
commit 27dfa0af2e
3 changed files with 21 additions and 2 deletions

View File

@@ -200,6 +200,15 @@ class IconExtensionTest extends TestCase
$this->assertDoesNotMatchRegularExpression('/stroke="\s*rgb\(0,\s*0,\s*0\)\s*"/', $content);
}
public function testBlackStrokeStylesAreRemoved(): void
{
$content = $this->icon->renderIcon(['icon' => self::ICON]);
$this->assertDoesNotMatchRegularExpression('/stroke:\s*#000\s*/', $content);
$this->assertDoesNotMatchRegularExpression('/stroke:\s*#000000\s*/', $content);
$this->assertDoesNotMatchRegularExpression('/stroke:\s*black\s*/', $content);
$this->assertDoesNotMatchRegularExpression('/stroke:\s*rgb\(0,\s*0,\s*0\)\s*/', $content);
}
public function testBlackFillAttributeValuesAreRemoved(): void
{
$content = $this->icon->renderIcon(['icon' => self::ICON]);
@@ -209,6 +218,15 @@ class IconExtensionTest extends TestCase
$this->assertDoesNotMatchRegularExpression('/fill="\s*rgb\(0,\s*0,\s*0\)\s*"/', $content);
}
public function testBlackFillStylesAreRemoved(): void
{
$content = $this->icon->renderIcon(['icon' => self::ICON]);
$this->assertDoesNotMatchRegularExpression('/fill:\s*#000\s*/', $content);
$this->assertDoesNotMatchRegularExpression('/fill:\s*#000000\s*/', $content);
$this->assertDoesNotMatchRegularExpression('/fill:\s*black\s*/', $content);
$this->assertDoesNotMatchRegularExpression('/fill:\s*rgb\(0,\s*0,\s*0\)\s*/', $content);
}
public function testThrowsIfPalleteIsNotFound(): void
{
$this->expectException(PalleteNotFound::class);

View File

@@ -6,4 +6,5 @@
<line fill="black"></line>
<line x1="256" y1="112" x2="256" y2="400" width="101" height="101" style="fill: none; stroke: rgb(0,0, 0); stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"></line>
<line x1="400" y1="256" x2="112" y2="256" width="102" height="102" style="fill: none; stroke: #000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"></line>
<polyline points="112 244 256 100 400 244" style="fill:#000;fill:#000000;fill: black;fill:rgb(0,0,0);stroke:#000;stroke:#000000;stroke:black;stroke:rgb(0, 0, 0);stroke-linecap:round;stroke-linejoin:round;stroke-width:48px"/>
</svg>

Before

Width:  |  Height:  |  Size: 631 B

After

Width:  |  Height:  |  Size: 860 B