def it_knows_how_to_create_a_new_autoshape_sp(self):
     # setup ------------------------
     id_ = 9
     name = "Rounded Rectangle 8"
     prst = "roundRect"
     left, top, width, height = 111, 222, 333, 444
     xml = (
         '<p:sp %s>\n  <p:nvSpPr>\n    <p:cNvPr id="%d" name="%s"/>\n    <'
         "p:cNvSpPr/>\n    <p:nvPr/>\n  </p:nvSpPr>\n  <p:spPr>\n    <a:xf"
         'rm>\n      <a:off x="%d" y="%d"/>\n      <a:ext cx="%d" cy="%d"/'
         '>\n    </a:xfrm>\n    <a:prstGeom prst="%s">\n      <a:avLst/>\n'
         '    </a:prstGeom>\n  </p:spPr>\n  <p:style>\n    <a:lnRef idx="1'
         '">\n      <a:schemeClr val="accent1"/>\n    </a:lnRef>\n    <a:f'
         'illRef idx="3">\n      <a:schemeClr val="accent1"/>\n    </a:fil'
         'lRef>\n    <a:effectRef idx="2">\n      <a:schemeClr val="accent'
         '1"/>\n    </a:effectRef>\n    <a:fontRef idx="minor">\n      <a:'
         'schemeClr val="lt1"/>\n    </a:fontRef>\n  </p:style>\n  <p:txBo'
         'dy>\n    <a:bodyPr rtlCol="0" anchor="ctr"/>\n    <a:lstStyle/>'
         '\n    <a:p>\n      <a:pPr algn="ctr"/>\n    </a:p>\n  </p:txBody'
         ">\n</p:sp>\n" %
         (nsdecls("a", "p"), id_, name, left, top, width, height, prst))
     # exercise ---------------------
     sp = CT_Shape.new_autoshape_sp(id_, name, prst, left, top, width,
                                    height)
     # verify -----------------------
     assert sp.xml == xml
Beispiel #2
0
 def test_new_autoshape_sp_generates_correct_xml(self):
     """CT_Shape._new_autoshape_sp() returns correct XML"""
     # setup ------------------------
     id_ = 9
     name = 'Rounded Rectangle 8'
     prst = 'roundRect'
     left, top, width, height = 111, 222, 333, 444
     xml = (
         '<p:sp %s>\n  <p:nvSpPr>\n    <p:cNvPr id="%d" name="%s"/>\n    <'
         'p:cNvSpPr/>\n    <p:nvPr/>\n  </p:nvSpPr>\n  <p:spPr>\n    <a:xf'
         'rm>\n      <a:off x="%d" y="%d"/>\n      <a:ext cx="%d" cy="%d"/'
         '>\n    </a:xfrm>\n    <a:prstGeom prst="%s">\n      <a:avLst/>\n'
         '    </a:prstGeom>\n  </p:spPr>\n  <p:style>\n    <a:lnRef idx="1'
         '">\n      <a:schemeClr val="accent1"/>\n    </a:lnRef>\n    <a:f'
         'illRef idx="3">\n      <a:schemeClr val="accent1"/>\n    </a:fil'
         'lRef>\n    <a:effectRef idx="2">\n      <a:schemeClr val="accent'
         '1"/>\n    </a:effectRef>\n    <a:fontRef idx="minor">\n      <a:'
         'schemeClr val="lt1"/>\n    </a:fontRef>\n  </p:style>\n  <p:txBo'
         'dy>\n    <a:bodyPr rtlCol="0" anchor="ctr"/>\n    <a:lstStyle/>'
         '\n    <a:p>\n      <a:pPr algn="ctr"/>\n    </a:p>\n  </p:txBody'
         '>\n</p:sp>\n' %
         (nsdecls('a', 'p'), id_, name, left, top, width, height, prst))
     # exercise ---------------------
     sp = CT_Shape.new_autoshape_sp(id_, name, prst, left, top, width,
                                    height)
     # verify -----------------------
     self.assertEqualLineByLine(xml, sp)
 def it_knows_how_to_create_a_new_autoshape_sp(self):
     # setup ------------------------
     id_ = 9
     name = 'Rounded Rectangle 8'
     prst = 'roundRect'
     left, top, width, height = 111, 222, 333, 444
     xml = (
         '<p:sp %s>\n  <p:nvSpPr>\n    <p:cNvPr id="%d" name="%s"/>\n    <'
         'p:cNvSpPr/>\n    <p:nvPr/>\n  </p:nvSpPr>\n  <p:spPr>\n    <a:xf'
         'rm>\n      <a:off x="%d" y="%d"/>\n      <a:ext cx="%d" cy="%d"/'
         '>\n    </a:xfrm>\n    <a:prstGeom prst="%s">\n      <a:avLst/>\n'
         '    </a:prstGeom>\n  </p:spPr>\n  <p:style>\n    <a:lnRef idx="1'
         '">\n      <a:schemeClr val="accent1"/>\n    </a:lnRef>\n    <a:f'
         'illRef idx="3">\n      <a:schemeClr val="accent1"/>\n    </a:fil'
         'lRef>\n    <a:effectRef idx="2">\n      <a:schemeClr val="accent'
         '1"/>\n    </a:effectRef>\n    <a:fontRef idx="minor">\n      <a:'
         'schemeClr val="lt1"/>\n    </a:fontRef>\n  </p:style>\n  <p:txBo'
         'dy>\n    <a:bodyPr rtlCol="0" anchor="ctr"/>\n    <a:lstStyle/>'
         '\n    <a:p>\n      <a:pPr algn="ctr"/>\n    </a:p>\n  </p:txBody'
         '>\n</p:sp>\n' %
         (nsdecls('a', 'p'), id_, name, left, top, width, height, prst)
     )
     # exercise ---------------------
     sp = CT_Shape.new_autoshape_sp(id_, name, prst, left, top,
                                    width, height)
     # verify -----------------------
     assert sp.xml == xml
Beispiel #4
0
 def add_autoshape(self, id_, name, prst, x, y, cx, cy):
     """
     Append a new ``<p:sp>`` shape to the group/shapetree having the
     properties specified in call.
     """
     sp = CT_Shape.new_autoshape_sp(id_, name, prst, x, y, cx, cy)
     self.insert_element_before(sp, 'p:extLst')
     return sp
Beispiel #5
0
 def add_autoshape(self, id_, name, prst, x, y, cx, cy):
     """
     Append a new ``<p:sp>`` shape to the group/shapetree having the
     properties specified in call.
     """
     sp = CT_Shape.new_autoshape_sp(id_, name, prst, x, y, cx, cy)
     self.insert_element_before(sp, "p:extLst")
     return sp