def test__blob_rewrites_sldIdLst(self):
     """Presentation._blob rewrites sldIdLst"""
     # setup ------------------------
     rels = RelationshipCollectionBuilder()
     rels = rels.with_tuple_targets(2, RT_SLIDE_MASTER)
     rels = rels.with_tuple_targets(3, RT_SLIDE)
     rels = rels.with_ordering(RT_SLIDE_MASTER, RT_SLIDE)
     rels = rels.build()
     prs = Presentation()
     prs._relationships = rels
     prs.partname = '/ppt/presentation.xml'
     path = os.path.join(thisdir, 'test_files/presentation.xml')
     prs._element = oxml_parse(path).getroot()
     # exercise ---------------------
     blob = prs._blob
     # verify -----------------------
     presentation = oxml_fromstring(blob)
     sldIds = presentation.xpath('./p:sldIdLst/p:sldId', namespaces=nsmap)
     expected = ['rId3', 'rId4', 'rId5']
     actual = [sldId.get(qtag('r:id')) for sldId in sldIds]
     msg = "expected ordering %s, got %s" % (expected, actual)
     self.assertEqual(expected, actual, msg)
Exemple #2
0
 def master_fixture(self, masters_prop_, slide_master_):
     prs = Presentation(None, None)
     getitem_ = masters_prop_.return_value.__getitem__
     getitem_.return_value = slide_master_
     return prs, getitem_, slide_master_
Exemple #3
0
 def presentation(self):
     """
     A |Presentation| object providing access to the content of this
     presentation.
     """
     return Presentation(self._element, self)
Exemple #4
0
 def core_props_fixture(self, prs_part_, core_properties_):
     prs = Presentation(None, prs_part_)
     prs_part_.core_properties = core_properties_
     return prs, core_properties_
Exemple #5
0
 def layouts_fixture(self, masters_prop_, slide_layouts_):
     prs = Presentation(None, None)
     masters_prop_.return_value.__getitem__.return_value.slide_layouts = (
         slide_layouts_)
     return prs, slide_layouts_
Exemple #6
0
 def sld_width_set_fixture(self, request):
     prs_cxml, expected_cxml = request.param
     prs = Presentation(element(prs_cxml), None)
     expected_xml = xml(expected_cxml)
     return prs, 914400, expected_xml
Exemple #7
0
 def slides_fixture(self, request, part_prop_, Slides_, slides_):
     prs_cxml, rIds, expected_cxml = request.param
     prs = Presentation(element(prs_cxml), None)
     rename_slide_parts_ = part_prop_.return_value.rename_slide_parts
     expected_xml = xml(expected_cxml)
     return prs, rename_slide_parts_, rIds, Slides_, slides_, expected_xml
Exemple #8
0
 def sld_width_get_fixture(self, request):
     prs_cxml, expected_value = request.param
     prs = Presentation(element(prs_cxml), None)
     return prs, expected_value
Exemple #9
0
 def save_fixture(self, prs_part_):
     prs = Presentation(None, prs_part_)
     file_ = "foobar.docx"
     return prs, file_, prs_part_
Exemple #10
0
 def part_fixture(self, prs_part_):
     prs = Presentation(None, prs_part_)
     return prs, prs_part_
Exemple #11
0
 def notes_master_fixture(self, prs_part_, notes_master_):
     prs = Presentation(None, prs_part_)
     prs_part_.notes_master = notes_master_
     return prs, notes_master_
Exemple #12
0
 def masters_fixture(self, request, SlideMasters_, slide_masters_):
     prs_cxml, expected_cxml = request.param
     prs = Presentation(element(prs_cxml), None)
     expected_xml = xml(expected_cxml)
     return prs, SlideMasters_, slide_masters_, expected_xml