Ejemplo n.º 1
0
 def test_from_xml(self, ControlProperty):
     src = """
     <controlPr
     xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
     autoLine="0">
     <anchor moveWithCells="1">
       <from>
         <xdr:col>4</xdr:col>
         <xdr:colOff>704850</xdr:colOff>
         <xdr:row>59</xdr:row>
         <xdr:rowOff>114300</xdr:rowOff>
       </from>
       <to>
         <xdr:col>4</xdr:col>
         <xdr:colOff>1190625</xdr:colOff>
         <xdr:row>61</xdr:row>
         <xdr:rowOff>47625</xdr:rowOff>
       </to>
     </anchor>
     </controlPr>
     """
     node = fromstring(src)
     prop = ControlProperty.from_tree(node)
     _from = AnchorMarker(col=4, colOff=704850, row=59, rowOff=114300)
     to = AnchorMarker(col=4, colOff=1190625, row=61, rowOff=47625)
     anchor = ObjectAnchor(_from=_from, to=to, moveWithCells=True)
     assert prop == ControlProperty(anchor=anchor, autoLine=False)
Ejemplo n.º 2
0
 def test_ctor(self, ControlProperty):
     _from = AnchorMarker()
     to = AnchorMarker()
     anchor = ObjectAnchor(_from=_from, to=to)
     prop = ControlProperty(anchor=anchor)
     xml = tostring(prop.to_tree())
     expected = """
     <controlPr autoFill="1" autoLine="1" autoPict="1" cf="pict" defaultSize="1" disabled="0" locked="1" print="1"
     recalcAlways="0" uiObject="0"
     xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing">
       <anchor moveWithCells="0" sizeWithCells="0">
         <xdr:from>
           <xdr:col>0</xdr:col>
           <xdr:colOff>0</xdr:colOff>
           <xdr:row>0</xdr:row>
           <xdr:rowOff>0</xdr:rowOff>
         </xdr:from>
         <xdr:to>
           <xdr:col>0</xdr:col>
           <xdr:colOff>0</xdr:colOff>
           <xdr:row>0</xdr:row>
           <xdr:rowOff>0</xdr:rowOff>
         </xdr:to>
       </anchor>
     </controlPr>
     """
     diff = compare_xml(xml, expected)
     assert diff is None, diff