File tree 2 files changed +29
-2
lines changed
2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -435,3 +435,26 @@ def test_rect_width_height_zero(assert_pixels):
435
435
<rect x="2" y="2" width="5" height="5" fill="red" />
436
436
</svg>
437
437
''' )
438
+
439
+
440
+ @assert_no_logs
441
+ def test_rect_fill_inherit (assert_pixels ):
442
+ assert_pixels ('''
443
+ _________
444
+ _________
445
+ __KKKKK__
446
+ __KKKKK__
447
+ __KKKKK__
448
+ __KKKKK__
449
+ __KKKKK__
450
+ _________
451
+ _________
452
+ ''' , '''
453
+ <style>
454
+ @page { size: 9px }
455
+ svg { display: block }
456
+ </style>
457
+ <svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
458
+ <rect x="2" y="2" width="5" height="5" fill="inherit" />
459
+ </svg>
460
+ ''' )
Original file line number Diff line number Diff line change @@ -150,9 +150,13 @@ def __iter__(self):
150
150
child .attrib [key ] = child .get ('color' , 'black' )
151
151
152
152
# Handle 'inherit' values
153
- for key , value in child .attrib .items ():
153
+ for key , value in child .attrib .copy (). items ():
154
154
if value == 'inherit' :
155
- child .attrib [key ] = self .get (key )
155
+ value = self .get (key )
156
+ if value is None :
157
+ del child .attrib [key ]
158
+ else :
159
+ child .attrib [key ] = value
156
160
157
161
# Fix text in text tags
158
162
if child .tag in ('text' , 'textPath' , 'a' ):
You can’t perform that action at this time.
0 commit comments