mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-09-11 20:47:56 +03:00
parent
1432669b30
commit
8c8d059052
@ -1,5 +1,7 @@
|
||||
"""Test the currentColor value."""
|
||||
|
||||
import pytest
|
||||
|
||||
from ..testing_utils import assert_no_logs
|
||||
|
||||
|
||||
@ -50,3 +52,31 @@ def test_current_color_4(assert_pixels):
|
||||
color: lime; border: 1px solid; border-color: inherit }
|
||||
</style>
|
||||
<table><td>''')
|
||||
|
||||
|
||||
@assert_no_logs
|
||||
def test_current_color_svg_1(assert_pixels):
|
||||
assert_pixels('KK\nKK', '''
|
||||
<style>
|
||||
@page { size: 2px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
width="2" height="2" fill="currentColor">
|
||||
<rect width="2" height="2"></rect>
|
||||
</svg>''')
|
||||
|
||||
|
||||
@pytest.mark.xfail
|
||||
@assert_no_logs
|
||||
def test_current_color_svg_2(assert_pixels):
|
||||
assert_pixels('GG\nGG', '''
|
||||
<style>
|
||||
@page { size: 2px }
|
||||
svg { display: block }
|
||||
body { color: lime }
|
||||
</style>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
width="2" height="2">
|
||||
<rect width="2" height="2" fill="currentColor"></rect>
|
||||
</svg>''')
|
||||
|
@ -288,6 +288,11 @@ class SVG:
|
||||
self.tree = Node(wrapper, style)
|
||||
self.url = url
|
||||
|
||||
# Replace 'currentColor' value
|
||||
for key in COLOR_ATTRIBUTES:
|
||||
if self.tree.get(key) == 'currentColor':
|
||||
self.tree.attrib[key] = self.tree.get('color', 'black')
|
||||
|
||||
self.filters = {}
|
||||
self.gradients = {}
|
||||
self.images = {}
|
||||
|
Loading…
Reference in New Issue
Block a user