def clone_fixture(self, slide_layout_, placeholder_, _clone_layout_placeholder_): shapes = SlideShapeTree(None) slide_layout_.iter_cloneable_placeholders.return_value = (iter( [placeholder_])) return (shapes, slide_layout_, placeholder_, _clone_layout_placeholder_)
def ph_name_fixture(self, request, slide_): ph_type, id_, orient, expected_name = request.param slide_.spTree = (an_spTree().with_nsdecls().with_child( a_cNvPr().with_name('Title 1')).with_child( a_cNvPr().with_name('Table Placeholder 3'))).element shapes = SlideShapeTree(slide_) return shapes, ph_type, id_, orient, expected_name
def picture_fixture(self, slide_, image_file_, x_, y_, cx_, cy_, image_part_, rId_, _add_pic_from_image_part_, pic_, _shape_factory_, picture_): shapes = SlideShapeTree(slide_) slide_.get_or_add_image_part.return_value = (image_part_, rId_) _shape_factory_.return_value = picture_ return (shapes, image_file_, x_, y_, cx_, cy_, image_part_, rId_, pic_, picture_)
def autoshape_fixture(self, autoshape_type_id_, x_, y_, cx_, cy_, AutoShapeType_, _add_sp_from_autoshape_type_, autoshape_type_, _shape_factory_, sp_, shape_): shapes = SlideShapeTree(None) _shape_factory_.return_value = shape_ return (shapes, autoshape_type_id_, x_, y_, cx_, cy_, AutoShapeType_, _add_sp_from_autoshape_type_, autoshape_type_, _shape_factory_, sp_, shape_)
def add_chart_graph_frm_fixture(self, rId_, x_, y_, cx_, cy_, _add_chart_graphicFrame_, SlideShapeFactory_, graphicFrame_, graphic_frame_): shape_tree = SlideShapeTree(None) SlideShapeFactory_.return_value = graphic_frame_ return (shape_tree, rId_, x_, y_, cx_, cy_, _add_chart_graphicFrame_, SlideShapeFactory_, graphicFrame_, graphic_frame_)
def table_fixture(self, rows_, cols_, x_, y_, cx_, cy_, _add_graphicFrame_containing_table_, _shape_factory_, graphicFrame_, table_): shapes = SlideShapeTree(None) _shape_factory_.return_value = table_ return (shapes, rows_, cols_, x_, y_, cx_, cy_, _add_graphicFrame_containing_table_, _shape_factory_, graphicFrame_, table_)
def title_fixture(self, request, slide_, _shape_factory_, shape_): spTree_cxml, found = request.param spTree = element(spTree_cxml) sp = spTree.xpath('p:sp')[1] slide_.spTree = spTree shapes = SlideShapeTree(slide_) _shape_factory_.return_value = shape_ calls = [call(sp)] if found else [] expected_value = shape_ if found else None return shapes, _shape_factory_, calls, expected_value
def add_chart_graphicFrame_fixture(self, slide_, _next_shape_id_, id_): rId, x, y, cx, cy = 'rId42', 1, 2, 3, 4 shape_tree = SlideShapeTree(slide_) expected_xml = ( '<p:graphicFrame xmlns:a="http://schemas.openxmlformats.org/draw' 'ingml/2006/main" xmlns:p="http://schemas.openxmlformats.org/pre' 'sentationml/2006/main">\n <p:nvGraphicFramePr>\n <p:cNvPr i' 'd="42" name="Chart 41"/>\n <p:cNvGraphicFramePr>\n <a:g' 'raphicFrameLocks noGrp="1"/>\n </p:cNvGraphicFramePr>\n <' 'p:nvPr/>\n </p:nvGraphicFramePr>\n <p:xfrm>\n <a:off x="1"' ' y="2"/>\n <a:ext cx="3" cy="4"/>\n </p:xfrm>\n <a:graphic' '>\n <a:graphicData uri="http://schemas.openxmlformats.org/dr' 'awingml/2006/chart">\n <c:chart xmlns:c="http://schemas.op' 'enxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.' 'openxmlformats.org/officeDocument/2006/relationships" r:id="rId' '42"/>\n </a:graphicData>\n </a:graphic>\n</p:graphicFrame>' '\n') return (shape_tree, rId, x, y, cx, cy, expected_xml)
def sp_fixture(self, slide_, autoshape_type_, x_, y_, cx_, cy_, spTree_, _next_shape_id_, id_, prst_, sp_): shapes = SlideShapeTree(slide_) name = 'Foobar 41' return (shapes, autoshape_type_, x_, y_, cx_, cy_, spTree_, id_, name, prst_, sp_)
def pic_fixture(self, slide_, image_part_, rId_, x_, y_, cx_, cy_, spTree_, _next_shape_id_, id_, name, desc_, scaled_cx_, scaled_cy_, pic_): shapes = SlideShapeTree(slide_) return (shapes, image_part_, rId_, x_, y_, cx_, cy_, spTree_, id_, name, desc_, scaled_cx_, scaled_cy_, pic_)
def no_title_fixture(self, slide_, spTree_, sp_): shapes = SlideShapeTree(slide_) spTree_.iter_shape_elms.return_value = [sp_, sp_] return shapes
def shapes(self): """ Instance of |_SlideShapeTree| containing sequence of shape objects appearing on this slide. """ return SlideShapeTree(self)
def textbox_sp_fixture(self, slide_, x_, y_, cx_, cy_, spTree_, _next_shape_id_, id_, sp_): shapes = SlideShapeTree(slide_) name = 'TextBox 41' return shapes, x_, y_, cx_, cy_, spTree_, id_, name, sp_
def factory_fixture(self, ph_elm_, SlideShapeFactory_, slide_placeholder_): shapes = SlideShapeTree(None) SlideShapeFactory_.return_value = slide_placeholder_ return shapes, ph_elm_, SlideShapeFactory_, slide_placeholder_
def clone_ph_fixture(self, slide_, layout_placeholder_, spTree_, _next_shape_id_, id_, _next_ph_name_, name_, ph_type_, orient_, sz_, idx_): shapes = SlideShapeTree(slide_) return (shapes, layout_placeholder_, spTree_, id_, name_, ph_type_, orient_, sz_, idx_)
def add_chart_fixture(self, slide_, chart_type_, chart_data_, rId_, _add_chart_graphic_frame_, graphic_frame_): shape_tree = SlideShapeTree(slide_) x, y, cx, cy = 1, 2, 3, 4 return (shape_tree, chart_type_, x, y, cx, cy, chart_data_, rId_, graphic_frame_)
def textbox_fixture(self, x_, y_, cx_, cy_, _add_textbox_sp_, _shape_factory_, sp_, textbox_): shapes = SlideShapeTree(None) _shape_factory_.return_value = textbox_ return (shapes, x_, y_, cx_, cy_, _add_textbox_sp_, _shape_factory_, sp_, textbox_)
def graphicFrame_fixture(self, slide_, rows_, cols_, x_, y_, cx_, cy_, spTree_, _next_shape_id_, id_, graphicFrame_): shapes = SlideShapeTree(slide_) name = 'Table 41' return (shapes, rows_, cols_, x_, y_, cx_, cy_, spTree_, id_, name, graphicFrame_)
def title_fixture(self, slide_, sp_2_, _shape_factory_, shape_): shapes = SlideShapeTree(slide_) _shape_factory_.return_value = shape_ title_placeholder_ = shape_ return shapes, _shape_factory_, sp_2_, title_placeholder_
def index_fixture(self, slide_, shape_): shapes = SlideShapeTree(slide_) expected_idx = 1 return shapes, shape_, expected_idx