
    BPc                     6    d Z ddlmZ ddlmZ d	dZd Zd ZdS )
z#
SVG specific utilities for tests.
    )etree)
SVG_PARSER c                 p    t          j        t                              d|  d          t                    S )zReturns xml etree based on a simple SVG element.

    svg_attrs: A string containing attributes to add to the
        root <svg> element of a minimal SVG document.
    z;<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg z></svg>parser)r   
fromstringstrencoder   )	svg_attrss    2/usr/share/inkscape/extensions/inkex/tester/svg.pysvgr      sK     

'' ' '	
 	
        c                 (    t          d|  d          S )zSame as svg, but takes a width unit (top-level transform) for the new document.

    The transform is the ratio between the SVG width and the viewBox width.
    zwidth="1z" viewBox="0 0 1 1")r   )
width_units    r   svg_unit_scaledr   +   s    
 9*999:::r   c                     t          | dd          5 }t          j        |t                    }|                                cddd           S # 1 swxY w Y   dS )z/Parse an svg file and return it's document rootrzutf-8)encodingr   N)openr   parser   getroot)filenamefhldocs      r   svg_filer   3   s    	hg	.	.	. #k#j111{{}}                 s   /AAAN)r   )__doc__lxmlr   inkexr   r   r   r    r   r   <module>r!      sq   &                ; ; ;    r   