@@ -341,34 +341,24 @@ def test_minus_signs_with_tex(fig_test, fig_ref, texsystem):
341
341
342
342
@pytest .mark .backend ("pgf" )
343
343
def test_sketch_params ():
344
- fig , ax = plt .subplots (figsize = [ 3 , 3 ] )
344
+ fig , ax = plt .subplots (figsize = ( 3 , 3 ) )
345
345
ax .set_xticks ([])
346
346
ax .set_yticks ([])
347
347
ax .set_frame_on (False )
348
- handle = ax .plot ([0 , 1 ])[ 0 ]
348
+ handle , = ax .plot ([0 , 1 ])
349
349
handle .set_sketch_params (scale = 5 , length = 30 , randomness = 42 )
350
350
351
351
with BytesIO () as fd :
352
352
fig .savefig (fd , format = 'pgf' )
353
353
buf = fd .getvalue ().decode ()
354
354
355
- baseline = r"""\begin{pgfscope}%
356
- \pgfpathrectangle{\pgfqpoint{0.375000in}{0.300000in}}""" \
357
- r"""{\pgfqpoint{2.325000in}{2.400000in}}%
358
- \pgfusepath{clip}%
359
- \pgfsetrectcap%
360
- \pgfsetroundjoin%
361
- \pgfsetlinewidth{1.003750pt}%
362
- \definecolor{currentstroke}{rgb}{0.000000,0.000000,1.000000}%
363
- \pgfsetstrokecolor{currentstroke}%
364
- \pgfsetdash{}{0pt}%
365
- \pgfpathmoveto{\pgfqpoint{0.375000in}{0.300000in}}%
355
+ baseline = r"""\pgfpathmoveto{\pgfqpoint{0.375000in}{0.300000in}}%
366
356
\pgfpathlineto{\pgfqpoint{2.700000in}{2.700000in}}%
367
357
\pgfkeys{/pgf/decoration/.cd, """ \
368
358
r"""segment length = 0.300000in, amplitude = 0.050000in}%
369
359
\pgfmathsetseed{42}%
370
360
\pgfdecoratecurrentpath{random steps}%
371
- \pgfusepath{stroke}%
372
- \end{pgfscope}%"""
373
- # check that \pgfkeys{/pgf/decoration/.cd, ...} is in path definition
361
+ \pgfusepath{stroke}%"""
362
+ # \pgfdecoratecurrentpath must be after the path definition and before the
363
+ # path is used (\pgfusepath)
374
364
assert baseline in buf
0 commit comments